summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/config/ipachangeconf.py9
-rw-r--r--server/config/upgrade_config.py6
2 files changed, 12 insertions, 3 deletions
diff --git a/server/config/ipachangeconf.py b/server/config/ipachangeconf.py
index 9635de44..f06ab4c3 100644
--- a/server/config/ipachangeconf.py
+++ b/server/config/ipachangeconf.py
@@ -25,10 +25,15 @@ import time
import shutil
import re
-def openLocked(filename, perms):
+def openLocked(filename, perms, create = True):
fd = -1
+
+ flags = os.O_RDWR
+ if create:
+ flags = flags | os.O_CREAT
+
try:
- fd = os.open(filename, os.O_RDWR | os.O_CREAT, perms)
+ fd = os.open(filename, flags, perms)
fcntl.lockf(fd, fcntl.LOCK_EX)
except OSError, (errno, strerr):
if fd != -1:
diff --git a/server/config/upgrade_config.py b/server/config/upgrade_config.py
index 09758211..d47fcd38 100644
--- a/server/config/upgrade_config.py
+++ b/server/config/upgrade_config.py
@@ -34,7 +34,7 @@ class SSSDConfigFile(SSSDChangeConf):
SSSDChangeConf.__init__(self)
self.filename = filename
- f = openLocked(self.filename, 0600)
+ f = openLocked(self.filename, 0600, False)
self.opts = self.parse(f)
f.close()
@@ -368,6 +368,10 @@ def main():
verbose(traceback.format_exc(), options.verbose)
print >>sys.stderr, "Cannot parse config file %s" % options.filename
return 1
+ except Exception, e:
+ print "ERROR: %s" % e
+ verbose(traceback.format_exc(), options.verbose)
+ return 1
# make sure we keep strict settings when creating new files
os.umask(0077)