diff options
author | Meng Tan <mtan@wallix.com> | 2018-10-24 10:43:17 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2018-10-24 19:56:15 +0200 |
commit | b796924fea7e61a4a8813acce9e510f2359aee34 (patch) | |
tree | 253a1da10b1bdd3336bab279a7a358e70662ac6f | |
parent | 2af4e3970ee1040f9c733a97b82563c856386e92 (diff) | |
download | libssh-b796924fea7e61a4a8813acce9e510f2359aee34.tar.gz libssh-b796924fea7e61a4a8813acce9e510f2359aee34.tar.xz libssh-b796924fea7e61a4a8813acce9e510f2359aee34.zip |
client: Send KEX as soon as banners are exchanged
Signed-off-by: Meng Tan <mtan@wallix.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
-rw-r--r-- | src/client.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/client.c b/src/client.c index e7228831..42b87d06 100644 --- a/src/client.c +++ b/src/client.c @@ -410,6 +410,14 @@ static void ssh_client_connection_callback(ssh_session session) ssh_packet_set_default_callbacks(session); 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); break; @@ -419,14 +427,19 @@ static void ssh_client_connection_callback(ssh_session session) case SSH_SESSION_STATE_KEXINIT_RECEIVED: set_status(session,0.6f); ssh_list_kex(&session->next_crypto->server_kex); - if (ssh_set_client_kex(session) < 0) { - goto error; + if (session->next_crypto->client_kex.methods[0] == NULL) { + /* 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) goto error; - if (ssh_send_kex(session, 0) < 0) { - goto error; - } set_status(session,0.8f); session->session_state=SSH_SESSION_STATE_DH; if (dh_handshake(session) == SSH_ERROR) { |