From 900a4ee642d891c53ba6808d2f0fb46643e64706 Mon Sep 17 00:00:00 2001 From: simon Date: Thu, 15 Mar 2001 12:15:02 +0000 Subject: [PATCH] At long last: PuTTY will now report its version to the server 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 | 8 +++++--- ssh.h | 5 +++++ version.c | 9 +++++++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/ssh.c b/ssh.c index 0db1655e..1077b335 100644 --- 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 82e5acd0..b2803b98 100644 --- 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 diff --git a/version.c b/version.c index 834beec8..c39709cd 100644 --- 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) }; -- 2.11.0