aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/msec/config.py8
-rwxr-xr-xsrc/msec/msec.py2
-rwxr-xr-xsrc/msec/msecperms.py4
3 files changed, 11 insertions, 3 deletions
diff --git a/src/msec/config.py b/src/msec/config.py
index e928ab4..9561300 100644
--- a/src/msec/config.py
+++ b/src/msec/config.py
@@ -334,6 +334,14 @@ class PermConfig(MsecConfig):
self.log = log
self.regexp = re.compile("^([^\s]*)\s*([a-z]*)\.([a-z]*)\s*([\d]?\d\d\d|current)\s*(force)?$")
+ def merge(self, newconfig, overwrite=False):
+ """Merges parameters from newconfig to current config"""
+ for opt in newconfig.list_options():
+ if overwrite:
+ self.set(opt, newconfig.get(opt))
+ else:
+ self.get(opt, newconfig.get(opt))
+
def reset(self):
MsecConfig.reset(self)
del self.options_order
diff --git a/src/msec/msec.py b/src/msec/msec.py
index 0bb43a6..879ec19 100755
--- a/src/msec/msec.py
+++ b/src/msec/msec.py
@@ -147,7 +147,7 @@ if __name__ == "__main__":
# saving current setting as new level
if save:
newlevel = config.MsecConfig(log, config=config.SECURITY_LEVEL % (root, level))
- newlevel.merge(msec_config)
+ newlevel.merge(permconf, overwrite=True)
# update new level name
newlevel.set("BASE_LEVEL", level)
newlevel.save()
diff --git a/src/msec/msecperms.py b/src/msec/msecperms.py
index cdb9b0e..f07b745 100755
--- a/src/msec/msecperms.py
+++ b/src/msec/msecperms.py
@@ -164,8 +164,8 @@ if __name__ == "__main__":
# saving current setting as new level
if save:
- newlevel = config.MsecConfig(log, config=config.SECURITY_LEVEL % (root, level))
- newlevel.merge(permconf)
+ newlevel = config.PermConfig(log, config=config.PERMISSIONS_LEVEL % (root, level))
+ newlevel.merge(permconf, overwrite=True)
newlevel.save()
sys.exit(0)