mirror of https://github.com/fail2ban/fail2ban
Merge branch 'py-3.6-compat' into 0.10-full
commit
fa20b0aff2
|
@ -284,7 +284,7 @@ class DateDetector(object):
|
||||||
if preMatch is not None:
|
if preMatch is not None:
|
||||||
# get cached or create a copy with modified name/pattern, using preMatch replacement for {DATE}:
|
# get cached or create a copy with modified name/pattern, using preMatch replacement for {DATE}:
|
||||||
template = _getAnchoredTemplate(template,
|
template = _getAnchoredTemplate(template,
|
||||||
wrap=lambda s: RE_DATE_PREMATCH.sub(s, preMatch))
|
wrap=lambda s: RE_DATE_PREMATCH.sub(lambda m: s, preMatch))
|
||||||
# append date detector template (ignore duplicate if some was added before default):
|
# append date detector template (ignore duplicate if some was added before default):
|
||||||
self._appendTemplate(template, ignoreDup=ignoreDup)
|
self._appendTemplate(template, ignoreDup=ignoreDup)
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ else:
|
||||||
|
|
||||||
from ..dummyjail import DummyJail
|
from ..dummyjail import DummyJail
|
||||||
|
|
||||||
from ..utils import CONFIG_DIR, asyncserver, Utils
|
from ..utils import CONFIG_DIR, asyncserver, Utils, uni_decode
|
||||||
|
|
||||||
class TestSMTPServer(smtpd.SMTPServer):
|
class TestSMTPServer(smtpd.SMTPServer):
|
||||||
|
|
||||||
|
@ -38,13 +38,13 @@ class TestSMTPServer(smtpd.SMTPServer):
|
||||||
smtpd.SMTPServer.__init__(self, *args)
|
smtpd.SMTPServer.__init__(self, *args)
|
||||||
self.ready = False
|
self.ready = False
|
||||||
|
|
||||||
def process_message(self, peer, mailfrom, rcpttos, data):
|
def process_message(self, peer, mailfrom, rcpttos, data, **kwargs):
|
||||||
self.peer = peer
|
self.peer = peer
|
||||||
self.mailfrom = mailfrom
|
self.mailfrom = mailfrom
|
||||||
self.rcpttos = rcpttos
|
self.rcpttos = rcpttos
|
||||||
self.org_data = data
|
self.org_data = data
|
||||||
# replace new line (with tab or space) for possible mime translations (word wrap):
|
# replace new line (with tab or space) for possible mime translations (word wrap),
|
||||||
self.data = re.sub(r"\n[\t ]", " ", data)
|
self.data = re.sub(r"\n[\t ]", " ", uni_decode(data))
|
||||||
self.ready = True
|
self.ready = True
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1656,7 +1656,7 @@ class ServerConfigReaderTests(LogCaptureTestCase):
|
||||||
r' echo mail \1 ) | cat', realCmd)
|
r' echo mail \1 ) | cat', realCmd)
|
||||||
# replace abuse retrieving (possible no-network):
|
# replace abuse retrieving (possible no-network):
|
||||||
realCmd = re.sub(r'[^\n]+\bADDRESSES=\$\(dig\s[^\n]+',
|
realCmd = re.sub(r'[^\n]+\bADDRESSES=\$\(dig\s[^\n]+',
|
||||||
'ADDRESSES="abuse-1@abuse-test-server, abuse-2@abuse-test-server"', realCmd)
|
lambda m: 'ADDRESSES="abuse-1@abuse-test-server, abuse-2@abuse-test-server"', realCmd)
|
||||||
# execute action:
|
# execute action:
|
||||||
return _actions.CommandAction.executeCmd(realCmd, timeout=timeout)
|
return _actions.CommandAction.executeCmd(realCmd, timeout=timeout)
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ import unittest
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
|
|
||||||
from ..helpers import getLogger, str2LogLevel, getVerbosityFormat
|
from ..helpers import getLogger, str2LogLevel, getVerbosityFormat, uni_decode
|
||||||
from ..server.ipdns import DNSUtils
|
from ..server.ipdns import DNSUtils
|
||||||
from ..server.mytime import MyTime
|
from ..server.mytime import MyTime
|
||||||
from ..server.utils import Utils
|
from ..server.utils import Utils
|
||||||
|
|
Loading…
Reference in New Issue