mirror of https://github.com/fail2ban/fail2ban
BF: fail2ban-regex adding duplicate lines with each regex
This is another fix on top of e73b3dd
to correctly resolve this issue
pull/272/head
parent
123ec3da13
commit
f87c53fa52
|
@ -250,6 +250,7 @@ class Fail2banRegex(object):
|
|||
found = False
|
||||
for regex in self._ignoreregex:
|
||||
self._filter.addIgnoreRegex(regex.getFailRegex())
|
||||
orgLineBuffer = self._filter._Filter__lineBuffer
|
||||
for regex in self._failregex:
|
||||
try:
|
||||
self._filter.addFailRegex(regex.getFailRegex())
|
||||
|
@ -271,11 +272,9 @@ class Fail2banRegex(object):
|
|||
return False
|
||||
finally:
|
||||
self._filter.delFailRegex(0)
|
||||
try:
|
||||
del self._filter._Filter__lineBuffer[-1]
|
||||
except IndexError:
|
||||
pass
|
||||
self._filter.processLine(line)
|
||||
self._filter._Filter__lineBuffer = orgLineBuffer
|
||||
if not found:
|
||||
self._filter.processLine(line)
|
||||
for regex in self._ignoreregex:
|
||||
self._filter.delIgnoreRegex(0)
|
||||
return found
|
||||
|
|
Loading…
Reference in New Issue