From db74a69d9e792e349fad5bd69643a3fc32829bf7 Mon Sep 17 00:00:00 2001 From: jacob Date: Mon, 5 Jan 2009 02:45:38 +0000 Subject: [PATCH] Add some hard-coded textual literal-IP representations of localhost to 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 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 | 4 +++- windows/winnet.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/unix/uxnet.c b/unix/uxnet.c index c0f24719..96d3aa51 100644 --- a/unix/uxnet.c +++ b/unix/uxnet.c @@ -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) \ diff --git a/windows/winnet.c b/windows/winnet.c index 38489163..c549b087 100644 --- a/windows/winnet.c +++ b/windows/winnet.c @@ -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]; -- 2.11.0