aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Reister <reister.kenneth@CIMCOR.COM>2015-10-14 15:50:49 -0500
committerAndreas Schneider <asn@cryptomilk.org>2016-05-03 10:57:50 +0200
commit2957aaf9f0e70c3904b1ec9a65829a6eb9b69354 (patch)
treecaa64a50c95d6d8f7686725084cc5472850d9dd7
parent8360139506f8e5a7f58eb8c334d7f6f981eed901 (diff)
downloadlibssh-2957aaf9f0e70c3904b1ec9a65829a6eb9b69354.tar.gz
libssh-2957aaf9f0e70c3904b1ec9a65829a6eb9b69354.tar.xz
libssh-2957aaf9f0e70c3904b1ec9a65829a6eb9b69354.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> (cherry picked from commit c3ce3d5cc347367aa9f3735aa957695973072702)
-rw-r--r--src/client.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/client.c b/src/client.c
index 64ce5dec..b5675f9d 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 */