aboutsummaryrefslogtreecommitdiffstats
path: root/share/libmsec.py
diff options
context:
space:
mode:
authorOlivier Thauvin <nanardon@mandriva.org>2007-08-18 16:11:47 +0000
committerOlivier Thauvin <nanardon@mandriva.org>2007-08-18 16:11:47 +0000
commit8b534cba9606007d199e21a0ba2855a94577d025 (patch)
treef05c711bd78e36ac2729296df4a612ede7181fdc /share/libmsec.py
parenta900842470e25ece8e3159ad0c695f271c4abaee (diff)
downloadmsec-8b534cba9606007d199e21a0ba2855a94577d025.tar
msec-8b534cba9606007d199e21a0ba2855a94577d025.tar.gz
msec-8b534cba9606007d199e21a0ba2855a94577d025.tar.bz2
msec-8b534cba9606007d199e21a0ba2855a94577d025.tar.xz
msec-8b534cba9606007d199e21a0ba2855a94577d025.zip
- add set_user_umask() for fs (pixel)
Diffstat (limited to 'share/libmsec.py')
-rw-r--r--share/libmsec.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/share/libmsec.py b/share/libmsec.py
index 01beee8..3174108 100644
--- a/share/libmsec.py
+++ b/share/libmsec.py
@@ -41,6 +41,7 @@ AUTOLOGIN = '/etc/sysconfig/autologin'
BASTILLENOLOGIN = '/etc/bastille-no-login'
CRON = '/etc/cron.d/msec'
CRONALLOW = '/etc/cron.allow'
+FSTAB = '/etc/fstab'
GDM = '/etc/pam.d/gdm'
GDMCONF = '/etc/X11/gdm/gdm.conf'
HALT = '/usr/bin/halt'
@@ -376,6 +377,25 @@ def set_shell_history_size(size):
if val != None:
_interactive and log(_('Removing limit on shell history size'))
msec.remove_line_matching('^HISTFILESIZE=')
+
+################################################################################
+
+def set_win_parts_umask(umask):
+ ''' Set umask option for mounting vfat and ntfs partitions. A value of None means default umask.'''
+ fstab = ConfigFile.get_config_file(FSTAB)
+
+ # don't lower security when not changing security level
+ if same_level():
+ if umask != None:
+ return
+
+ if umask == None:
+ fstab.replace_line_matching("(.*\s(vfat|ntfs)\s+)umask=\d+(\s.*)", "@1defaults@3", 0, 1)
+ fstab.replace_line_matching("(.*\s(vfat|ntfs)\s+)umask=\d+,(.*)", "@1@3", 0, 1)
+ fstab.replace_line_matching("(.*\s(vfat|ntfs)\s+\S+),umask=\d+(.*)", "@1@3", 0, 1)
+ else:
+ fstab.replace_line_matching("(.*\s(vfat|ntfs)\s+\S*)umask=\d+(.*)", "@1umask=0@3", 0, 1)
+ fstab.replace_line_matching("(.*\s(vfat|ntfs)\s+)(?!.*umask=)(\S+)(.*)", "@1@3,umask=0@4", 0, 1)
################################################################################