mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-08 08:58:00 +00:00
Server prep: pass "implementation name" to ssh_verstring_new.
The word 'PuTTY' in the outgoing SSH version string has always represented the name of the *SSH implementation* as opposed to the name of the specific program containing it (for example, PSCP and PSFTP don't announce themselves with a different banner). But I think that a change from client to server merits a change in that implementation name, so I'm removing the prefix "PuTTY" from the constant string sshver[], and moving it to a parameter passed in separately to ssh_verstring_new, so that the upcoming server can pass in a different one.
This commit is contained in:
parent
8343961705
commit
650404f32c
8
Buildscr
8
Buildscr
@ -63,10 +63,10 @@ set Docmakever VERSION="$(Puttytextver)"
|
||||
# make sure it's under 40 characters, which is a hard limit in the SSH
|
||||
# protocol spec (and enforced by a compile-time assertion in
|
||||
# version.c).
|
||||
ifneq "$(RELEASE)" "" set Sshver PuTTY-Release-$(RELEASE)
|
||||
ifneq "$(PRERELEASE)" "" set Sshver PuTTY-Prerelease-$(PRERELEASE):$(Ndate).$(vcsid)
|
||||
ifneq "$(SNAPSHOT)" "" set Sshver PuTTY-Snapshot-$(Date).$(vcsid)
|
||||
ifeq "$(RELEASE)$(PRERELEASE)$(SNAPSHOT)" "" set Sshver PuTTY-Custom-$(Date).$(vcsid)
|
||||
ifneq "$(RELEASE)" "" set Sshver -Release-$(RELEASE)
|
||||
ifneq "$(PRERELEASE)" "" set Sshver -Prerelease-$(PRERELEASE):$(Ndate).$(vcsid)
|
||||
ifneq "$(SNAPSHOT)" "" set Sshver -Snapshot-$(Date).$(vcsid)
|
||||
ifeq "$(RELEASE)$(PRERELEASE)$(SNAPSHOT)" "" set Sshver -Custom-$(Date).$(vcsid)
|
||||
|
||||
# Set up the filename suffix for the Unix source archive.
|
||||
ifneq "$(RELEASE)" "" set Uxarcsuffix -$(RELEASE)
|
||||
|
2
ssh.c
2
ssh.c
@ -717,7 +717,7 @@ static const char *connect_to_host(Ssh *ssh, const char *host, int port,
|
||||
ssh->version_receiver.got_ssh_version = ssh_got_ssh_version;
|
||||
ssh->bpp = ssh_verstring_new(
|
||||
ssh->conf, ssh->logctx, ssh->bare_connection,
|
||||
ssh->version == 1 ? "1.5" : "2.0", &ssh->version_receiver);
|
||||
ssh->version == 1 ? "1.5" : "2.0", &ssh->version_receiver, "PuTTY");
|
||||
ssh_connect_bpp(ssh);
|
||||
queue_idempotent_callback(&ssh->bpp->ic_in_raw);
|
||||
|
||||
|
3
sshbpp.h
3
sshbpp.h
@ -136,7 +136,8 @@ struct ssh_version_receiver {
|
||||
};
|
||||
BinaryPacketProtocol *ssh_verstring_new(
|
||||
Conf *conf, LogContext *logctx, int bare_connection_mode,
|
||||
const char *protoversion, struct ssh_version_receiver *rcv);
|
||||
const char *protoversion, struct ssh_version_receiver *rcv,
|
||||
const char *impl_name);
|
||||
const char *ssh_verstring_get_remote(BinaryPacketProtocol *);
|
||||
const char *ssh_verstring_get_local(BinaryPacketProtocol *);
|
||||
int ssh_verstring_get_bugs(BinaryPacketProtocol *);
|
||||
|
@ -27,6 +27,7 @@ struct ssh_verstring_state {
|
||||
int major_protoversion;
|
||||
int remote_bugs;
|
||||
char prefix[PREFIX_MAXLEN];
|
||||
char *impl_name;
|
||||
char *vstring;
|
||||
int vslen, vstrsize;
|
||||
char *protoversion;
|
||||
@ -59,7 +60,8 @@ static int ssh_version_includes_v2(const char *ver);
|
||||
|
||||
BinaryPacketProtocol *ssh_verstring_new(
|
||||
Conf *conf, LogContext *logctx, int bare_connection_mode,
|
||||
const char *protoversion, struct ssh_version_receiver *rcv)
|
||||
const char *protoversion, struct ssh_version_receiver *rcv,
|
||||
const char *impl_name)
|
||||
{
|
||||
struct ssh_verstring_state *s = snew(struct ssh_verstring_state);
|
||||
|
||||
@ -90,6 +92,7 @@ BinaryPacketProtocol *ssh_verstring_new(
|
||||
s->bpp.logctx = logctx;
|
||||
s->our_protoversion = dupstr(protoversion);
|
||||
s->receiver = rcv;
|
||||
s->impl_name = dupstr(impl_name);
|
||||
|
||||
/*
|
||||
* We send our version string early if we can. But if it includes
|
||||
@ -108,6 +111,7 @@ void ssh_verstring_free(BinaryPacketProtocol *bpp)
|
||||
struct ssh_verstring_state *s =
|
||||
container_of(bpp, struct ssh_verstring_state, bpp);
|
||||
conf_free(s->conf);
|
||||
sfree(s->impl_name);
|
||||
sfree(s->vstring);
|
||||
sfree(s->protoversion);
|
||||
sfree(s->our_vstring);
|
||||
@ -155,9 +159,9 @@ static void ssh_verstring_send(struct ssh_verstring_state *s)
|
||||
* Construct our outgoing version string.
|
||||
*/
|
||||
s->our_vstring = dupprintf(
|
||||
"%.*s%s-%s",
|
||||
"%.*s%s-%s%s",
|
||||
(int)s->prefix_wanted.len, (const char *)s->prefix_wanted.ptr,
|
||||
s->our_protoversion, sshver);
|
||||
s->our_protoversion, s->impl_name, sshver);
|
||||
sv_pos = s->prefix_wanted.len + strlen(s->our_protoversion) + 1;
|
||||
|
||||
/* Convert minus signs and spaces in the software version string
|
||||
|
Loading…
Reference in New Issue
Block a user