]> git.ipfire.org Git - thirdparty/dnspython.git/commitdiff
Fix incompatibility in getfqdn() revealed by dnspython web site change.
authorBob Halley <halley@dnspython.org>
Tue, 7 Jul 2020 02:42:51 +0000 (19:42 -0700)
committerBob Halley <halley@dnspython.org>
Tue, 7 Jul 2020 02:42:51 +0000 (19:42 -0700)
dns/resolver.py

index 62d019851ec9a50941df85a9e6c915e8b47b0ef7..ab408727588db6897132a67326419ac0bd843aa6 100644 (file)
@@ -1445,9 +1445,12 @@ def _getfqdn(name=None):
     if name is None:
         name = socket.gethostname()
     try:
-        return _getnameinfo(_getaddrinfo(name, 80)[0][4])[0]
+        (name, _, _) = _gethostbyaddr(name)
+        # Python's version checks aliases too, but our gethostbyname
+        # ignores them, so we do so here as well.
     except Exception:
-        return name
+        pass
+    return name
 
 
 def _gethostbyname(name):