summaryrefslogtreecommitdiff
path: root/fail2ban/helpers.py
diff options
context:
space:
mode:
authorYaroslav Halchenko <debian@onerussian.com>2016-05-21 10:55:27 -0400
committerYaroslav Halchenko <debian@onerussian.com>2016-05-21 10:55:27 -0400
commit01d0506ea07af3ad0208743e7d80646349c08d59 (patch)
tree186fd2c203b491b0d38fb51a1d4ace14500e0dec /fail2ban/helpers.py
parentb56f4c533efcae6e078cae27aa84e007123529c3 (diff)
downloadfail2ban-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.py6
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)))