mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-11-27 13:21:11 +03:00
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>
This commit is contained in:
committed by
Andreas Schneider
parent
32eea120af
commit
c3ce3d5cc3
@@ -113,6 +113,8 @@ static int callback_receive_banner(const void *data, size_t len, void *user) {
|
|||||||
}
|
}
|
||||||
if (buffer[i]=='\n') {
|
if (buffer[i]=='\n') {
|
||||||
buffer[i] = '\0';
|
buffer[i] = '\0';
|
||||||
|
/* The server MAY send other lines of data... */
|
||||||
|
if (strncmp(buffer, "SSH-", 4) == 0) {
|
||||||
str = strdup(buffer);
|
str = strdup(buffer);
|
||||||
if (str == NULL) {
|
if (str == NULL) {
|
||||||
return SSH_ERROR;
|
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);
|
session->ssh_connection_callback(session);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
} else {
|
||||||
|
SSH_LOG(SSH_LOG_DEBUG, "ssh_protocol_version_exchange: %s", buffer);
|
||||||
|
ret = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(i>127){
|
if(i>127){
|
||||||
/* Too big banner */
|
/* Too big banner */
|
||||||
|
|||||||
Reference in New Issue
Block a user