aboutsummaryrefslogtreecommitdiffstats
path: root/share/Perms.py
diff options
context:
space:
mode:
authorFrederic Lepied <flepied@mandriva.com>2002-06-27 07:56:41 +0000
committerFrederic Lepied <flepied@mandriva.com>2002-06-27 07:56:41 +0000
commitb627ab3c00142988caa09857f0e6e833497764b9 (patch)
treec87428649412067a78968224867df32013aa467e /share/Perms.py
parent6000fbf9bafa12a346e56a105a0e48d1366ed744 (diff)
downloadmsec-b627ab3c00142988caa09857f0e6e833497764b9.tar
msec-b627ab3c00142988caa09857f0e6e833497764b9.tar.gz
msec-b627ab3c00142988caa09857f0e6e833497764b9.tar.bz2
msec-b627ab3c00142988caa09857f0e6e833497764b9.tar.xz
msec-b627ab3c00142988caa09857f0e6e833497764b9.zip
if we don't change the security level, try not to lower the security
if the user has changed it manually (added -c option).
Diffstat (limited to 'share/Perms.py')
-rwxr-xr-xshare/Perms.py19
1 files changed, 13 insertions, 6 deletions
diff --git a/share/Perms.py b/share/Perms.py
index 2f7216d..b347e25 100755
--- a/share/Perms.py
+++ b/share/Perms.py
@@ -136,9 +136,13 @@ def fix_perms(path):
error(_('invalid syntax in %s line %d') % (path, lineno))
file.close()
-def act():
+def act(change):
for f in assoc.keys():
(mode, uid, gid, newperm, user, group, user_str, group_str) = assoc[f]
+ # if we don't change the security level, try not to lower the security
+ # if the user has changed it manually
+ if not change:
+ newperm = newperm & mode
#print f, (mode, uid, gid, newperm, user, group)
if newperm != -1 and mode != newperm:
log(_('changed mode of %s from %o to %o') % (f, mode, newperm))
@@ -184,11 +188,12 @@ if __name__ == '__main__':
import getopt
_interactive = sys.stdin.isatty()
-
+ change = 0
+
# process the options
try:
- (opt, args) = getopt.getopt(sys.argv[1:], 'o:',
- ['option'])
+ (opt, args) = getopt.getopt(sys.argv[1:], 'co:',
+ ['change', 'option'])
except getopt.error:
error(_('Invalid option. Use %s (-o var=<val>...) ([0-5])') % sys.argv[0])
sys.exit(1)
@@ -201,7 +206,9 @@ if __name__ == '__main__':
sys.exit(1)
else:
Config.set_config(pair[0], pair[1])
-
+ elif o[0] == '-c' or o[0] == '--change':
+ change = 1
+
# initlog must be done after processing the option because we can change
# the way to report log with options...
if _interactive:
@@ -219,6 +226,6 @@ if __name__ == '__main__':
fix_perms(p)
# do the modifications
- act()
+ act(change)
# Perms.py ends here