]> asedeno.scripts.mit.edu Git - PuTTY_svn.git/commitdiff
If you configure Unix PuTTY to use a proxy, tell it to even proxy
authorSimon Tatham <anakin@pobox.com>
Tue, 16 Oct 2012 20:15:51 +0000 (20:15 +0000)
committerSimon Tatham <anakin@pobox.com>
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: http://svn.tartarus.org/sgt/putty@9688 cda61777-01e9-0310-a592-d414129be87e

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

index 45f4e2a7ff302574bc02287685c68f82c0735c73..49ebd39c1d3818907b6b5f38c6ed95de3a59361b 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 051beb7e9eaabb83a0b38f0704ff99dbd0ec8bdd..3c81884ded95d97aca4a0173c76816642df05116 100644 (file)
--- a/proxy.c
+++ b/proxy.c
@@ -285,6 +285,15 @@ static int proxy_for_destination (SockAddr addr, char *hostname, int port,
     int hostip_len, hostname_len;
     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 e2302aa46e2b7a35a3b35a67a0d4aa1ca7032491..fef4c43c132d50c4a28e5273c00c8d3d7a236577 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 84b239c0683de534e88da2234a2ab58c5136ba0b..2088f9d71032828614a20929a59a639d8f445ef4 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;