diff options
author | markus@openbsd.org <markus@openbsd.org> | 2015-01-19 20:16:15 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2015-01-20 09:19:39 +1100 |
commit | 57d10cbe861a235dd269c74fb2fe248469ecee9d (patch) | |
tree | c65deed24700490bd3b20300c4829d4d5466ff6d /ssh-keyscan.c | |
parent | 3fdc88a0def4f86aa88a5846ac079dc964c0546a (diff) |
upstream commit
adapt kex to sshbuf and struct ssh; ok djm@
Diffstat (limited to 'ssh-keyscan.c')
-rw-r--r-- | ssh-keyscan.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/ssh-keyscan.c b/ssh-keyscan.c index 84301b6ff..223ac58f1 100644 --- a/ssh-keyscan.c +++ b/ssh-keyscan.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssh-keyscan.c,v 1.93 2014/12/11 08:20:09 djm Exp $ */ | 1 | /* $OpenBSD: ssh-keyscan.c,v 1.94 2015/01/19 20:16:15 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. | 3 | * Copyright 1995, 1996 by David Mazieres <dm@lcs.mit.edu>. |
4 | * | 4 | * |
@@ -100,7 +100,7 @@ typedef struct Connection { | |||
100 | char *c_namelist; /* Pointer to other possible addresses */ | 100 | char *c_namelist; /* Pointer to other possible addresses */ |
101 | char *c_output_name; /* Hostname of connection for output */ | 101 | char *c_output_name; /* Hostname of connection for output */ |
102 | char *c_data; /* Data read from this fd */ | 102 | char *c_data; /* Data read from this fd */ |
103 | Kex *c_kex; /* The key-exchange struct for ssh2 */ | 103 | struct kex *c_kex; /* The key-exchange struct for ssh2 */ |
104 | struct timeval c_tv; /* Time at which connection gets aborted */ | 104 | struct timeval c_tv; /* Time at which connection gets aborted */ |
105 | TAILQ_ENTRY(Connection) c_link; /* List of connections in timeout order. */ | 105 | TAILQ_ENTRY(Connection) c_link; /* List of connections in timeout order. */ |
106 | } con; | 106 | } con; |
@@ -221,7 +221,7 @@ keygrab_ssh1(con *c) | |||
221 | #endif | 221 | #endif |
222 | 222 | ||
223 | static int | 223 | static int |
224 | hostjump(Key *hostkey) | 224 | hostjump(Key *hostkey, struct ssh *ssh) |
225 | { | 225 | { |
226 | kexjmp_key = hostkey; | 226 | kexjmp_key = hostkey; |
227 | longjmp(kexjmp, 1); | 227 | longjmp(kexjmp, 1); |
@@ -247,7 +247,7 @@ static Key * | |||
247 | keygrab_ssh2(con *c) | 247 | keygrab_ssh2(con *c) |
248 | { | 248 | { |
249 | char *myproposal[PROPOSAL_MAX] = { KEX_CLIENT }; | 249 | char *myproposal[PROPOSAL_MAX] = { KEX_CLIENT }; |
250 | int j; | 250 | int r, j; |
251 | 251 | ||
252 | packet_set_connection(c->c_fd, c->c_fd); | 252 | packet_set_connection(c->c_fd, c->c_fd); |
253 | enable_compat20(); | 253 | enable_compat20(); |
@@ -256,7 +256,9 @@ keygrab_ssh2(con *c) | |||
256 | (c->c_keytype == KT_RSA ? "ssh-rsa" : | 256 | (c->c_keytype == KT_RSA ? "ssh-rsa" : |
257 | (c->c_keytype == KT_ED25519 ? "ssh-ed25519" : | 257 | (c->c_keytype == KT_ED25519 ? "ssh-ed25519" : |
258 | "ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521")); | 258 | "ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521")); |
259 | c->c_kex = kex_setup(myproposal); | 259 | if ((r = kex_setup(active_state, myproposal)) < 0) |
260 | fatal("%s: kex_setup: %s", __func__, ssh_err(r)); | ||
261 | c->c_kex = active_state->kex; | ||
260 | #ifdef WITH_OPENSSL | 262 | #ifdef WITH_OPENSSL |
261 | c->c_kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client; | 263 | c->c_kex->kex[KEX_DH_GRP1_SHA1] = kexdh_client; |
262 | c->c_kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client; | 264 | c->c_kex->kex[KEX_DH_GRP14_SHA1] = kexdh_client; |
@@ -269,7 +271,7 @@ keygrab_ssh2(con *c) | |||
269 | 271 | ||
270 | if (!(j = setjmp(kexjmp))) { | 272 | if (!(j = setjmp(kexjmp))) { |
271 | nonfatal_fatal = 1; | 273 | nonfatal_fatal = 1; |
272 | dispatch_run(DISPATCH_BLOCK, &c->c_kex->done, c->c_kex); | 274 | dispatch_run(DISPATCH_BLOCK, &c->c_kex->done, active_state); |
273 | fprintf(stderr, "Impossible! dispatch_run() returned!\n"); | 275 | fprintf(stderr, "Impossible! dispatch_run() returned!\n"); |
274 | exit(1); | 276 | exit(1); |
275 | } | 277 | } |