aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/msec/config.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/msec/config.py b/src/msec/config.py
index 3c84d1f..29ba705 100644
--- a/src/msec/config.py
+++ b/src/msec/config.py
@@ -275,6 +275,19 @@ class MsecConfig:
if value == None or value == OPTION_DISABLED:
self.log.debug("Skipping %s" % option)
value=""
+ else:
+ # escape special characters
+ escape=False
+ for c in [' ', '|', ';', '\\', '\r', '\n']:
+ if c in value:
+ escape=True
+ if escape:
+ if value[0] == '"' and value[-1] == '"':
+ # string is already escaped
+ pass
+ else:
+ value = '"%s"' % value
+ print >>fd, "%s=%s" % (option, value)
print >>fd, "%s=%s" % (option, value)
return True
# }}}