mirror of https://github.com/fail2ban/fail2ban
ENH: DNS resolution -- catch parent exception
IMHO there is no good reason to capture only gaierror. on my network it was consistent to error out with ====================================================================== ERROR: testIgnoreIPNOK (testcases.filtertestcase.IgnoreIP) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/yoh/deb/gits/fail2ban/testcases/filtertestcase.py", line 166, in testIgnoreIPNOK self.assertFalse(self.filter.inIgnoreIPList(ip)) File "/home/yoh/deb/gits/fail2ban/server/filter.py", line 277, in inIgnoreIPList ips = DNSUtils.dnsToIp(i) File "/home/yoh/deb/gits/fail2ban/server/filter.py", line 625, in dnsToIp return socket.gethostbyname_ex(dns)[2] error: [Errno 11] Resource temporarily unavailable with this commit tests would pass normally as they shouldpull/280/head
parent
5d7ab9e7fb
commit
5df6796e69
|
@ -623,9 +623,9 @@ class DNSUtils:
|
|||
"""
|
||||
try:
|
||||
return socket.gethostbyname_ex(dns)[2]
|
||||
except socket.gaierror:
|
||||
logSys.warn("Unable to find a corresponding IP address for %s"
|
||||
% dns)
|
||||
except socket.error, e:
|
||||
logSys.warn("Unable to find a corresponding IP address for %s: %s"
|
||||
% (dns, e))
|
||||
return list()
|
||||
dnsToIp = staticmethod(dnsToIp)
|
||||
|
||||
|
|
Loading…
Reference in New Issue