If you configure Unix PuTTY to use a proxy, tell it to even proxy
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 16 Oct 2012 20:15:51 +0000 (20:15 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Tue, 16 Oct 2012 20:15:51 +0000 (20:15 +0000)
localhost connections, and also enable X forwarding in such a way that
it will attempt to connect to a Unix-domain X server socket, an
assertion will fail when proxy_for_destination() tries to call
sk_getaddr(). Fix by ensuring that Unix-domain sockets are _never_
proxied, since they fundamentally can't be.

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

network.h
proxy.c
unix/uxnet.c
windows/winnet.c

index 45f4e2a..49ebd39 100644 (file)
--- a/network.h
+++ b/network.h
@@ -118,6 +118,7 @@ SockAddr sk_nonamelookup(const char *host);
 void sk_getaddr(SockAddr addr, char *buf, int buflen);
 int sk_hostname_is_local(char *name);
 int sk_address_is_local(SockAddr addr);
+int sk_address_is_special_local(SockAddr addr);
 int sk_addrtype(SockAddr addr);
 void sk_addrcopy(SockAddr addr, char *buf);
 void sk_addr_free(SockAddr addr);
diff --git a/proxy.c b/proxy.c
index 051beb7..3c81884 100644 (file)
--- a/proxy.c
+++ b/proxy.c
@@ -286,6 +286,15 @@ static int proxy_for_destination (SockAddr addr, char *hostname, int port,
     const char *exclude_list;
 
     /*
+     * Special local connections such as Unix-domain sockets
+     * unconditionally cannot be proxied, even in proxy-localhost
+     * mode. There just isn't any way to ask any known proxy type for
+     * them.
+     */
+    if (addr && sk_address_is_special_local(addr))
+        return 0;                      /* do not proxy */
+
+    /*
      * Check the host name and IP against the hard-coded
      * representations of `localhost'.
      */
index e2302aa..fef4c43 100644 (file)
@@ -390,6 +390,11 @@ int sk_address_is_local(SockAddr addr)
     }
 }
 
+int sk_address_is_special_local(SockAddr addr)
+{
+    return addr->superfamily == UNIX;
+}
+
 int sk_addrtype(SockAddr addr)
 {
     SockAddrStep step;
index 84b239c..2088f9d 100644 (file)
@@ -667,6 +667,11 @@ int sk_address_is_local(SockAddr addr)
     }
 }
 
+int sk_address_is_special_local(SockAddr addr)
+{
+    return 0;                /* no Unix-domain socket analogue here */
+}
+
 int sk_addrtype(SockAddr addr)
 {
     SockAddrStep step;