Remove problematic optimization from gethostfqdn()

Reviewed-By: Fraser Tweedale <ftweedal@redhat.com>
This commit is contained in:
Christian Heimes 2020-09-17 12:48:37 +02:00 committed by Fraser Tweedale
parent 5d4ed65b83
commit b66b961fdd

View File

@ -7,12 +7,11 @@ import socket
def gethostfqdn():
"""Get the fully qualified domain name of current host from glibc
:return: FQDN as str
"""
hostname = socket.gethostname()
# optional optimization, consider hostname with dot as FQDN
if "." in hostname:
return hostname
# this call can never fail except for misconfigured nsswitch.conf
# without nss-myhostname provider. The myhostname provider translates
# gethostname() to local interfaces.