- Expand <HOST> in ignoreregex. Thanks to Yaroslav Halchenko

git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@591 a942ae1a-1317-0410-a47c-b1dcaea8d605
0.x
Cyril Jaquier 2007-06-25 21:52:58 +00:00
parent 475aa68c11
commit bde90df32c
3 changed files with 5 additions and 3 deletions

View File

@ -12,6 +12,7 @@ ver. 0.9.0 (2007/??/??) - alpha
- Removed Python 2.4 code. Need more testing - Removed Python 2.4 code. Need more testing
- Made interactive mode optional in fail2ban-client - Made interactive mode optional in fail2ban-client
- Fixed vulnerability in sshd.conf. Thanks to Daniel B. Cid - Fixed vulnerability in sshd.conf. Thanks to Daniel B. Cid
- Expand <HOST> in ignoreregex. Thanks to Yaroslav Halchenko
ver. 0.8.0 (2007/05/03) - stable ver. 0.8.0 (2007/05/03) - stable
---------- ----------

View File

@ -40,9 +40,7 @@ class FailRegex(Regex):
# avoid construction of invalid object. # avoid construction of invalid object.
# @param value the regular expression # @param value the regular expression
def __init__(self, value): def __init__(self, regex):
# Replace "<HOST>" with default regular expression for host.
regex = value.replace("<HOST>", "(?:::f{4,6}:)?(?P<host>\S+)")
# Initializes the parent. # Initializes the parent.
Regex.__init__(self, regex) Regex.__init__(self, regex)
# Check for group "host" # Check for group "host"

View File

@ -42,6 +42,9 @@ class Regex:
def __init__(self, regex): def __init__(self, regex):
self._matchCache = None self._matchCache = None
# Perform shortcuts expansions
# Replace "<HOST>" with default regular expression for host.
regex = regex.replace("<HOST>", "(?:::f{4,6}:)?(?P<host>\S+)")
if regex.lstrip() == '': if regex.lstrip() == '':
raise RegexException("Cannot add empty regex") raise RegexException("Cannot add empty regex")
try: try: