1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-03-12 18:13:50 -05:00

Tone down canonical-name resolution when using getaddrinfo(). Previously

we were doing a forward+reverse lookup, which seems above and beyond the
call of duty, especially given that getaddrinfo() can be persuaded to
return a canonical name (this is what unix/uxnet.c does).

Unfortunately, I'm unable to test this at all as Win98 doesn't have
getaddrinfo(); hopefully I'll be able to find a mug with a modern version
of Windows to check it's not completely broken.

I think the effects of this are mostly cosmetic -- the canonical name is
used for window titles (and some people have been annoyed at the new
behaviour), other displays, and probably also for proxy exclusions.

[originally from svn r5614]
This commit is contained in:
Jacob Nevins 2005-04-07 22:33:42 +00:00
parent 741f654727
commit b33d9e4a44

View File

@ -368,6 +368,7 @@ SockAddr sk_namelookup(const char *host, char **canonicalname,
struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = ret->family;
hints.ai_flags = AI_CANONNAME;
if ((err = p_getaddrinfo(host, NULL, &hints, &ret->ais)) == 0)
ret_family = ret->ais->ai_family;
ret->ai = ret->ais;
@ -406,17 +407,10 @@ SockAddr sk_namelookup(const char *host, char **canonicalname,
(char *) &((SOCKADDR_IN *) ret->ai->
ai_addr)->sin_addr, sizeof(a));
/* Now let's find that canonicalname... */
if (p_getnameinfo) {
if (p_getnameinfo
((struct sockaddr *) ret->ai->ai_addr,
ret->family ==
AF_INET ? sizeof(SOCKADDR_IN) :
sizeof(SOCKADDR_IN6), realhost,
sizeof(realhost), NULL, 0, 0) != 0) {
strncpy(realhost, host, sizeof(realhost));
}
}
if (ret->ai->ai_canonname)
strncpy(realhost, ret->ai->ai_canonname, lenof(realhost));
else
strncpy(realhost, host, lenof(realhost));
}
/* We used the IPv4-only gethostbyname()... */
else