diff options
author | milo <milo@r0ot.me> | 2010-08-08 22:52:09 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cynapses.org> | 2010-08-09 20:53:56 +0200 |
commit | 23c745d3350f875ae5f7646ae1d370d8dfd9ca8a (patch) | |
tree | 6e934bbf627fc5d19fcfc9cd8abda8cf81198d33 /libssh | |
parent | eb361626cbc782bb65aa536fb22c5d100fdefdaf (diff) | |
download | libssh-23c745d3350f875ae5f7646ae1d370d8dfd9ca8a.tar.gz libssh-23c745d3350f875ae5f7646ae1d370d8dfd9ca8a.tar.xz libssh-23c745d3350f875ae5f7646ae1d370d8dfd9ca8a.zip |
kex: Fixed initialization of server kex.
Signed-off-by: Andreas Schneider <asn@cynapses.org>
Diffstat (limited to 'libssh')
-rw-r--r-- | libssh/kex.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/libssh/kex.c b/libssh/kex.c index 4bb7e38..d57273e 100644 --- a/libssh/kex.c +++ b/libssh/kex.c @@ -260,14 +260,26 @@ SSH_PACKET_CALLBACK(ssh_packet_kexinit){ ssh_set_error(session,SSH_FATAL,"SSH_KEXINIT received in wrong state"); goto error; } - if (buffer_get_data(packet,session->server_kex.cookie,16) != 16) { - ssh_set_error(session, SSH_FATAL, "ssh_packet_kexinit: no cookie in packet"); - goto error; - } + if (server_kex) { + if (buffer_get_data(packet,session->client_kex.cookie,16) != 16) { + ssh_set_error(session, SSH_FATAL, "ssh_packet_kexinit: no cookie in packet"); + goto error; + } - if (hashbufin_add_cookie(session, session->server_kex.cookie) < 0) { - ssh_set_error(session, SSH_FATAL, "ssh_packet_kexinit: adding cookie failed"); - goto error; + if (hashbufin_add_cookie(session, session->client_kex.cookie) < 0) { + ssh_set_error(session, SSH_FATAL, "ssh_packet_kexinit: adding cookie failed"); + goto error; + } + } else { + if (buffer_get_data(packet,session->server_kex.cookie,16) != 16) { + ssh_set_error(session, SSH_FATAL, "ssh_packet_kexinit: no cookie in packet"); + goto error; + } + + if (hashbufin_add_cookie(session, session->server_kex.cookie) < 0) { + ssh_set_error(session, SSH_FATAL, "ssh_packet_kexinit: adding cookie failed"); + goto error; + } } memset(strings, 0, sizeof(char *) * 10); |