getaddrinfo canonicalization (Re: host name resolution ...)

Donn Cave donn at
Mon Mar 17 14:24:07 EST 2003

Quoth Donn Cave <donn at>:
| On Fri, 14 Mar 2003, Sam Hartman wrote:
|> I would certainly consider looking at patches to applications that did
|> a gethostbyname() or getaddrinfo() on the user-supplied name and took
|> both the hostname and address from that reply.  The hostname should be
|> passed to GSSAPI and the address used for the connect.
| gethostbyname() won't help, as in this case we're talking about a
| real "A" name, just not a canonical one, so you get the same host
| name out of gethostbyname() that you put in.  But you can get a
| canonical name out of getaddrinfo if you ask for it, at least if
| the platform has a working getaddrinfo().

I take that back - it's true on one platform I have at hand, but
not on the other two that support getaddrinfo at all.

  Linux (GNU C library)
        host A -> hostNN
        = gethostbyaddr(gethostbyname)
  NetBSD 1.6
        host A -> host, host CNAME -> hostNN
        = gethostbyname()->h_name
  AIX 4.3.3
        host A -> "", host CNAME -> hostNN
        = broken on purpose (what else)

I mention this mainly because I see this value is used in sn2princ.c
and elsewhere, so its unfortunate diversity of meanings has some
potential to cause problems.

	Donn Cave, University Computing Services, University of Washington
	donn at

More information about the krbdev mailing list