Bugfix for dnsToIp resolver for fqdn with large list of IPs;

closes #1164
pull/1184/head
sebres 2015-09-08 11:14:46 +02:00
parent 818be64ae1
commit 4cf3b576b9
2 changed files with 3 additions and 1 deletions

View File

@ -11,6 +11,7 @@ ver. 0.9.4 (2015/XX/XXX) - wanna-be-released
- Fixes:
* roundcube-auth jail typo for logpath
* Fix dnsToIp resolver for fqdn with large list of IPs (gh-1164)
- New Features:

View File

@ -855,8 +855,9 @@ class DNSUtils:
""" Convert a DNS into an IP address using the Python socket module.
Thanks to Kevin Drapel.
"""
# retrieve ip (todo: use AF_INET6 for IPv6)
try:
return set(socket.gethostbyname_ex(dns)[2])
return set([i[4][0] for i in socket.getaddrinfo(dns, None, socket.AF_INET, 0, socket.IPPROTO_TCP)])
except socket.error, e:
logSys.warning("Unable to find a corresponding IP address for %s: %s"
% (dns, e))