Subject: | Net::Domain::hostfqdn() should use /etc/nsswitch.conf and /etc/hosts to determine fqdn |
Date: | Tue, 28 Jun 2016 20:02:13 +0000 |
To: | "bug-libnet [...] rt.cpan.org" <bug-libnet [...] rt.cpan.org> |
From: | Jimmy DALLMAN <jrdallman [...] wisc.edu> |
Hello,
Net::Domain::hostfqdn() does not currently consider the rules given in /etc/nsswitch.conf when determining the domain, opting instead to start checking files like /etc/resolv.conf. In order to properly emulate getaddrinfo(), I would suggest using nsswitch.conf to determine the methods in which to search for the fqdn.
In addition, I believe /etc/hosts should be high in the list of files to consult, possibly first, to determine the fqdn. The domainname subroutine should check that $hostname is defined, then read /etc/hosts looking for the line where the third column matches the hostname, and assign $fqdn to the second column's value. $domain can then be set by removing $hostname from the beginning of $fqdn.
Thanks,
Jimmy