]> asedeno.scripts.mit.edu Git - PuTTY.git/commitdiff
Add some hard-coded textual literal-IP representations of localhost to
authorJacob Nevins <jacobn@chiark.greenend.org.uk>
Mon, 5 Jan 2009 02:45:38 +0000 (02:45 +0000)
committerJacob Nevins <jacobn@chiark.greenend.org.uk>
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.)

[originally from svn r8385]

unix/uxnet.c
windows/winnet.c

index c0f247195049194c07225378b7e5684db47ab760..96d3aa51672259aaaea82df7fcaeace366ef3e82 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 38489163db46bac01bdfc9bcacd7ad0b005e0f81..c549b087d1c3ec571e23c5c41b49ba4e660b6ba7 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];