diff --git a/fail2ban/client/configparserinc.py b/fail2ban/client/configparserinc.py index b626be9b..d220ed44 100644 --- a/fail2ban/client/configparserinc.py +++ b/fail2ban/client/configparserinc.py @@ -20,8 +20,8 @@ # Author: Yaroslav Halchenko # Modified: Cyril Jaquier -__author__ = 'Yaroslav Halhenko' -__copyright__ = 'Copyright (c) 2007 Yaroslav Halchenko' +__author__ = 'Yaroslav Halhenko, Serg G. Brester (aka sebres)' +__copyright__ = 'Copyright (c) 2007 Yaroslav Halchenko, 2015 Serg G. Brester (aka sebres)' __license__ = 'GPL' import os @@ -150,7 +150,7 @@ after = 1.conf if seclwr == 'known': # try get raw value from known options: try: - v = self._sections['KNOWN'][opt] + v = self._sections['KNOWN/'+section][opt] except KeyError: # fallback to default: try: @@ -297,7 +297,6 @@ after = 1.conf # merge defaults and all sections to self: alld.update(cfg.get_defaults()) for n, s in cfg.get_sections().iteritems(): - curalls = alls # conditional sections cond = SafeConfigParserWithIncludes.CONDITIONAL_RE.match(n) if cond: @@ -313,7 +312,7 @@ after = 1.conf s2 = alls.get(n) if isinstance(s2, dict): # save previous known values, for possible using in local interpolations later: - self.merge_section('KNOWN', s2, '') + self.merge_section('KNOWN/'+n, s2, '') # merge section s2.update(s) else: diff --git a/fail2ban/client/configreader.py b/fail2ban/client/configreader.py index 381af759..577a5a16 100644 --- a/fail2ban/client/configreader.py +++ b/fail2ban/client/configreader.py @@ -20,8 +20,8 @@ # Author: Cyril Jaquier # Modified by: Yaroslav Halchenko (SafeConfigParserWithIncludes) -__author__ = "Cyril Jaquier" -__copyright__ = "Copyright (c) 2004 Cyril Jaquier" +__author__ = "Cyril Jaquier, Yaroslav Halchenko, Serg G. Brester (aka sebres)" +__copyright__ = "Copyright (c) 2004 Cyril Jaquier, 2007 Yaroslav Halchenko, 2015 Serg G. Brester (aka sebres)" __license__ = "GPL" import glob @@ -110,7 +110,7 @@ class ConfigReader(): def sections(self): try: - return (n for n in self._cfg.sections() if n != 'KNOWN') + return (n for n in self._cfg.sections() if not n.startswith('KNOWN/')) except AttributeError: return []