aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@mandriva.org>2010-02-22 17:35:49 +0000
committerEugeni Dodonov <eugeni@mandriva.org>2010-02-22 17:35:49 +0000
commitb8c70aeed2952e8c24414b278b0290e191371a72 (patch)
treedb146c2361319737260d03f8bcd1a914e2190694 /src
parentf71a538aad7c34bfacbf14df6ef035ab3b9f638e (diff)
downloadmsec-b8c70aeed2952e8c24414b278b0290e191371a72.tar
msec-b8c70aeed2952e8c24414b278b0290e191371a72.tar.gz
msec-b8c70aeed2952e8c24414b278b0290e191371a72.tar.bz2
msec-b8c70aeed2952e8c24414b278b0290e191371a72.tar.xz
msec-b8c70aeed2952e8c24414b278b0290e191371a72.zip
properly escape special characters
Diffstat (limited to 'src')
-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
# }}}