diff options
author | sebres <serg.brester@sebres.de> | 2017-03-13 18:47:26 +0100 |
---|---|---|
committer | sebres <serg.brester@sebres.de> | 2017-03-13 18:47:26 +0100 |
commit | c1da6611ecfdc4cf86597f614b7b5f0d780b4ab1 (patch) | |
tree | 5512e3adbff828c6cc98a42056bbc31b5f6d35e0 /fail2ban/helpers.py | |
parent | 92d83274d9af6081796568de928285e8321171e3 (diff) | |
download | fail2ban-c1da6611ecfdc4cf86597f614b7b5f0d780b4ab1.tar.gz |
[BF] prevents always converting of calling map items in replaceTag (without direct access of item):
substituteRecursiveTags: ignore replacing callable items from calling map - should be converted on demand only (by get)
Diffstat (limited to 'fail2ban/helpers.py')
-rw-r--r-- | fail2ban/helpers.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fail2ban/helpers.py b/fail2ban/helpers.py index 2407df1f..726631a6 100644 --- a/fail2ban/helpers.py +++ b/fail2ban/helpers.py @@ -240,6 +240,7 @@ def substituteRecursiveTags(inptags, conditional='', # init: ignore = set(ignore) done = set() + calmap = hasattr(tags, "getRawItem") # repeat substitution while embedded-recursive (repFlag is True) while True: repFlag = False @@ -247,6 +248,8 @@ def substituteRecursiveTags(inptags, conditional='', for tag in tags.iterkeys(): # ignore escaped or already done (or in ignore list): if tag in ignore or tag in done: continue + # ignore replacing callable items from calling map - should be converted on demand only (by get): + if calmap and callable(tags.getRawItem(tag)): continue value = orgval = str(tags[tag]) # search and replace all tags within value, that can be interpolated using other tags: m = tre_search(value) |