At long last: PuTTY will now report its version to the server
authorsimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 15 Mar 2001 12:15:02 +0000 (12:15 +0000)
committersimon <simon@cda61777-01e9-0310-a592-d414129be87e>
Thu, 15 Mar 2001 12:15:02 +0000 (12:15 +0000)
sensibly, as a release or a snapshot or a local build. With any luck
this should make bug reporting easier to handle, because anyone who
sends their Event Log should automatically include the version :-)

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

ssh.c
ssh.h
version.c

diff --git a/ssh.c b/ssh.c
index 0db1655..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);
diff --git a/ssh.h b/ssh.h
index 82e5acd..b2803b9 100644 (file)
--- a/ssh.h
+++ b/ssh.h
@@ -182,6 +182,11 @@ extern const struct ssh_mac ssh_md5;
 extern const struct ssh_mac ssh_sha1;
 extern const struct ssh_mac ssh_sha1_buggy;
 
+/*
+ * PuTTY version number formatted as an SSH version string. 
+ */
+extern char sshver[];
+
 #ifndef MSCRYPTOAPI
 void SHATransform(word32 *digest, word32 *data);
 #endif
index 834beec..c39709c 100644 (file)
--- a/version.c
+++ b/version.c
@@ -8,13 +8,22 @@
 #if defined SNAPSHOT
 
 char ver[] = "Development snapshot " STR(SNAPSHOT);
+char sshver[] = "PuTTY-Snapshot-" STR(SNAPSHOT);
 
 #elif defined RELEASE
 
 char ver[] = "Release " STR(RELEASE);
+char sshver[] = "PuTTY-Release-" STR(RELEASE);
 
 #else
 
 char ver[] = "Unidentified build, " __DATE__ " " __TIME__;
+char sshver[] = "PuTTY-Local: " __DATE__ " " __TIME__;
 
 #endif
+
+/*
+ * SSH local version string MUST be under 40 characters. Here's a
+ * compile time assertion to verify this.
+ */
+enum { vorpal_sword = 1 / (sizeof(sshver) <= 40) };