1
0
Эх сурвалжийг харах

Merge branch 'thirdparty_dev' into dev

Source commit: 9c0a0a9e7fbfc3994597a5cc70cd64a73b7c8c46
Martin Prikryl 6 жил өмнө
parent
commit
c8ed250af3

+ 0 - 1
source/putty/errsock.c

@@ -50,7 +50,6 @@ static const SocketVtable ErrorSocket_sockvt = {
     NULL /* write */,
     NULL /* write_oob */,
     NULL /* write_eof */,
-    NULL /* flush */,
     NULL /* set_frozen */,
     sk_error_socket_error,
     sk_error_peer_info,

+ 0 - 5
source/putty/network.h

@@ -31,7 +31,6 @@ struct SocketVtable {
     size_t (*write) (Socket *s, const void *data, size_t len);
     size_t (*write_oob) (Socket *s, const void *data, size_t len);
     void (*write_eof) (Socket *s);
-    void (*flush) (Socket *s);
     void (*set_frozen) (Socket *s, bool is_frozen);
     /* ignored by tcp, but vital for ssl */
     const char *(*socket_error) (Socket *s);
@@ -108,8 +107,6 @@ Socket *new_listener(const char *srcaddr, int port, Plug *plug,
 SockAddr *name_lookup(const char *host, int port, char **canonicalname,
                       Conf *conf, int addressfamily, LogContext *logctx,
                       const char *lookup_reason_for_logging);
-bool proxy_for_destination (SockAddr *addr, const char *hostname, int port,
-                            Conf *conf);
 
 /* platform-dependent callback from new_connection() */
 /* (same caveat about addr as new_connection()) */
@@ -169,8 +166,6 @@ static inline size_t sk_write_oob(Socket *s, const void *data, size_t len)
 { return s->vt->write_oob(s, data, len); }
 static inline void sk_write_eof(Socket *s)
 { s->vt->write_eof(s); }
-static inline void sk_flush(Socket *s)
-{ s->vt->flush(s); }
 
 static inline void plug_log(
     Plug *p, int type, SockAddr *addr, int port, const char *msg, int code)

+ 2 - 20
source/putty/proxy.c

@@ -57,11 +57,6 @@ void proxy_activate (ProxySocket *p)
     if (output_after < output_before)
         plug_sent(p->plug, output_after);
 
-    /* if we were asked to flush the output during
-     * the proxy negotiation process, do so now.
-     */
-    if (p->pending_flush) sk_flush(p->sub_socket);
-
     /* if we have a pending EOF to send, send it */
     if (p->pending_eof) sk_write_eof(p->sub_socket);
 
@@ -128,17 +123,6 @@ static void sk_proxy_write_eof (Socket *s)
     sk_write_eof(ps->sub_socket);
 }
 
-static void sk_proxy_flush (Socket *s)
-{
-    ProxySocket *ps = container_of(s, ProxySocket, sock);
-
-    if (ps->state != PROXY_STATE_ACTIVE) {
-	ps->pending_flush = true;
-	return;
-    }
-    sk_flush(ps->sub_socket);
-}
-
 static void sk_proxy_set_frozen (Socket *s, bool is_frozen)
 {
     ProxySocket *ps = container_of(s, ProxySocket, sock);
@@ -258,8 +242,8 @@ static int plug_proxy_accepting(Plug *p,
  * This function can accept a NULL pointer as `addr', in which case
  * it will only check the host name.
  */
-bool proxy_for_destination (SockAddr *addr, const char *hostname,
-                           int port, Conf *conf)
+static bool proxy_for_destination(SockAddr *addr, const char *hostname,
+                                  int port, Conf *conf)
 {
     int s = 0, e = 0;
     char hostip[64];
@@ -393,7 +377,6 @@ static const struct SocketVtable ProxySocket_sockvt = {
     sk_proxy_write,
     sk_proxy_write_oob,
     sk_proxy_write_eof,
-    sk_proxy_flush,
     sk_proxy_set_frozen,
     sk_proxy_socket_error,
     NULL, /* peer_info */
@@ -437,7 +420,6 @@ Socket *new_connection(SockAddr *addr, const char *hostname,
 	ret->remote_port = port;
 
 	ret->error = NULL;
-	ret->pending_flush = false;
 	ret->pending_eof = false;
 	ret->freeze = false;
 

+ 0 - 1
source/putty/proxy.h

@@ -25,7 +25,6 @@ struct ProxySocket {
 
     bufchain pending_output_data;
     bufchain pending_oob_output_data;
-    bool pending_flush;
     bufchain pending_input_data;
     bool pending_eof;
 

+ 3 - 0
source/putty/ssh.c

@@ -897,6 +897,9 @@ static const char *ssh_init(Seat *seat, Backend **backend_handle,
     ssh->ic_out_raw.ctx = ssh;
     ssh->ic_out_raw.set = get_seat_callback_set(seat);
 
+    ssh->term_width = conf_get_int(ssh->conf, CONF_width);
+    ssh->term_height = conf_get_int(ssh->conf, CONF_height);
+
     ssh->backend.vt = &ssh_backend;
     *backend_handle = &ssh->backend;
 

+ 16 - 8
source/putty/ssh2userauth.c

@@ -1327,10 +1327,14 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
 
                     sb = strbuf_new();
                     if (name.len) {
-                        stripctrl_retarget(s->ki_scc, BinarySink_UPCAST(sb));
-                        put_datapl(s->ki_scc, name);
-                        stripctrl_retarget(s->ki_scc, NULL);
-
+                        if (s->ki_scc) {
+                            stripctrl_retarget(s->ki_scc,
+                                               BinarySink_UPCAST(sb));
+                            put_datapl(s->ki_scc, name);
+                            stripctrl_retarget(s->ki_scc, NULL);
+                        } else {
+                            put_datapl(sb, name);
+                        }
                         s->cur_prompt->name_reqd = true;
                     } else {
                         put_datapl(sb, PTRLEN_LITERAL(
@@ -1341,10 +1345,14 @@ static void ssh2_userauth_process_queue(PacketProtocolLayer *ppl)
 
                     sb = strbuf_new();
                     if (inst.len) {
-                        stripctrl_retarget(s->ki_scc, BinarySink_UPCAST(sb));
-                        put_datapl(s->ki_scc, inst);
-                        stripctrl_retarget(s->ki_scc, NULL);
-
+                        if (s->ki_scc) {
+                            stripctrl_retarget(s->ki_scc,
+                                               BinarySink_UPCAST(sb));
+                            put_datapl(s->ki_scc, inst);
+                            stripctrl_retarget(s->ki_scc, NULL);
+                        } else {
+                            put_datapl(sb, inst);
+                        }
                         s->cur_prompt->instr_reqd = true;
                     } else {
                         s->cur_prompt->instr_reqd = false;

+ 5 - 0
source/putty/stripctrl.c

@@ -171,6 +171,8 @@ static inline void stripctrl_locale_put_wc(StripCtrlCharsImpl *scc, wchar_t wc)
     int width = mk_wcwidth(wc);
     if ((iswprint(wc) && width >= 0) || stripctrl_ctrlchar_ok(scc, wc)) {
         /* Printable character, or one we're going to let through anyway. */
+        if (width < 0)
+            width = 0;   /* sanitise for stripctrl_check_line_limit */
     } else if (scc->substitution) {
         wc = scc->substitution;
         width = mk_wcwidth(wc);
@@ -205,6 +207,9 @@ static inline void stripctrl_term_put_wc(
                 width = term_char_width(scc->term, wc);
                 assert(width >= 0);
             }
+        } else {
+            if (width < 0)
+                width = 0; /* sanitise for stripctrl_check_line_limit */
         }
 
         if (wc == '\012') {

+ 35 - 6
source/putty/version.h

@@ -1,6 +1,35 @@
-/* Generated by automated build script */
-#define RELEASE 0.72
-#define TEXTVER "Release 0.72"
-#define SSHVER "-Release-0.72"
-#define BINARY_VERSION 0,72,0,0
-#define SOURCE_COMMIT "75cd6c8b2703137e574223d90d2f3ead9ca34acc"
+/*
+ * This header file provides the various versioning-related #defines
+ * for a particular PuTTY build.
+ *
+ * When my automated build system does a full build, Buildscr
+ * completely overwrites this file with information derived from the
+ * circumstances and type of that build. The information _here_ is
+ * default stuff used for local development runs of 'make'.
+ */
+
+#define TEXTVER "Unidentified build"
+#define SSHVER "-Unidentified-Local-Build"
+#define BINARY_VERSION 0,0,0,0
+
+#ifndef SOURCE_COMMIT
+/*
+ * git commit id from which this build was made. This is defined by
+ * Buildscr for official builds - both source archives and prebuilt
+ * binaries - in the course of overwriting this file as described
+ * above. But we put it here under ifdef, so that it can also be
+ * passed in on the command line for Unix local development builds,
+ * which I treat specially because Unix developers - e.g. me - are
+ * quite likely to run 'make install' straight out of their dev
+ * directory so as to use the bleeding-edge code for day-to-day
+ * running.
+ *
+ * Windows doesn't really need the same treatment, because the easiest
+ * way to install a build properly on Windows is to run the installer,
+ * and the easiest way to do that is to run Buildscr, which will
+ * populate this field its own way. It's only the Unix automake build
+ * where you might go straight from local 'make' to 'make install'
+ * without going through Buildscr.
+ */
+#define SOURCE_COMMIT "unavailable"
+#endif

+ 0 - 7
source/putty/windows/winhsock.c

@@ -175,12 +175,6 @@ static void sk_handle_write_eof(Socket *s)
     handle_write_eof(hs->send_h);
 }
 
-static void sk_handle_flush(Socket *s)
-{
-    /* HandleSocket *hs = container_of(s, HandleSocket, sock); */
-    /* do nothing */
-}
-
 static void handle_socket_unfreeze(void *hsv)
 {
     HandleSocket *hs = (HandleSocket *)hsv;
@@ -336,7 +330,6 @@ static const SocketVtable HandleSocket_sockvt = {
     sk_handle_write,
     sk_handle_write_oob,
     sk_handle_write_eof,
-    sk_handle_flush,
     sk_handle_set_frozen,
     sk_handle_socket_error,
     sk_handle_peer_info,

+ 1 - 10
source/putty/windows/winnet.c

@@ -128,7 +128,7 @@ static tree234 *sktree;
 static int cmpfortree(void *av, void *bv)
 {
     NetSocket *a = (NetSocket *)av, *b = (NetSocket *)bv;
-    unsigned long as = (unsigned long) a->s, bs = (unsigned long) b->s;
+    uintptr_t as = (uintptr_t) a->s, bs = (uintptr_t) b->s;
     if (as < bs)
 	return -1;
     if (as > bs)
@@ -843,14 +843,6 @@ static Plug *sk_net_plug(Socket *sock, Plug *p)
     return ret;
 }
 
-static void sk_net_flush(Socket *s)
-{
-    /*
-     * We send data to the socket as soon as we can anyway,
-     * so we don't need to do anything here.  :-)
-     */
-}
-
 static void sk_net_close(Socket *s);
 static size_t sk_net_write(Socket *s, const void *data, size_t len);
 static size_t sk_net_write_oob(Socket *s, const void *data, size_t len);
@@ -865,7 +857,6 @@ static const SocketVtable NetSocket_sockvt = {
     sk_net_write,
     sk_net_write_oob,
     sk_net_write_eof,
-    sk_net_flush,
     sk_net_set_frozen,
     sk_net_socket_error,
     sk_net_peer_info,

+ 3 - 2
source/putty/windows/winstore.c

@@ -307,12 +307,12 @@ settings_e *enum_settings_start(void)
 
 bool enum_settings_next(settings_e *e, strbuf *sb)
 {
-    size_t regbuf_size = 256;
+    size_t regbuf_size = MAX_PATH + 1;
     char *regbuf = snewn(regbuf_size, char);
     bool success;
 
     while (1) {
-        DWORD retd = RegEnumKey(e->key, e->i++, regbuf, regbuf_size);
+        DWORD retd = RegEnumKey(e->key, e->i, regbuf, regbuf_size);
         if (retd != ERROR_MORE_DATA) {
             success = (retd == ERROR_SUCCESS);
             break;
@@ -323,6 +323,7 @@ bool enum_settings_next(settings_e *e, strbuf *sb)
     if (success)
         unescape_registry_key(regbuf, sb);
 
+    e->i++;
     sfree(regbuf);
     return success;
 }