summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Weiß <holger@zedat.fu-berlin.de>2011-09-14 23:04:20 +0200
committerHolger Weiß <holger@zedat.fu-berlin.de>2011-09-14 23:04:20 +0200
commitd7484c8c2aa3d5c52824559d27adcb9528613679 (patch)
tree442cf7761edea1cf040aed30fa10926b85a53a10
parenta3f986e98b29bfa5f1f5dfd82bac52274091c440 (diff)
downloadbcfg2-d7484c8c2aa3d5c52824559d27adcb9528613679.tar.gz
bcfg2-d7484c8c2aa3d5c52824559d27adcb9528613679.tar.bz2
bcfg2-d7484c8c2aa3d5c52824559d27adcb9528613679.zip
POSIX: Honor the user's umask
The umask was set to zero in order to address the issue that mknod(2)'s mode argument is modified by the process's umask. However, this umask setting also affected auto-created parent directories of configuration entries: their permissions were set to `drwxrwxrwx'. So, we now call chmod(2) after mknod(2) instead of setting the umask to zero.
-rw-r--r--src/lib/Client/Tools/POSIX.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/lib/Client/Tools/POSIX.py b/src/lib/Client/Tools/POSIX.py
index a7a0c4f63..372d4d9e4 100644
--- a/src/lib/Client/Tools/POSIX.py
+++ b/src/lib/Client/Tools/POSIX.py
@@ -115,13 +115,6 @@ class POSIX(Bcfg2.Client.Tools.Tool):
setup.parse([])
ppath = setup['ppath']
max_copies = setup['max_copies']
- """
- Python uses the OS mknod(2) implementation which modifies the mode
- based on the umask of the running process (at least on some Linuxes
- that were tested). We set this to zero so that POSIX-related paths
- will be created as specified in the Bcfg2 configuration.
- """
- os.umask(0)
def canInstall(self, entry):
"""Check if entry is complete for installation."""
@@ -257,6 +250,13 @@ class POSIX(Bcfg2.Client.Tools.Tool):
os.mknod(entry.get('name'), mode, device)
else:
os.mknod(entry.get('name'), mode)
+ """
+ Python uses the OS mknod(2) implementation which modifies the
+ mode based on the umask of the running process. Therefore, the
+ following chmod(2) call is needed to make sure the permissions
+ are set as specified by the user.
+ """
+ os.chmod(entry.get('name'), mode)
os.chown(entry.get('name'), normUid(entry), normGid(entry))
return True
except KeyError: