mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 18:04:25 +09:00
client: Send KEX as soon as banners are exchanged
Signed-off-by: Meng Tan <mtan@wallix.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
(cherry picked from commit b796924fea)
This commit is contained in:
committed by
Andreas Schneider
parent
2ff8a09ee6
commit
8ba10ef42b
23
src/client.c
23
src/client.c
@@ -411,6 +411,14 @@ static void ssh_client_connection_callback(ssh_session session)
|
|||||||
|
|
||||||
ssh_packet_set_default_callbacks(session);
|
ssh_packet_set_default_callbacks(session);
|
||||||
session->session_state = SSH_SESSION_STATE_INITIAL_KEX;
|
session->session_state = SSH_SESSION_STATE_INITIAL_KEX;
|
||||||
|
rc = ssh_set_client_kex(session);
|
||||||
|
if (rc != SSH_OK) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
rc = ssh_send_kex(session, 0);
|
||||||
|
if (rc < 0) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
set_status(session, 0.5f);
|
set_status(session, 0.5f);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -420,14 +428,19 @@ static void ssh_client_connection_callback(ssh_session session)
|
|||||||
case SSH_SESSION_STATE_KEXINIT_RECEIVED:
|
case SSH_SESSION_STATE_KEXINIT_RECEIVED:
|
||||||
set_status(session,0.6f);
|
set_status(session,0.6f);
|
||||||
ssh_list_kex(&session->next_crypto->server_kex);
|
ssh_list_kex(&session->next_crypto->server_kex);
|
||||||
if (ssh_set_client_kex(session) < 0) {
|
if (session->next_crypto->client_kex.methods[0] == NULL) {
|
||||||
goto error;
|
/* in rekeying state if next_crypto client_kex is empty */
|
||||||
|
rc = ssh_set_client_kex(session);
|
||||||
|
if (rc != SSH_OK) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
rc = ssh_send_kex(session, 0);
|
||||||
|
if (rc < 0) {
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ssh_kex_select_methods(session) == SSH_ERROR)
|
if (ssh_kex_select_methods(session) == SSH_ERROR)
|
||||||
goto error;
|
goto error;
|
||||||
if (ssh_send_kex(session, 0) < 0) {
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
set_status(session,0.8f);
|
set_status(session,0.8f);
|
||||||
session->session_state=SSH_SESSION_STATE_DH;
|
session->session_state=SSH_SESSION_STATE_DH;
|
||||||
if (dh_handshake(session) == SSH_ERROR) {
|
if (dh_handshake(session) == SSH_ERROR) {
|
||||||
|
|||||||
Reference in New Issue
Block a user