Don't resolve AAAA records if there is no dnspython nor IPv6 support
If system doesn't has IPv6 support or dnspython package, socket.getaddrinfo with AF_INET6 flag return weird IP info for requested host, making SleekXMPP crush with more weird error.
This commit is contained in:
parent
d439c4f215
commit
556e4bd74d
@ -202,6 +202,9 @@ def get_AAAA(host, resolver=None):
|
|||||||
# If not using dnspython, attempt lookup using the OS level
|
# If not using dnspython, attempt lookup using the OS level
|
||||||
# getaddrinfo() method.
|
# getaddrinfo() method.
|
||||||
if resolver is None:
|
if resolver is None:
|
||||||
|
if not socket.has_ipv6:
|
||||||
|
log.debug("Unable to query %s for AAAA records: IPv6 is not supported", host)
|
||||||
|
return []
|
||||||
try:
|
try:
|
||||||
recs = socket.getaddrinfo(host, None, socket.AF_INET6,
|
recs = socket.getaddrinfo(host, None, socket.AF_INET6,
|
||||||
socket.SOCK_STREAM)
|
socket.SOCK_STREAM)
|
||||||
|
Loading…
Reference in New Issue
Block a user