At long last: PuTTY will now report its version to the server
[u/mdw/putty] / ssh.c
diff --git a/ssh.c b/ssh.c
index db6f90c..1077b33 100644 (file)
--- a/ssh.c
+++ b/ssh.c
@@ -1193,7 +1193,8 @@ static int do_ssh_init(unsigned char c) {
         /*
          * This is a v2 server. Begin v2 protocol.
          */
-        char *verstring = "SSH-2.0-PuTTY";
+        char verstring[80];
+        sprintf(verstring, "SSH-2.0-%s", sshver);
         SHA_Init(&exhashbase);
         /*
          * Hash our version string and their version string.
@@ -1212,8 +1213,9 @@ static int do_ssh_init(unsigned char c) {
         /*
          * This is a v1 server. Begin v1 protocol.
          */
-        sprintf(vstring, "SSH-%s-PuTTY\n",
-                (ssh_versioncmp(version, "1.5") <= 0 ? version : "1.5"));
+        sprintf(vstring, "SSH-%s-%s\n",
+                (ssh_versioncmp(version, "1.5") <= 0 ? version : "1.5"),
+                sshver);
         sprintf(vlog, "We claim version: %s", vstring);
         vlog[strcspn(vlog, "\r\n")] = '\0';
         logevent(vlog);
@@ -2870,7 +2872,7 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt)
                      */
                     logevent("No username provided. Abandoning session.");
                     ssh_state = SSH_STATE_CLOSED;
-                    crReturn(1);
+                    crReturnV;
                 }
             } else {
                 c_write_str("login as: ");
@@ -3458,7 +3460,6 @@ static void do_ssh2_authconn(unsigned char *in, int inlen, int ispkt)
      * Potentially enable agent forwarding.
      */
     if (cfg.agentfwd && agent_exists()) {
-        char proto[20], data[64];
         logevent("Requesting OpenSSH-style agent forwarding");
         ssh2_pkt_init(SSH2_MSG_CHANNEL_REQUEST);
         ssh2_pkt_adduint32(mainchan->remoteid);