Add some hard-coded textual literal-IP representations of localhost to
authorjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Mon, 5 Jan 2009 02:45:38 +0000 (02:45 +0000)
committerjacob <jacob@cda61777-01e9-0310-a592-d414129be87e>
Mon, 5 Jan 2009 02:45:38 +0000 (02:45 +0000)
sk_hostname_is_local(), to catch the case where we're doing something like X11
forwarding over SSH through a proxy, and we've thus disabled local lookup of
hostnames.
(I think this is what's behind the report in
<e9a86996-5dc2-4428-9b0c-c65693ca6351@m32g2000hsf.googlegroups.com>
in comp.security.ssh, although I'd like to know more of the circumstances.)

git-svn-id: svn://svn.tartarus.org/sgt/putty@8385 cda61777-01e9-0310-a592-d414129be87e

unix/uxnet.c
windows/winnet.c

index c0f2471..96d3aa5 100644 (file)
@@ -326,7 +326,9 @@ void sk_getaddr(SockAddr addr, char *buf, int buflen)
 
 int sk_hostname_is_local(char *name)
 {
-    return !strcmp(name, "localhost");
+    return !strcmp(name, "localhost") ||
+          !strcmp(name, "::1") ||
+          !strncmp(name, "127.", 4);
 }
 
 #define ipv4_is_loopback(addr) \
index 3848916..c549b08 100644 (file)
@@ -602,7 +602,9 @@ void sk_getaddr(SockAddr addr, char *buf, int buflen)
 
 int sk_hostname_is_local(char *name)
 {
-    return !strcmp(name, "localhost");
+    return !strcmp(name, "localhost") ||
+          !strcmp(name, "::1") ||
+          !strncmp(name, "127.", 4);
 }
 
 static INTERFACE_INFO local_interfaces[16];