getfqdn passes a hostname to gethostbyaddr instead of an ip address
On 12/09/18 16:29, Florian Bergmann wrote:
> On the other hand I feel given the documentation, passing the `ip_address` would
> be the right thing to do, so I am wondering if I am missing something very
> obvious here (especially given that the code seems to be unchanged for 18 years).
Whatever the docs say, turning the hostname into an IP address and
working with that would be incorrect.
Say we have a server, 'fred.weasley.example.com', which is also known as
'www.example.com'. Its reverse DNS pointer is
'fred.weasley.example.com'. Now, if we have 'example.com' on our DNS
search path, the FQDN of 'www' is 'www.example.com', while the FQDN
derived from the IP would be 'fred.weasley.example.com'.