summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Crittenden <rcritten@redhat.com>2008-02-20 16:31:32 -0500
committerRob Crittenden <rcritten@redhat.com>2008-02-20 16:31:32 -0500
commit87d9c037e40c88e803330fbb809a4c31c73a2ec4 (patch)
tree6643a384579b8f7581478f92ad66f8c9e8301748
parent80feb3aecf80050e350a1f65dc8eda8a7bfa8a70 (diff)
downloadfreeipa-87d9c037e40c88e803330fbb809a4c31c73a2ec4.tar.gz
freeipa-87d9c037e40c88e803330fbb809a4c31c73a2ec4.tar.xz
freeipa-87d9c037e40c88e803330fbb809a4c31c73a2ec4.zip
Add some additional error handling
433347
-rw-r--r--ipa-server/ipa-install/ipa-replica-prepare11
-rw-r--r--ipa-server/ipaserver/certs.py5
2 files changed, 11 insertions, 5 deletions
diff --git a/ipa-server/ipa-install/ipa-replica-prepare b/ipa-server/ipa-install/ipa-replica-prepare
index 8761f6535..e25592752 100644
--- a/ipa-server/ipa-install/ipa-replica-prepare
+++ b/ipa-server/ipa-install/ipa-replica-prepare
@@ -92,10 +92,13 @@ def export_certdb(realm_name, ds_dir, dir, fname, subject):
fname is the filename of the PKCS#12 file for this cert (minus the .p12).
subject is the subject of the certificate we are creating
"""
- ds_ca = certs.CertDB(dsinstance.config_dirname(dsinstance.realm_to_serverid(realm_name)))
- ca = certs.CertDB(dir)
- ca.create_from_cacert(ds_ca.cacert_fname)
- ca.create_server_cert("Server-Cert", subject, ds_ca)
+ try:
+ ds_ca = certs.CertDB(dsinstance.config_dirname(dsinstance.realm_to_serverid(realm_name)))
+ ca = certs.CertDB(dir)
+ ca.create_from_cacert(ds_ca.cacert_fname)
+ ca.create_server_cert("Server-Cert", subject, ds_ca)
+ except Exception, e:
+ raise e
pkcs12_fname = dir + "/" + fname + ".p12"
passwd_fname = dir + "/pwdfile.txt"
diff --git a/ipa-server/ipaserver/certs.py b/ipa-server/ipaserver/certs.py
index 11b1096a5..2ad842c9f 100644
--- a/ipa-server/ipaserver/certs.py
+++ b/ipa-server/ipaserver/certs.py
@@ -73,7 +73,10 @@ class CertDB(object):
try:
f=open("/usr/share/ipa/serial","r")
r = f.readline()
- self.cur_serial = int(r) + 1
+ try:
+ self.cur_serial = int(r) + 1
+ except ValueError:
+ raise RuntimeError("The value in /usr/share/ipa/serial is not an integer")
f.close()
except IOError, e:
if e.errno == errno.ENOENT: