Skip to content

Commit

Permalink
firewall.core.io.ifcfg: Properly handle quoted ifcfg values
Browse files Browse the repository at this point in the history
This is related to RHBZ#1395348
  • Loading branch information
t-woerner committed Nov 30, 2016
1 parent 17a9f40 commit 917d217
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/firewall/core/io/ifcfg.py
Expand Up @@ -81,7 +81,10 @@ def read(self):
pair = [ x.strip() for x in line.split("=", 1) ]
if len(pair) != 2:
continue
elif pair[1] == '':
if len(pair[1]) >= 2 and \
pair[1].startswith('"') and pair[1].endswith('"'):
pair[1] = pair[1][1:-1]
if pair[1] == '':
continue
elif self._config.get(pair[0]) is not None:
log.warning("%s: Duplicate option definition: '%s'", self.filename, line.strip())
Expand Down Expand Up @@ -142,6 +145,9 @@ def write(self):
continue
key = p[0].strip()
value = p[1].strip()
if len(value) >= 2 and \
value.startswith('"') and value.endswith('"'):
value = value[1:-1]
# check for modified key/value pairs
if key not in done:
if key in self._config and self._config[key] != value:
Expand Down

0 comments on commit 917d217

Please sign in to comment.