Blob Blame History Raw
diff -rupN cobbler-2.0.7.old/cobbler/api.py cobbler-2.0.7/cobbler/api.py
--- cobbler-2.0.7.old/cobbler/api.py	2015-05-06 14:47:57.860206615 -0400
+++ cobbler-2.0.7/cobbler/api.py	2015-05-06 15:09:40.455772584 -0400
@@ -179,11 +179,9 @@ class BootAPI:
         API instance, regardless of the serializer type.
         """
         if not os.path.exists("/var/lib/cobbler/.mtime"):
-            old = os.umask(0x777)
-            fd = open("/var/lib/cobbler/.mtime","w")
-            fd.write("0")
-            fd.close()
-            os.umask(old)
+            fd = os.open("/var/lib/cobbler/.mtime", os.O_CREAT|os.O_RDWR, 0200)
+            os.write(fd, "0")
+            os.close(fd)
             return 0
         fd = open("/var/lib/cobbler/.mtime")
         data = fd.read().strip()
diff -rupN cobbler-2.0.7.old/cobbler/cobblerd.py cobbler-2.0.7/cobbler/cobblerd.py
--- cobbler-2.0.7.old/cobbler/cobblerd.py	2015-05-06 14:47:57.856206586 -0400
+++ cobbler-2.0.7/cobbler/cobblerd.py	2015-05-06 15:23:17.605662935 -0400
@@ -58,10 +58,9 @@ def regen_ss_file():
     fd = open("/dev/urandom")
     data = fd.read(512)
     fd.close()
-    fd = open("/var/lib/cobbler/web.ss","w+")
-    fd.write(binascii.hexlify(data))
-    fd.close()
-    utils.os_system("chmod 700 /var/lib/cobbler/web.ss")
+    fd = os.open("/var/lib/cobbler/web.ss", os.O_CREAT|os.O_RDWR, 0600)
+    os.write(fd, binascii.hexlify(data))
+    os.close(fd)
     utils.os_system("chown apache /var/lib/cobbler/web.ss")
     return 1
 
diff -rupN cobbler-2.0.7.old/cobbler/serializer.py cobbler-2.0.7/cobbler/serializer.py
--- cobbler-2.0.7.old/cobbler/serializer.py	2015-05-06 14:47:57.858206601 -0400
+++ cobbler-2.0.7/cobbler/serializer.py	2015-05-06 15:24:31.318192455 -0400
@@ -64,11 +64,9 @@ def __release_lock(with_changes=False):
         # this file is used to know when the last config change
         # was made -- allowing the API to work more smoothly without
         # a lot of unneccessary reloads.  
-        old = os.umask(0x777)
-        fd = open("/var/lib/cobbler/.mtime","w")
-        fd.write("%f" % time.time())
-        fd.close()
-        os.umask(old)
+        fd = os.open("/var/lib/cobbler/.mtime", os.O_CREAT|os.O_RDWR, 0200)
+        os.write(fd, "%f" % time.time())
+        os.close(fd)
     if LOCK_ENABLED:
         LOCK_HANDLE = open("/var/lib/cobbler/lock","r")
         fcntl.flock(LOCK_HANDLE.fileno(), fcntl.LOCK_UN)