[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: getaddrinfo() and AI_CANONNAME



On Wed, Oct 18, 2000 at 03:09:59AM +0900, Jun-ichiro itojun Hagino wrote:

> 	your patch calls getnameinfo from inside getaddrinfo, and you are
> 	making reverse lookup from getnameinfo.

??????

My patch calls getnameinfo from krb5_expand_hostname() and
krb5_expand_hostname_realms(), but NOT from getaddrinfo(). I could not do
it anyways, because I use the OS-supplied getaddrinfo().

> 	if AIX getaddrinfo does not return something different from
> 	h->h_name into ai_canonname, that is broken.

gethostbyname() returns h_name == FQDN, h_aliases == (unqualified host name).

> 	if you are using DNS, DNS resolver knows where it got the mapping.

I think it wouldn't be a very good idea to depend on external services like
DNS to resolve the local hostname...

> 	if you are using /etc/hosts, the first hostname on the list is
> 	considered as the canonical name.

The first hostname is a FQDN. Still, getaddrinfo() returns the unqualified
host name only. And it does so for every host defined in /etc/hosts.

Gabor

-- 
Gabor Gombas                                       Eotvos Lorand University
E-mail: gombasg@inf.elte.hu                        Hungary