mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-06-30 19:12:48 -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:
@ -548,8 +548,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
q += 2;
|
||||
conf_set_int(conf, CONF_protocol, PROT_TELNET);
|
||||
p = q;
|
||||
while (*p && *p != ':' && *p != '/')
|
||||
p++;
|
||||
p += host_strcspn(p, ":/");
|
||||
c = *p;
|
||||
if (*p)
|
||||
*p++ = '\0';
|
||||
@ -614,15 +613,15 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
|
||||
/*
|
||||
* Trim a colon suffix off the hostname if it's there. In
|
||||
* order to protect IPv6 address literals against this
|
||||
* treatment, we do not do this if there's _more_ than one
|
||||
* colon.
|
||||
* order to protect unbracketed IPv6 address literals
|
||||
* against this treatment, we do not do this if there's
|
||||
* _more_ than one colon.
|
||||
*/
|
||||
{
|
||||
char *c = strchr(host, ':');
|
||||
char *c = host_strchr(host, ':');
|
||||
|
||||
if (c) {
|
||||
char *d = strchr(c+1, ':');
|
||||
char *d = host_strchr(c+1, ':');
|
||||
if (!d)
|
||||
*c = '\0';
|
||||
}
|
||||
|
Reference in New Issue
Block a user