Can't remember why I did this, banner should always be sent before trying to receive
This commit is contained in:
parent
a891971a63
commit
a3735795dd
@ -254,18 +254,18 @@ LIBSSH2_API int libssh2_session_startup(LIBSSH2_SESSION *session, int socket)
|
|||||||
session->socket_fd = socket;
|
session->socket_fd = socket;
|
||||||
|
|
||||||
/* TODO: Liveness check */
|
/* TODO: Liveness check */
|
||||||
if (libssh2_banner_receive(session)) {
|
|
||||||
/* Unable to receive banner from remote */
|
|
||||||
libssh2_error(session, LIBSSH2_ERROR_BANNER_NONE, "Timeout waiting for banner", 0);
|
|
||||||
return LIBSSH2_ERROR_BANNER_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (libssh2_banner_send(session)) {
|
if (libssh2_banner_send(session)) {
|
||||||
/* Unable to send banner? */
|
/* Unable to send banner? */
|
||||||
libssh2_error(session, LIBSSH2_ERROR_BANNER_SEND, "Error sending banner to remote host", 0);
|
libssh2_error(session, LIBSSH2_ERROR_BANNER_SEND, "Error sending banner to remote host", 0);
|
||||||
return LIBSSH2_ERROR_BANNER_SEND;
|
return LIBSSH2_ERROR_BANNER_SEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (libssh2_banner_receive(session)) {
|
||||||
|
/* Unable to receive banner from remote */
|
||||||
|
libssh2_error(session, LIBSSH2_ERROR_BANNER_NONE, "Timeout waiting for banner", 0);
|
||||||
|
return LIBSSH2_ERROR_BANNER_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
if (libssh2_kex_exchange(session, 0)) {
|
if (libssh2_kex_exchange(session, 0)) {
|
||||||
libssh2_error(session, LIBSSH2_ERROR_KEX_FAILURE, "Unable to exchange encryption keys", 0);
|
libssh2_error(session, LIBSSH2_ERROR_KEX_FAILURE, "Unable to exchange encryption keys", 0);
|
||||||
return LIBSSH2_ERROR_KEX_FAILURE;
|
return LIBSSH2_ERROR_KEX_FAILURE;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user