(hookup): handle ai_canonname being set in any of the addresses
returnedby getaddrinfo. glibc apparently returns the reverse lookup of every address in ai_canonname. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7756 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -76,10 +76,7 @@ hookup (const char *host, int port)
|
||||
code = -1;
|
||||
return NULL;
|
||||
}
|
||||
if (ai->ai_canonname != NULL)
|
||||
strlcpy (hostnamebuf, ai->ai_canonname, sizeof(hostnamebuf));
|
||||
else
|
||||
strlcpy (hostnamebuf, host, sizeof(hostnamebuf));
|
||||
strlcpy (hostnamebuf, host, sizeof(hostnamebuf));
|
||||
hostname = hostnamebuf;
|
||||
|
||||
for (a = ai; a != NULL; a = a->ai_next) {
|
||||
@@ -87,6 +84,9 @@ hookup (const char *host, int port)
|
||||
if (s < 0)
|
||||
continue;
|
||||
|
||||
if (a->ai_canonname != NULL)
|
||||
strlcpy (hostnamebuf, a->ai_canonname, sizeof(hostnamebuf));
|
||||
|
||||
memcpy (hisctladdr, a->ai_addr, a->ai_addrlen);
|
||||
|
||||
error = connect (s, a->ai_addr, a->ai_addrlen);
|
||||
|
Reference in New Issue
Block a user