Ver Fonte

Merge branch 'thirdparty'

# Conflicts:

#	source/putty/proxy/proxy.c
#	source/putty/windows/network.c

Source commit: f6c4f9badfec50adaf6ea0861446b536685ee49e
Martin Prikryl há 3 anos atrás
pai
commit
2d148fc649

+ 2 - 0
source/putty/defs.h

@@ -129,6 +129,8 @@ typedef struct Seat Seat;
 typedef struct SeatVtable SeatVtable;
 typedef struct SeatPromptResult SeatPromptResult;
 
+typedef struct cmdline_get_passwd_input_state cmdline_get_passwd_input_state;
+
 typedef struct TermWin TermWin;
 typedef struct TermWinVtable TermWinVtable;
 

+ 7 - 0
source/putty/proxy/proxy.c

@@ -238,6 +238,13 @@ static void proxy_negotiate(ProxySocket *ps)
                                 #endif
                                 );
         ps->pn->reconnect = false;
+        /* If the negotiator has asked us to reconnect, they are
+         * expecting that on the next call their input queue will
+         * consist entirely of data from the _new_ connection, without
+         * any remaining data buffered from the old one. (If they'd
+         * wanted the latter, they could have read it out of the input
+         * queue before asking us to close the connection.) */
+        bufchain_clear(&ps->pending_input_data);
         } // WINSCP
     }
 

+ 7 - 1
source/putty/putty.h

@@ -2144,6 +2144,7 @@ void term_pwron(Terminal *, bool);
 void term_clrsb(Terminal *);
 void term_mouse(Terminal *, Mouse_Button, Mouse_Button, Mouse_Action,
                 int, int, bool, bool, bool);
+void term_cancel_selection_drag(Terminal *);
 void term_key(Terminal *, Key_Sym, wchar_t *, size_t, unsigned int,
               unsigned int);
 void term_lost_clipboard_ownership(Terminal *, int clipboard);
@@ -2531,10 +2532,15 @@ void printer_finish_job(printer_job *);
  * zero out password arguments in the hope of not having them show up
  * avoidably in Unix 'ps'.
  */
+struct cmdline_get_passwd_input_state { bool tried; };
+#define CMDLINE_GET_PASSWD_INPUT_STATE_INIT { .tried = false }
+extern const cmdline_get_passwd_input_state cmdline_get_passwd_input_state_new;
+
 int cmdline_process_param(const char *, char *, int, Conf *);
 void cmdline_run_saved(Conf *);
 void cmdline_cleanup(void);
-SeatPromptResult cmdline_get_passwd_input(prompts_t *p);
+SeatPromptResult cmdline_get_passwd_input(
+    prompts_t *p, cmdline_get_passwd_input_state *state, bool restartable);
 bool cmdline_host_ok(Conf *);
 bool cmdline_verbose(void);
 bool cmdline_loaded_session(void);

+ 13 - 5
source/putty/settings.c

@@ -1309,6 +1309,8 @@ static int sessioncmp(const void *av, const void *bv)
     return strcmp(a, b);               /* otherwise, compare normally */
 }
 
+bool sesslist_demo_mode = false;
+
 void get_sesslist(struct sesslist *list, bool allocate)
 {
     int i;
@@ -1318,12 +1320,18 @@ void get_sesslist(struct sesslist *list, bool allocate)
     if (allocate) {
         strbuf *sb = strbuf_new();
 
-        if ((handle = enum_settings_start()) != NULL) {
-            while (enum_settings_next(handle, sb))
-                put_byte(sb, '\0');
-            enum_settings_finish(handle);
+        if (sesslist_demo_mode) {
+            put_asciz(sb, "demo-server");
+            put_asciz(sb, "demo-server-2");
+        } else {
+            if ((handle = enum_settings_start()) != NULL) {
+                while (enum_settings_next(handle, sb))
+                    put_byte(sb, '\0');
+                enum_settings_finish(handle);
+            }
+            put_byte(sb, '\0');
         }
-        put_byte(sb, '\0');
+
         list->buffer = strbuf_to_str(sb);
 
         /*

+ 3 - 0
source/putty/ssh/connection2.c

@@ -185,6 +185,7 @@ void ssh2_queue_global_request_handler(
         snew(struct outstanding_global_request);
     ogr->handler = handler;
     ogr->ctx = ctx;
+    ogr->next = NULL;
     if (s->globreq_tail)
         s->globreq_tail->next = ogr;
     else
@@ -387,6 +388,8 @@ static bool ssh2_connection_filter_queue(struct ssh2_connection_state *s)
                 s->globreq_head = s->globreq_head->next;
                 sfree(tmp);
             }
+            if (!s->globreq_head)
+                s->globreq_tail = NULL;
 
             pq_pop(s->ppl.in_pq);
             break;

+ 4 - 4
source/putty/ssh/mainchan.c

@@ -303,8 +303,8 @@ static void mainchan_request_response(Channel *chan, bool success)
              * If there's no remote_cmd2 configured, then we have no
              * fallback command, so we've run out of options.
              */
-            ssh_sw_abort(mc->ppl->ssh,
-                         "Server refused to start a shell/command");
+            ssh_sw_abort_deferred(mc->ppl->ssh,
+                                  "Server refused to start a shell/command");
         }
         return;
     }
@@ -317,8 +317,8 @@ static void mainchan_request_response(Channel *chan, bool success)
             ssh_got_fallback_cmd(mc->ppl->ssh);
             mainchan_ready(mc);
         } else {
-            ssh_sw_abort(mc->ppl->ssh,
-                         "Server refused to start a shell/command");
+            ssh_sw_abort_deferred(mc->ppl->ssh,
+                                  "Server refused to start a shell/command");
         }
         return;
     }

+ 2 - 1
source/putty/utils/stripctrl.c

@@ -314,7 +314,7 @@ static void stripctrl_locale_BinarySink_write(
         container_of(sccpub, StripCtrlCharsImpl, public);
     const char *p = (const char *)vp;
 
-    const char *previous_locale = setlocale(LC_CTYPE, NULL);
+    char *previous_locale = dupstr(setlocale(LC_CTYPE, NULL));
     setlocale(LC_CTYPE, "");
 
     /*
@@ -402,6 +402,7 @@ static void stripctrl_locale_BinarySink_write(
 
   out:
     setlocale(LC_CTYPE, previous_locale);
+    sfree(previous_locale);
 }
 
 static void stripctrl_term_BinarySink_write(

+ 4 - 4
source/putty/version.h

@@ -1,5 +1,5 @@
 /* Generated by automated build script */
-#define SNAPSHOT
-#define TEXTVER "Development snapshot 2022-03-28.a101444"
-#define SSHVER "-Snapshot-2022-03-28.a101444"
-#define BINARY_VERSION 0,76,1261,0
+#define RELEASE 0.77
+#define TEXTVER "Release 0.77"
+#define SSHVER "-Release-0.77"
+#define BINARY_VERSION 0,77,0,0

+ 1 - 1
source/putty/windows/gss.c

@@ -509,7 +509,7 @@ static Ssh_gss_stat ssh_sspi_init_sec_context(struct ssh_gss_library *lib,
     SecBufferDesc input_desc = MPEXT_INIT_SEC_BUFFERDESC(SECBUFFER_VERSION,1,&wrecv_tok);
     unsigned long flags=ISC_REQ_MUTUAL_AUTH|ISC_REQ_REPLAY_DETECT|
         ISC_REQ_CONFIDENTIALITY|ISC_REQ_ALLOCATE_MEMORY;
-    unsigned long ret_flags=0;
+    ULONG ret_flags=0;
     TimeStamp localexp;
 
     /* check if we have to delegate ... */

+ 127 - 195
source/putty/windows/network.c

@@ -24,10 +24,6 @@
 #endif
 #include <ws2tcpip.h>
 
-#if HAVE_AFUNIX_H
-#include <afunix.h>
-#endif
-
 #ifndef NO_IPV6
 #ifdef __clang__
 #pragma clang diagnostic push
@@ -87,28 +83,12 @@ struct NetSocket {
     Socket sock;
 };
 
-/*
- * Top-level discriminator for SockAddr.
- *
- * UNRESOLVED means a host name not yet put through DNS; IP means a
- * resolved IP address (or list of them); UNIX indicates the AF_UNIX
- * network family (which Windows also has); NAMEDPIPE indicates that
- * this SockAddr is phony, holding a Windows named pipe pathname
- * instead of any address WinSock can understand.
- */
-typedef enum SuperFamily {
-    UNRESOLVED,
-    IP,
-#if HAVE_AFUNIX_H
-    UNIX,
-#endif
-    NAMEDPIPE
-} SuperFamily;
-
 struct SockAddr {
     int refcount;
     char *error;
-    SuperFamily superfamily;
+    bool resolved;
+    bool namedpipe; /* indicates that this SockAddr is phony, holding a Windows
+                     * named pipe pathname instead of a network address */
 #ifndef NO_IPV6
     struct addrinfo *ais;              /* Addresses IPv6 style. */
 #endif
@@ -119,27 +99,18 @@ struct SockAddr {
 
 /*
  * Which address family this address belongs to. AF_INET for IPv4;
- * AF_INET6 for IPv6; AF_UNIX for Unix-domain sockets; AF_UNSPEC
- * indicates that name resolution has not been done and a simple host
- * name is held in this SockAddr structure.
+ * AF_INET6 for IPv6; AF_UNSPEC indicates that name resolution has
+ * not been done and a simple host name is held in this SockAddr
+ * structure.
  */
-static inline int sockaddr_family(SockAddr *addr, SockAddrStep step)
-{
-    switch (addr->superfamily) {
-      case IP:
 #ifndef NO_IPV6
-        if (step.ai)
-            return step.ai->ai_family;
-#endif
-        return AF_INET;
-#if HAVE_AFUNIX_H
-      case UNIX:
-        return AF_UNIX;
+#define SOCKADDR_FAMILY(addr, step) \
+    (!(addr)->resolved ? AF_UNSPEC : \
+     (step).ai ? (step).ai->ai_family : AF_INET)
+#else
+#define SOCKADDR_FAMILY(addr, step) \
+    (!(addr)->resolved ? AF_UNSPEC : AF_INET)
 #endif
-      default:
-        return AF_UNSPEC;
-    }
-}
 
 /*
  * Start a SockAddrStep structure to step through multiple
@@ -491,8 +462,9 @@ SockAddr *sk_namelookup(const char *host, char **canonicalname,
 #ifndef NO_IPV6
     ret->ais = NULL;
 #endif
+    ret->namedpipe = false;
     ret->addresses = NULL;
-    ret->superfamily = UNRESOLVED;
+    ret->resolved = false;
     ret->refcount = 1;
     *realhost = '\0';
 
@@ -516,7 +488,7 @@ SockAddr *sk_namelookup(const char *host, char **canonicalname,
             }
             if (err == 0)
             {
-                ret->superfamily = IP;
+                ret->resolved = true;
             }
         } else
 #endif
@@ -526,12 +498,12 @@ SockAddr *sk_namelookup(const char *host, char **canonicalname,
              * (NOTE: we don't use gethostbyname as a fallback!)
              */
             if ( (h = p_gethostbyname(host)) )
-                ret->superfamily = IP;
+                ret->resolved = true;
             else
                 err = p_WSAGetLastError();
         }
 
-        if (ret->superfamily != IP) {
+        if (!ret->resolved) {
             ret->error = (err == WSAENETDOWN ? "Network is down" :
                           err == WSAHOST_NOT_FOUND ? "Host does not exist" :
                           err == WSATRY_AGAIN ? "Host not found" :
@@ -584,7 +556,7 @@ SockAddr *sk_namelookup(const char *host, char **canonicalname,
         ret->addresses = snewn(1, unsigned long);
         ret->naddresses = 1;
         ret->addresses[0] = p_ntohl(a);
-        ret->superfamily = IP;
+        ret->resolved = true;
         strncpy(realhost, host, sizeof(realhost));
     }
     realhost[lenof(realhost)-1] = '\0';
@@ -592,38 +564,39 @@ SockAddr *sk_namelookup(const char *host, char **canonicalname,
     return ret;
 }
 
-static SockAddr *sk_special_addr(SuperFamily superfamily, const char *name)
+SockAddr *sk_nonamelookup(const char *host)
 {
     SockAddr *ret = snew(SockAddr);
     ret->error = NULL;
-    ret->superfamily = superfamily;
+    ret->resolved = false;
 #ifndef NO_IPV6
     ret->ais = NULL;
 #endif
+    ret->namedpipe = false;
     ret->addresses = NULL;
     ret->naddresses = 0;
     ret->refcount = 1;
-    strncpy(ret->hostname, name, lenof(ret->hostname));
+    strncpy(ret->hostname, host, lenof(ret->hostname));
     ret->hostname[lenof(ret->hostname)-1] = '\0';
     return ret;
 }
 
-SockAddr *sk_nonamelookup(const char *host)
-{
-    return sk_special_addr(UNRESOLVED, host);
-}
-
 SockAddr *sk_namedpipe_addr(const char *pipename)
 {
-    return sk_special_addr(NAMEDPIPE, pipename);
-}
-
-#if HAVE_AFUNIX_H
-SockAddr *sk_unix_addr(const char *sockpath)
-{
-    return sk_special_addr(UNIX, sockpath);
-}
+    SockAddr *ret = snew(SockAddr);
+    ret->error = NULL;
+    ret->resolved = false;
+#ifndef NO_IPV6
+    ret->ais = NULL;
 #endif
+    ret->namedpipe = true;
+    ret->addresses = NULL;
+    ret->naddresses = 0;
+    ret->refcount = 1;
+    strncpy(ret->hostname, pipename, lenof(ret->hostname));
+    ret->hostname[lenof(ret->hostname)-1] = '\0';
+    return ret;
+}
 
 static bool sk_nextaddr(SockAddr *addr, SockAddrStep *step)
 {
@@ -666,7 +639,7 @@ void sk_getaddr(SockAddr *addr, char *buf, int buflen)
         }
     } else
 #endif
-    if (sockaddr_family(addr, step) == AF_INET) {
+    if (SOCKADDR_FAMILY(addr, step) == AF_INET) {
         struct in_addr a;
         assert(addr->addresses && step.curraddr < addr->naddresses);
         a.s_addr = p_htonl(addr->addresses[step.curraddr]);
@@ -697,7 +670,7 @@ static SockAddr sk_extractaddr_tmp(
 #ifndef NO_IPV6
     toret.ais = step->ai;
 #endif
-    if (sockaddr_family(addr, *step) == AF_INET
+    if (SOCKADDR_FAMILY(addr, *step) == AF_INET
 #ifndef NO_IPV6
         && !toret.ais
 #endif
@@ -709,11 +682,7 @@ static SockAddr sk_extractaddr_tmp(
 
 bool sk_addr_needs_port(SockAddr *addr)
 {
-    return addr->superfamily != NAMEDPIPE
-#if HAVE_AFUNIX_H
-        && addr->superfamily != UNIX
-#endif
-        ;
+    return !addr->namedpipe;
 }
 
 bool sk_hostname_is_local(const char *name)
@@ -761,7 +730,7 @@ bool sk_address_is_local(SockAddr *addr)
     SockAddrStep step;
     int family;
     START_STEP(addr, step);
-    family = sockaddr_family(addr, step);
+    family = SOCKADDR_FAMILY(addr, step);
 
 #ifndef NO_IPV6
     if (family == AF_INET6) {
@@ -797,7 +766,7 @@ int sk_addrtype(SockAddr *addr)
     SockAddrStep step;
     int family;
     START_STEP(addr, step);
-    family = sockaddr_family(addr, step);
+    family = SOCKADDR_FAMILY(addr, step);
 
     return (family == AF_INET ? ADDRTYPE_IPV4 :
 #ifndef NO_IPV6
@@ -811,7 +780,7 @@ void sk_addrcopy(SockAddr *addr, char *buf)
     SockAddrStep step;
     int family;
     START_STEP(addr, step);
-    family = sockaddr_family(addr, step);
+    family = SOCKADDR_FAMILY(addr, step);
 
     assert(family != AF_UNSPEC);
 #ifndef NO_IPV6
@@ -972,7 +941,7 @@ static DWORD try_connect(NetSocket *sock,
     /*
      * Open socket.
      */
-    family = sockaddr_family(sock->addr, sock->step);
+    family = SOCKADDR_FAMILY(sock->addr, sock->step);
 
     /*
      * Remove the socket from the tree before we overwrite its
@@ -1257,26 +1226,21 @@ Socket *sk_new(SockAddr *addr, int port, bool privport, bool oobinline,
     return &ret->sock;
 }
 
-Socket *sk_newlistener_internal(const char *srcaddr, int port, Plug *plug,
-                                bool local_host_only, int orig_address_family)
+Socket *sk_newlistener(const char *srcaddr, int port, Plug *plug,
+                       bool local_host_only, int orig_address_family)
 {
     SOCKET s;
-    SOCKADDR_IN a;
 #ifndef NO_IPV6
     SOCKADDR_IN6 a6;
 #endif
-#if HAVE_AFUNIX_H
-    SOCKADDR_UN au;
-#endif
-    struct sockaddr *bindaddr;
-    unsigned bindsize;
+    SOCKADDR_IN a;
 
     DWORD err;
     const char *errstr;
     NetSocket *ret;
     int retcode;
 
-    int address_family = orig_address_family;
+    int address_family;
 
     /*
      * Create NetSocket structure.
@@ -1296,6 +1260,16 @@ Socket *sk_newlistener_internal(const char *srcaddr, int port, Plug *plug,
     ret->parent = ret->child = NULL;
     ret->addr = NULL;
 
+    /*
+     * Translate address_family from platform-independent constants
+     * into local reality.
+     */
+    address_family = (orig_address_family == ADDRTYPE_IPV4 ? AF_INET :
+#ifndef NO_IPV6
+                      orig_address_family == ADDRTYPE_IPV6 ? AF_INET6 :
+#endif
+                      AF_UNSPEC);
+
     /*
      * Our default, if passed the `don't care' value
      * ADDRTYPE_UNSPEC, is to listen on IPv4. If IPv6 is supported,
@@ -1321,100 +1295,85 @@ Socket *sk_newlistener_internal(const char *srcaddr, int port, Plug *plug,
 
     ret->oobinline = false;
 
-#if HAVE_AFUNIX_H
-    if (address_family != AF_UNIX)
-#endif
     {
         BOOL on = true;
         p_setsockopt(s, SOL_SOCKET, SO_EXCLUSIVEADDRUSE,
                      (const char *)&on, sizeof(on));
     }
 
-    switch (address_family) {
 #ifndef NO_IPV6
-      case AF_INET6: {
-        memset(&a6, 0, sizeof(a6));
-        a6.sin6_family = AF_INET6;
-        if (local_host_only)
-            a6.sin6_addr = in6addr_loopback;
-        else
-            a6.sin6_addr = in6addr_any;
-        if (srcaddr != NULL && p_getaddrinfo) {
-            struct addrinfo hints;
-            struct addrinfo *ai;
-            int err;
-
-            memset(&hints, 0, sizeof(hints));
-            hints.ai_family = AF_INET6;
-            hints.ai_flags = 0;
-            {
-                /* strip [] on IPv6 address literals */
-                char *trimmed_addr = host_strduptrim(srcaddr);
-                err = p_getaddrinfo(trimmed_addr, NULL, &hints, &ai);
-                sfree(trimmed_addr);
-            }
-            if (err == 0 && ai->ai_family == AF_INET6) {
-                a6.sin6_addr =
-                    ((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr;
+        if (address_family == AF_INET6) {
+            memset(&a6, 0, sizeof(a6));
+            a6.sin6_family = AF_INET6;
+            if (local_host_only)
+                a6.sin6_addr = in6addr_loopback;
+            else
+                a6.sin6_addr = in6addr_any;
+            if (srcaddr != NULL && p_getaddrinfo) {
+                struct addrinfo hints;
+                struct addrinfo *ai;
+                int err;
+
+                memset(&hints, 0, sizeof(hints));
+                hints.ai_family = AF_INET6;
+                hints.ai_flags = 0;
+                {
+                    /* strip [] on IPv6 address literals */
+                    char *trimmed_addr = host_strduptrim(srcaddr);
+                    err = p_getaddrinfo(trimmed_addr, NULL, &hints, &ai);
+                    sfree(trimmed_addr);
+                }
+                if (err == 0 && ai->ai_family == AF_INET6) {
+                    a6.sin6_addr =
+                        ((struct sockaddr_in6 *)ai->ai_addr)->sin6_addr;
+                }
             }
-        }
-        a6.sin6_port = p_htons(port);
-        bindaddr = (struct sockaddr *)&a6;
-        bindsize = sizeof(a6);
-        break;
-      }
+            a6.sin6_port = p_htons(port);
+        } else
 #endif
-      case AF_INET: {
-        bool got_addr = false;
-        a.sin_family = AF_INET;
+        {
+            bool got_addr = false;
+            a.sin_family = AF_INET;
 
-        /*
-         * Bind to source address. First try an explicitly
-         * specified one...
-         */
-        if (srcaddr) {
-            a.sin_addr.s_addr = p_inet_addr(srcaddr);
-            if (a.sin_addr.s_addr != INADDR_NONE) {
-                /* Override localhost_only with specified listen addr. */
-                ret->localhost_only = ipv4_is_loopback(a.sin_addr);
-                got_addr = true;
+            /*
+             * Bind to source address. First try an explicitly
+             * specified one...
+             */
+            if (srcaddr) {
+                a.sin_addr.s_addr = p_inet_addr(srcaddr);
+                if (a.sin_addr.s_addr != INADDR_NONE) {
+                    /* Override localhost_only with specified listen addr. */
+                    ret->localhost_only = ipv4_is_loopback(a.sin_addr);
+                    got_addr = true;
+                }
             }
-        }
 
-        /*
-         * ... and failing that, go with one of the standard ones.
-         */
-        if (!got_addr) {
-            if (local_host_only)
-                a.sin_addr.s_addr = p_htonl(INADDR_LOOPBACK);
-            else
-                a.sin_addr.s_addr = p_htonl(INADDR_ANY);
-        }
+            /*
+             * ... and failing that, go with one of the standard ones.
+             */
+            if (!got_addr) {
+                if (local_host_only)
+                    a.sin_addr.s_addr = p_htonl(INADDR_LOOPBACK);
+                else
+                    a.sin_addr.s_addr = p_htonl(INADDR_ANY);
+            }
 
-        a.sin_port = p_htons((short)port);
-        bindaddr = (struct sockaddr *)&a;
-        bindsize = sizeof(a);
-        break;
-      }
-#if HAVE_AFUNIX_H
-      case AF_UNIX: {
-        au.sun_family = AF_UNIX;
-        strncpy(au.sun_path, srcaddr, sizeof(au.sun_path));
-        bindaddr = (struct sockaddr *)&au;
-        bindsize = sizeof(au);
-        break;
-      }
+            a.sin_port = p_htons((short)port);
+        }
+#ifndef NO_IPV6
+        retcode = p_bind(s, (address_family == AF_INET6 ?
+                           (struct sockaddr *) &a6 :
+                           (struct sockaddr *) &a),
+                       (address_family ==
+                        AF_INET6 ? sizeof(a6) : sizeof(a)));
+#else
+        retcode = p_bind(s, (struct sockaddr *) &a, sizeof(a));
 #endif
-      default:
-        unreachable("bad address family in sk_newlistener_internal");
-    }
-
-    retcode = p_bind(s, bindaddr, bindsize);
-    if (retcode != SOCKET_ERROR) {
-        err = 0;
-    } else {
-        err = p_WSAGetLastError();
-    }
+        if (retcode != SOCKET_ERROR) {
+            err = 0;
+        } else {
+            err = p_WSAGetLastError();
+        }
 
     if (err) {
         p_closesocket(s);
@@ -1449,9 +1408,9 @@ Socket *sk_newlistener_internal(const char *srcaddr, int port, Plug *plug,
      * If we were given ADDRTYPE_UNSPEC, we must also create an
      * IPv6 listening socket and link it to this one.
      */
-    if (address_family == AF_INET && orig_address_family == AF_UNSPEC) {
-        Socket *other = sk_newlistener_internal(srcaddr, port, plug,
-                                                local_host_only, AF_INET6);
+    if (address_family == AF_INET && orig_address_family == ADDRTYPE_UNSPEC) {
+        Socket *other = sk_newlistener(srcaddr, port, plug,
+                                       local_host_only, ADDRTYPE_IPV6);
 
         if (other) {
             NetSocket *ns = container_of(other, NetSocket, sock);
@@ -1468,33 +1427,6 @@ Socket *sk_newlistener_internal(const char *srcaddr, int port, Plug *plug,
     return &ret->sock;
 }
 
-Socket *sk_newlistener(const char *srcaddr, int port, Plug *plug,
-                       bool local_host_only, int orig_address_family)
-{
-    /*
-     * Translate address_family from platform-independent constants
-     * into local reality.
-     */
-    int address_family = (orig_address_family == ADDRTYPE_IPV4 ? AF_INET :
-#ifndef NO_IPV6
-                          orig_address_family == ADDRTYPE_IPV6 ? AF_INET6 :
-#endif
-                          AF_UNSPEC);
-
-    return sk_newlistener_internal(srcaddr, port, plug, local_host_only,
-                                   address_family);
-}
-
-Socket *sk_newlistener_unix(const char *path, Plug *plug)
-{
-#if HAVE_AFUNIX_H
-    return sk_newlistener_internal(path, 0, plug, false, AF_UNIX);
-#else
-    return new_error_socket_fmt(
-        plug, "AF_UNIX support not compiled into this program");
-#endif
-}
-
 static void sk_net_close(Socket *sock)
 {
     NetSocket *s = container_of(sock, NetSocket, sock);
@@ -1848,7 +1780,7 @@ void select_result(WPARAM wParam, LPARAM lParam)
 #ifdef NO_IPV6
         struct sockaddr_in isa;
 #else
-        struct sockaddr_storage isa; // FIXME: also if Unix and no IPv6
+        struct sockaddr_storage isa;
 #endif
         int addrlen = sizeof(isa);
         SOCKET t;  /* socket of connection */
@@ -1904,7 +1836,7 @@ static SocketPeerInfo *sk_net_peer_info(Socket *sock)
 #ifdef NO_IPV6
     struct sockaddr_in addr;
 #else
-    struct sockaddr_storage addr; // FIXME: also if Unix and no IPv6
+    struct sockaddr_storage addr;
     char buf[INET6_ADDRSTRLEN];
 #endif
     int addrlen = sizeof(addr);
@@ -2031,7 +1963,7 @@ SockAddr *platform_get_x11_unix_address(const char *display, int displaynum)
 {
     SockAddr *ret = snew(SockAddr);
     memset(ret, 0, sizeof(SockAddr));
-    ret->error = "unix sockets for X11 not supported on this platform";
+    ret->error = "unix sockets not supported on this platform";
     ret->refcount = 1;
     return ret;
 }

+ 3 - 2
source/putty/windows/platform.h

@@ -302,7 +302,6 @@ void socket_reselect_all(void);
 SockAddr *sk_namedpipe_addr(const char *pipename);
 /* Turn a WinSock error code into a string. */
 const char *winsock_error_string(int error);
-Socket *sk_newlistener_unix(const char *socketpath, Plug *plug);
 
 /*
  * network.c dynamically loads WinSock 2 or WinSock 1 depending on
@@ -342,7 +341,6 @@ const char *do_select(Plug * plug, SOCKET skt, bool enable); // WINSCP
  */
 void winselgui_set_hwnd(HWND hwnd);
 void winselgui_clear_hwnd(void);
-void winselgui_response(WPARAM wParam, LPARAM lParam);
 
 void winselcli_setup(void);
 SOCKET winselcli_unique_socket(void);
@@ -768,4 +766,7 @@ bool aux_match_arg(AuxMatchOpt *amo, char **val);
 bool aux_match_opt(AuxMatchOpt *amo, char **val, const char *optname, ...);
 bool aux_match_done(AuxMatchOpt *amo);
 
+char *save_screenshot(HWND hwnd, const char *outfile);
+void gui_terminal_ready(HWND hwnd, Seat *seat, Backend *backend);
+
 #endif /* PUTTY_WINDOWS_PLATFORM_H */