Identify ssh client version with more info and sshd server shows it by an env var

MS Win32 port & build date added in text part of version id ssh client
send to the remote sshd. sshd also shows this string via environment
variable  "SSH_CLIENT_ID" . All these are allowed and encouraged by the
SSH RFC and improves usability and assists users to know what ssh
versions and vendor build they are running.
This commit is contained in:
quamrulmina 2015-11-01 01:25:19 -06:00
parent 6c4fc9c4c5
commit 484bab654b
3 changed files with 13 additions and 0 deletions

View File

@ -382,7 +382,11 @@ _ssh_send_banner(struct ssh *ssh, char **bannerp)
char buf[256]; char buf[256];
int r; int r;
#ifndef WIN32_FIXME
snprintf(buf, sizeof buf, "SSH-2.0-%.100s\r\n", SSH_VERSION); snprintf(buf, sizeof buf, "SSH-2.0-%.100s\r\n", SSH_VERSION);
#else
snprintf(buf, sizeof buf, "SSH-2.0-%.100sp1 Microsoft Win32 port %s\r\n", SSH_VERSION, __DATE__ );
#endif
if ((r = sshbuf_put(ssh_packet_get_output(ssh), buf, strlen(buf))) != 0) if ((r = sshbuf_put(ssh_packet_get_output(ssh), buf, strlen(buf))) != 0)
return r; return r;
chop(buf); chop(buf);

View File

@ -677,8 +677,13 @@ send_client_banner(int connection_out, int minor1)
{ {
/* Send our own protocol version identification. */ /* Send our own protocol version identification. */
if (compat20) { if (compat20) {
#ifndef WIN32_FIXME
xasprintf(&client_version_string, "SSH-%d.%d-%.100s\r\n", xasprintf(&client_version_string, "SSH-%d.%d-%.100s\r\n",
PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION); PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION);
#else
xasprintf(&client_version_string, "SSH-%d.%d-%.100sp1 Microsoft Win32 port %s\r\n",
PROTOCOL_MAJOR_2, PROTOCOL_MINOR_2, SSH_VERSION, __DATE__ );
#endif
} else { } else {
xasprintf(&client_version_string, "SSH-%d.%d-%.100s\n", xasprintf(&client_version_string, "SSH-%d.%d-%.100s\n",
PROTOCOL_MAJOR_1, minor1, SSH_VERSION); PROTOCOL_MAJOR_1, minor1, SSH_VERSION);

4
sshd.c
View File

@ -795,6 +795,10 @@ sshd_exchange_identification(int sock_in, int sock_out)
debug("Client protocol version %d.%d; client software version %.100s", debug("Client protocol version %d.%d; client software version %.100s",
remote_major, remote_minor, remote_version); remote_major, remote_minor, remote_version);
#ifdef WIN32_FIXME
SetEnvironmentVariable("SSH_CLIENT_ID", remote_version);
#endif
active_state->compat = compat_datafellows(remote_version); active_state->compat = compat_datafellows(remote_version);
if ((datafellows & SSH_BUG_PROBE) != 0) { if ((datafellows & SSH_BUG_PROBE) != 0) {