mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-04 21:12:47 -05:00
Use the new host_str* functions to improve IPv6 literal support.
I've gone through everywhere we handle host names / addresses (on command lines, in PuTTY config, in port forwarding, in X display names, in host key storage...) and tried to make them handle IPv6 literals sensibly, by using the host_str* functions I introduced in my previous commit. Generally it's now OK to use a bracketed IPv6 literal anywhere a hostname might have been valid; in a few cases where no ambiguity exists (e.g. no :port suffix is permitted anyway) unbracketed IPv6 literals are also acceptable. [originally from svn r10120]
This commit is contained in:
@ -527,7 +527,13 @@ SockAddr sk_namelookup(const char *host, char **canonicalname,
|
||||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = hint_family;
|
||||
hints.ai_flags = AI_CANONNAME;
|
||||
if ((err = p_getaddrinfo(host, NULL, &hints, &ret->ais)) == 0)
|
||||
{
|
||||
/* strip [] on IPv6 address literals */
|
||||
char *trimmed_host = host_strduptrim(host);
|
||||
err = p_getaddrinfo(trimmed_host, NULL, &hints, &ret->ais);
|
||||
sfree(trimmed_host);
|
||||
}
|
||||
if (err == 0)
|
||||
ret->resolved = TRUE;
|
||||
} else
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user