diff options
author | Yaroslav Halchenko <debian@onerussian.com> | 2016-05-21 10:55:27 -0400 |
---|---|---|
committer | Yaroslav Halchenko <debian@onerussian.com> | 2016-05-21 10:55:27 -0400 |
commit | 01d0506ea07af3ad0208743e7d80646349c08d59 (patch) | |
tree | 186fd2c203b491b0d38fb51a1d4ace14500e0dec /fail2ban/helpers.py | |
parent | b56f4c533efcae6e078cae27aa84e007123529c3 (diff) | |
download | fail2ban-01d0506ea07af3ad0208743e7d80646349c08d59.tar.gz |
ENH: splitcommaspace -> splitwords allow to split ignoreip entries with new lines
Closes #1432
Diffstat (limited to 'fail2ban/helpers.py')
-rw-r--r-- | fail2ban/helpers.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fail2ban/helpers.py b/fail2ban/helpers.py index 8e1b0e32..fc51a88e 100644 --- a/fail2ban/helpers.py +++ b/fail2ban/helpers.py @@ -128,12 +128,12 @@ def excepthook(exctype, value, traceback): "Unhandled exception in Fail2Ban:", exc_info=True) return sys.__excepthook__(exctype, value, traceback) -def splitcommaspace(s): - """Helper to split on any comma or space +def splitwords(s): + """Helper to split words on any comma, space, or a new line Returns empty list if input is empty (or None) and filters out empty entries """ if not s: return [] - return filter(bool, re.split('[ ,]', s)) + return filter(bool, map(str.strip, re.split('[ ,\n]', s))) |