]> asedeno.scripts.mit.edu Git - PuTTY_svn.git/blobdiff - windows/winnet.c
Use the new host_str* functions to improve IPv6 literal support.
[PuTTY_svn.git] / windows / winnet.c
index f4507240ff5497248117a929b90936c6d65596f7..1a5a76f1d1c5dade5e4bab351661ecab8f94f36d 100644 (file)
@@ -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