diff options
author | Ken Reister <reister.kenneth@CIMCOR.COM> | 2015-10-14 15:50:49 -0500 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2016-05-03 09:41:26 +0200 |
commit | c3ce3d5cc347367aa9f3735aa957695973072702 (patch) | |
tree | 3dcd31138ea22e998a04b3ed50e5afcf4b67c857 | |
parent | 32eea120af93fe56827718f63eb9a81ad5d9ec67 (diff) | |
download | libssh-c3ce3d5cc347367aa9f3735aa957695973072702.tar.gz libssh-c3ce3d5cc347367aa9f3735aa957695973072702.tar.xz libssh-c3ce3d5cc347367aa9f3735aa957695973072702.zip |
client: Receive the banner correctly
Comply with RFC 4253 compliance section 4.2.
Allow data other than "SSH-" to be sent across prior to the actual
version striong.
Signed-off-by: Ken Reister <reister.kenneth@CIMCOR.COM>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r-- | src/client.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/client.c b/src/client.c index 2b78add0..d80ff869 100644 --- a/src/client.c +++ b/src/client.c @@ -113,6 +113,8 @@ static int callback_receive_banner(const void *data, size_t len, void *user) { } if (buffer[i]=='\n') { buffer[i] = '\0'; + /* The server MAY send other lines of data... */ + if (strncmp(buffer, "SSH-", 4) == 0) { str = strdup(buffer); if (str == NULL) { return SSH_ERROR; @@ -125,6 +127,11 @@ static int callback_receive_banner(const void *data, size_t len, void *user) { session->ssh_connection_callback(session); return ret; + } else { + SSH_LOG(SSH_LOG_DEBUG, "ssh_protocol_version_exchange: %s", buffer); + ret = i + 1; + break; + } } if(i>127){ /* Too big banner */ |