diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2016-05-02 10:15:33 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2016-05-03 09:41:26 +0200 |
commit | 1da5c94b44ea2610450aacda24d9789859942926 (patch) | |
tree | 85dcaaf5be2498a60afe399a597f9c03e3af0393 /src | |
parent | 3d1edffe770f157afaf543cad6f7256637af6088 (diff) | |
download | libssh-1da5c94b44ea2610450aacda24d9789859942926.tar.gz libssh-1da5c94b44ea2610450aacda24d9789859942926.tar.xz libssh-1da5c94b44ea2610450aacda24d9789859942926.zip |
client: If SSHv1 is disabled send the banner immediately
This saves a round-trip with SSHv2 connecting to the server. See RFC
4253 section 5.2 (New Client, Old Server).
Thanks to Yang Yubo <yang@yangyubo.com> for the suggestion.
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/client.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/client.c b/src/client.c index 8514624c..3b120bbc 100644 --- a/src/client.c +++ b/src/client.c @@ -386,7 +386,13 @@ static void ssh_client_connection_callback(ssh_session session){ switch(session->session_state){ case SSH_SESSION_STATE_NONE: case SSH_SESSION_STATE_CONNECTING: + break; case SSH_SESSION_STATE_SOCKET_CONNECTED: + /* If SSHv1 is disabled, we can send the banner immedietly */ + if (session->opts.ssh1 == 0) { + ssh_set_fd_towrite(session); + ssh_send_banner(session, 0); + } break; case SSH_SESSION_STATE_BANNER_RECEIVED: if (session->serverbanner == NULL) { @@ -433,7 +439,9 @@ static void ssh_client_connection_callback(ssh_session session){ #endif ssh_packet_set_default_callbacks(session); session->session_state=SSH_SESSION_STATE_INITIAL_KEX; - ssh_send_banner(session, 0); + if (session->opts.ssh1 == 1) { + ssh_send_banner(session, 0); + } set_status(session, 0.5f); break; case SSH_SESSION_STATE_INITIAL_KEX: |