diff options
-rw-r--r-- | auth2-chall.c | 7 | ||||
-rw-r--r-- | auth2-gss.c | 22 | ||||
-rw-r--r-- | auth2.c | 12 | ||||
-rw-r--r-- | channels.c | 37 | ||||
-rw-r--r-- | channels.h | 22 | ||||
-rw-r--r-- | clientloop.c | 12 | ||||
-rw-r--r-- | dispatch.c | 7 | ||||
-rw-r--r-- | dispatch.h | 8 | ||||
-rw-r--r-- | kex.c | 16 | ||||
-rw-r--r-- | kex.h | 6 | ||||
-rw-r--r-- | kexdhc.c | 7 | ||||
-rw-r--r-- | kexdhs.c | 7 | ||||
-rw-r--r-- | kexecdhc.c | 7 | ||||
-rw-r--r-- | kexecdhs.c | 7 | ||||
-rw-r--r-- | kexgexc.c | 12 | ||||
-rw-r--r-- | kexgexs.c | 12 | ||||
-rw-r--r-- | serverloop.c | 10 | ||||
-rw-r--r-- | sshconnect2.c | 72 |
18 files changed, 127 insertions, 156 deletions
diff --git a/auth2-chall.c b/auth2-chall.c index 80f212287..954eb4e18 100644 --- a/auth2-chall.c +++ b/auth2-chall.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth2-chall.c,v 1.46 2017/05/30 14:18:15 markus Exp $ */ | 1 | /* $OpenBSD: auth2-chall.c,v 1.47 2017/05/30 14:23:52 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2001 Per Allansson. All rights reserved. | 4 | * Copyright (c) 2001 Per Allansson. All rights reserved. |
@@ -49,7 +49,7 @@ extern ServerOptions options; | |||
49 | 49 | ||
50 | static int auth2_challenge_start(Authctxt *); | 50 | static int auth2_challenge_start(Authctxt *); |
51 | static int send_userauth_info_request(Authctxt *); | 51 | static int send_userauth_info_request(Authctxt *); |
52 | static int input_userauth_info_response(int, u_int32_t, void *); | 52 | static int input_userauth_info_response(int, u_int32_t, struct ssh *); |
53 | 53 | ||
54 | #ifdef BSD_AUTH | 54 | #ifdef BSD_AUTH |
55 | extern KbdintDevice bsdauth_device; | 55 | extern KbdintDevice bsdauth_device; |
@@ -285,9 +285,8 @@ send_userauth_info_request(Authctxt *authctxt) | |||
285 | } | 285 | } |
286 | 286 | ||
287 | static int | 287 | static int |
288 | input_userauth_info_response(int type, u_int32_t seq, void *ctxt) | 288 | input_userauth_info_response(int type, u_int32_t seq, struct ssh *ssh) |
289 | { | 289 | { |
290 | struct ssh *ssh = ctxt; | ||
291 | Authctxt *authctxt = ssh->authctxt; | 290 | Authctxt *authctxt = ssh->authctxt; |
292 | KbdintAuthctxt *kbdintctxt; | 291 | KbdintAuthctxt *kbdintctxt; |
293 | int authenticated = 0, res; | 292 | int authenticated = 0, res; |
diff --git a/auth2-gss.c b/auth2-gss.c index 5bfcb9b46..a762747d6 100644 --- a/auth2-gss.c +++ b/auth2-gss.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth2-gss.c,v 1.23 2017/05/30 14:18:15 markus Exp $ */ | 1 | /* $OpenBSD: auth2-gss.c,v 1.24 2017/05/30 14:23:52 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. | 4 | * Copyright (c) 2001-2003 Simon Wilkinson. All rights reserved. |
@@ -48,10 +48,10 @@ | |||
48 | 48 | ||
49 | extern ServerOptions options; | 49 | extern ServerOptions options; |
50 | 50 | ||
51 | static int input_gssapi_token(int type, u_int32_t plen, void *ctxt); | 51 | static int input_gssapi_token(int type, u_int32_t plen, struct ssh *ssh); |
52 | static int input_gssapi_mic(int type, u_int32_t plen, void *ctxt); | 52 | static int input_gssapi_mic(int type, u_int32_t plen, struct ssh *ssh); |
53 | static int input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt); | 53 | static int input_gssapi_exchange_complete(int type, u_int32_t plen, struct ssh *ssh); |
54 | static int input_gssapi_errtok(int, u_int32_t, void *); | 54 | static int input_gssapi_errtok(int, u_int32_t, struct ssh *); |
55 | 55 | ||
56 | /* | 56 | /* |
57 | * We only support those mechanisms that we know about (ie ones that we know | 57 | * We only support those mechanisms that we know about (ie ones that we know |
@@ -127,9 +127,8 @@ userauth_gssapi(Authctxt *authctxt) | |||
127 | } | 127 | } |
128 | 128 | ||
129 | static int | 129 | static int |
130 | input_gssapi_token(int type, u_int32_t plen, void *ctxt) | 130 | input_gssapi_token(int type, u_int32_t plen, struct ssh *ssh) |
131 | { | 131 | { |
132 | struct ssh *ssh = ctxt; | ||
133 | Authctxt *authctxt = ssh->authctxt; | 132 | Authctxt *authctxt = ssh->authctxt; |
134 | Gssctxt *gssctxt; | 133 | Gssctxt *gssctxt; |
135 | gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; | 134 | gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; |
@@ -183,9 +182,8 @@ input_gssapi_token(int type, u_int32_t plen, void *ctxt) | |||
183 | } | 182 | } |
184 | 183 | ||
185 | static int | 184 | static int |
186 | input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) | 185 | input_gssapi_errtok(int type, u_int32_t plen, struct ssh *ssh) |
187 | { | 186 | { |
188 | struct ssh *ssh = ctxt; | ||
189 | Authctxt *authctxt = ssh->authctxt; | 187 | Authctxt *authctxt = ssh->authctxt; |
190 | Gssctxt *gssctxt; | 188 | Gssctxt *gssctxt; |
191 | gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; | 189 | gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; |
@@ -225,9 +223,8 @@ input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) | |||
225 | */ | 223 | */ |
226 | 224 | ||
227 | static int | 225 | static int |
228 | input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt) | 226 | input_gssapi_exchange_complete(int type, u_int32_t plen, struct ssh *ssh) |
229 | { | 227 | { |
230 | struct ssh *ssh = ctxt; | ||
231 | Authctxt *authctxt = ssh->authctxt; | 228 | Authctxt *authctxt = ssh->authctxt; |
232 | int authenticated; | 229 | int authenticated; |
233 | 230 | ||
@@ -253,9 +250,8 @@ input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt) | |||
253 | } | 250 | } |
254 | 251 | ||
255 | static int | 252 | static int |
256 | input_gssapi_mic(int type, u_int32_t plen, void *ctxt) | 253 | input_gssapi_mic(int type, u_int32_t plen, struct ssh *ssh) |
257 | { | 254 | { |
258 | struct ssh *ssh = ctxt; | ||
259 | Authctxt *authctxt = ssh->authctxt; | 255 | Authctxt *authctxt = ssh->authctxt; |
260 | Gssctxt *gssctxt; | 256 | Gssctxt *gssctxt; |
261 | int authenticated = 0; | 257 | int authenticated = 0; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth2.c,v 1.138 2017/05/30 14:18:15 markus Exp $ */ | 1 | /* $OpenBSD: auth2.c,v 1.139 2017/05/30 14:23:52 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -87,8 +87,8 @@ Authmethod *authmethods[] = { | |||
87 | 87 | ||
88 | /* protocol */ | 88 | /* protocol */ |
89 | 89 | ||
90 | static int input_service_request(int, u_int32_t, void *); | 90 | static int input_service_request(int, u_int32_t, struct ssh *); |
91 | static int input_userauth_request(int, u_int32_t, void *); | 91 | static int input_userauth_request(int, u_int32_t, struct ssh *); |
92 | 92 | ||
93 | /* helper */ | 93 | /* helper */ |
94 | static Authmethod *authmethod_lookup(Authctxt *, const char *); | 94 | static Authmethod *authmethod_lookup(Authctxt *, const char *); |
@@ -178,9 +178,8 @@ do_authentication2(Authctxt *authctxt) | |||
178 | 178 | ||
179 | /*ARGSUSED*/ | 179 | /*ARGSUSED*/ |
180 | static int | 180 | static int |
181 | input_service_request(int type, u_int32_t seq, void *ctxt) | 181 | input_service_request(int type, u_int32_t seq, struct ssh *ssh) |
182 | { | 182 | { |
183 | struct ssh *ssh = ctxt; | ||
184 | Authctxt *authctxt = ssh->authctxt; | 183 | Authctxt *authctxt = ssh->authctxt; |
185 | u_int len; | 184 | u_int len; |
186 | int acceptit = 0; | 185 | int acceptit = 0; |
@@ -214,9 +213,8 @@ input_service_request(int type, u_int32_t seq, void *ctxt) | |||
214 | 213 | ||
215 | /*ARGSUSED*/ | 214 | /*ARGSUSED*/ |
216 | static int | 215 | static int |
217 | input_userauth_request(int type, u_int32_t seq, void *ctxt) | 216 | input_userauth_request(int type, u_int32_t seq, struct ssh *ssh) |
218 | { | 217 | { |
219 | struct ssh *ssh = ctxt; | ||
220 | Authctxt *authctxt = ssh->authctxt; | 218 | Authctxt *authctxt = ssh->authctxt; |
221 | Authmethod *m = NULL; | 219 | Authmethod *m = NULL; |
222 | char *user, *service, *method, *style = NULL; | 220 | char *user, *service, *method, *style = NULL; |
diff --git a/channels.c b/channels.c index e7de370d4..d118d8ff7 100644 --- a/channels.c +++ b/channels.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: channels.c,v 1.362 2017/05/30 08:49:58 markus Exp $ */ | 1 | /* $OpenBSD: channels.c,v 1.363 2017/05/30 14:23:52 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -2394,9 +2394,8 @@ channel_proxy_downstream(Channel *downstream) | |||
2394 | * replaces local (proxy) channel ID with downstream channel ID. | 2394 | * replaces local (proxy) channel ID with downstream channel ID. |
2395 | */ | 2395 | */ |
2396 | int | 2396 | int |
2397 | channel_proxy_upstream(Channel *c, int type, u_int32_t seq, void *ctxt) | 2397 | channel_proxy_upstream(Channel *c, int type, u_int32_t seq, struct ssh *ssh) |
2398 | { | 2398 | { |
2399 | struct ssh *ssh = active_state; | ||
2400 | struct sshbuf *b = NULL; | 2399 | struct sshbuf *b = NULL; |
2401 | Channel *downstream; | 2400 | Channel *downstream; |
2402 | const u_char *cp = NULL; | 2401 | const u_char *cp = NULL; |
@@ -2476,7 +2475,7 @@ channel_proxy_upstream(Channel *c, int type, u_int32_t seq, void *ctxt) | |||
2476 | 2475 | ||
2477 | /* ARGSUSED */ | 2476 | /* ARGSUSED */ |
2478 | int | 2477 | int |
2479 | channel_input_data(int type, u_int32_t seq, void *ctxt) | 2478 | channel_input_data(int type, u_int32_t seq, struct ssh *ssh) |
2480 | { | 2479 | { |
2481 | int id; | 2480 | int id; |
2482 | const u_char *data; | 2481 | const u_char *data; |
@@ -2488,7 +2487,7 @@ channel_input_data(int type, u_int32_t seq, void *ctxt) | |||
2488 | c = channel_lookup(id); | 2487 | c = channel_lookup(id); |
2489 | if (c == NULL) | 2488 | if (c == NULL) |
2490 | packet_disconnect("Received data for nonexistent channel %d.", id); | 2489 | packet_disconnect("Received data for nonexistent channel %d.", id); |
2491 | if (channel_proxy_upstream(c, type, seq, ctxt)) | 2490 | if (channel_proxy_upstream(c, type, seq, ssh)) |
2492 | return 0; | 2491 | return 0; |
2493 | 2492 | ||
2494 | /* Ignore any data for non-open channels (might happen on close) */ | 2493 | /* Ignore any data for non-open channels (might happen on close) */ |
@@ -2536,7 +2535,7 @@ channel_input_data(int type, u_int32_t seq, void *ctxt) | |||
2536 | 2535 | ||
2537 | /* ARGSUSED */ | 2536 | /* ARGSUSED */ |
2538 | int | 2537 | int |
2539 | channel_input_extended_data(int type, u_int32_t seq, void *ctxt) | 2538 | channel_input_extended_data(int type, u_int32_t seq, struct ssh *ssh) |
2540 | { | 2539 | { |
2541 | int id; | 2540 | int id; |
2542 | char *data; | 2541 | char *data; |
@@ -2549,7 +2548,7 @@ channel_input_extended_data(int type, u_int32_t seq, void *ctxt) | |||
2549 | 2548 | ||
2550 | if (c == NULL) | 2549 | if (c == NULL) |
2551 | packet_disconnect("Received extended_data for bad channel %d.", id); | 2550 | packet_disconnect("Received extended_data for bad channel %d.", id); |
2552 | if (channel_proxy_upstream(c, type, seq, ctxt)) | 2551 | if (channel_proxy_upstream(c, type, seq, ssh)) |
2553 | return 0; | 2552 | return 0; |
2554 | if (c->type != SSH_CHANNEL_OPEN) { | 2553 | if (c->type != SSH_CHANNEL_OPEN) { |
2555 | logit("channel %d: ext data for non open", id); | 2554 | logit("channel %d: ext data for non open", id); |
@@ -2586,7 +2585,7 @@ channel_input_extended_data(int type, u_int32_t seq, void *ctxt) | |||
2586 | 2585 | ||
2587 | /* ARGSUSED */ | 2586 | /* ARGSUSED */ |
2588 | int | 2587 | int |
2589 | channel_input_ieof(int type, u_int32_t seq, void *ctxt) | 2588 | channel_input_ieof(int type, u_int32_t seq, struct ssh *ssh) |
2590 | { | 2589 | { |
2591 | int id; | 2590 | int id; |
2592 | Channel *c; | 2591 | Channel *c; |
@@ -2596,7 +2595,7 @@ channel_input_ieof(int type, u_int32_t seq, void *ctxt) | |||
2596 | c = channel_lookup(id); | 2595 | c = channel_lookup(id); |
2597 | if (c == NULL) | 2596 | if (c == NULL) |
2598 | packet_disconnect("Received ieof for nonexistent channel %d.", id); | 2597 | packet_disconnect("Received ieof for nonexistent channel %d.", id); |
2599 | if (channel_proxy_upstream(c, type, seq, ctxt)) | 2598 | if (channel_proxy_upstream(c, type, seq, ssh)) |
2600 | return 0; | 2599 | return 0; |
2601 | chan_rcvd_ieof(c); | 2600 | chan_rcvd_ieof(c); |
2602 | 2601 | ||
@@ -2612,14 +2611,14 @@ channel_input_ieof(int type, u_int32_t seq, void *ctxt) | |||
2612 | 2611 | ||
2613 | /* ARGSUSED */ | 2612 | /* ARGSUSED */ |
2614 | int | 2613 | int |
2615 | channel_input_oclose(int type, u_int32_t seq, void *ctxt) | 2614 | channel_input_oclose(int type, u_int32_t seq, struct ssh *ssh) |
2616 | { | 2615 | { |
2617 | int id = packet_get_int(); | 2616 | int id = packet_get_int(); |
2618 | Channel *c = channel_lookup(id); | 2617 | Channel *c = channel_lookup(id); |
2619 | 2618 | ||
2620 | if (c == NULL) | 2619 | if (c == NULL) |
2621 | packet_disconnect("Received oclose for nonexistent channel %d.", id); | 2620 | packet_disconnect("Received oclose for nonexistent channel %d.", id); |
2622 | if (channel_proxy_upstream(c, type, seq, ctxt)) | 2621 | if (channel_proxy_upstream(c, type, seq, ssh)) |
2623 | return 0; | 2622 | return 0; |
2624 | packet_check_eom(); | 2623 | packet_check_eom(); |
2625 | chan_rcvd_oclose(c); | 2624 | chan_rcvd_oclose(c); |
@@ -2628,7 +2627,7 @@ channel_input_oclose(int type, u_int32_t seq, void *ctxt) | |||
2628 | 2627 | ||
2629 | /* ARGSUSED */ | 2628 | /* ARGSUSED */ |
2630 | int | 2629 | int |
2631 | channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt) | 2630 | channel_input_open_confirmation(int type, u_int32_t seq, struct ssh *ssh) |
2632 | { | 2631 | { |
2633 | int id, remote_id; | 2632 | int id, remote_id; |
2634 | Channel *c; | 2633 | Channel *c; |
@@ -2639,7 +2638,7 @@ channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt) | |||
2639 | if (c==NULL) | 2638 | if (c==NULL) |
2640 | packet_disconnect("Received open confirmation for " | 2639 | packet_disconnect("Received open confirmation for " |
2641 | "unknown channel %d.", id); | 2640 | "unknown channel %d.", id); |
2642 | if (channel_proxy_upstream(c, type, seq, ctxt)) | 2641 | if (channel_proxy_upstream(c, type, seq, ssh)) |
2643 | return 0; | 2642 | return 0; |
2644 | if (c->type != SSH_CHANNEL_OPENING) | 2643 | if (c->type != SSH_CHANNEL_OPENING) |
2645 | packet_disconnect("Received open confirmation for " | 2644 | packet_disconnect("Received open confirmation for " |
@@ -2680,7 +2679,7 @@ reason2txt(int reason) | |||
2680 | 2679 | ||
2681 | /* ARGSUSED */ | 2680 | /* ARGSUSED */ |
2682 | int | 2681 | int |
2683 | channel_input_open_failure(int type, u_int32_t seq, void *ctxt) | 2682 | channel_input_open_failure(int type, u_int32_t seq, struct ssh *ssh) |
2684 | { | 2683 | { |
2685 | int id, reason; | 2684 | int id, reason; |
2686 | char *msg = NULL, *lang = NULL; | 2685 | char *msg = NULL, *lang = NULL; |
@@ -2692,7 +2691,7 @@ channel_input_open_failure(int type, u_int32_t seq, void *ctxt) | |||
2692 | if (c==NULL) | 2691 | if (c==NULL) |
2693 | packet_disconnect("Received open failure for " | 2692 | packet_disconnect("Received open failure for " |
2694 | "unknown channel %d.", id); | 2693 | "unknown channel %d.", id); |
2695 | if (channel_proxy_upstream(c, type, seq, ctxt)) | 2694 | if (channel_proxy_upstream(c, type, seq, ssh)) |
2696 | return 0; | 2695 | return 0; |
2697 | if (c->type != SSH_CHANNEL_OPENING) | 2696 | if (c->type != SSH_CHANNEL_OPENING) |
2698 | packet_disconnect("Received open failure for " | 2697 | packet_disconnect("Received open failure for " |
@@ -2719,7 +2718,7 @@ channel_input_open_failure(int type, u_int32_t seq, void *ctxt) | |||
2719 | 2718 | ||
2720 | /* ARGSUSED */ | 2719 | /* ARGSUSED */ |
2721 | int | 2720 | int |
2722 | channel_input_window_adjust(int type, u_int32_t seq, void *ctxt) | 2721 | channel_input_window_adjust(int type, u_int32_t seq, struct ssh *ssh) |
2723 | { | 2722 | { |
2724 | Channel *c; | 2723 | Channel *c; |
2725 | int id; | 2724 | int id; |
@@ -2733,7 +2732,7 @@ channel_input_window_adjust(int type, u_int32_t seq, void *ctxt) | |||
2733 | logit("Received window adjust for non-open channel %d.", id); | 2732 | logit("Received window adjust for non-open channel %d.", id); |
2734 | return 0; | 2733 | return 0; |
2735 | } | 2734 | } |
2736 | if (channel_proxy_upstream(c, type, seq, ctxt)) | 2735 | if (channel_proxy_upstream(c, type, seq, ssh)) |
2737 | return 0; | 2736 | return 0; |
2738 | adjust = packet_get_int(); | 2737 | adjust = packet_get_int(); |
2739 | packet_check_eom(); | 2738 | packet_check_eom(); |
@@ -2747,7 +2746,7 @@ channel_input_window_adjust(int type, u_int32_t seq, void *ctxt) | |||
2747 | 2746 | ||
2748 | /* ARGSUSED */ | 2747 | /* ARGSUSED */ |
2749 | int | 2748 | int |
2750 | channel_input_status_confirm(int type, u_int32_t seq, void *ctxt) | 2749 | channel_input_status_confirm(int type, u_int32_t seq, struct ssh *ssh) |
2751 | { | 2750 | { |
2752 | Channel *c; | 2751 | Channel *c; |
2753 | struct channel_confirm *cc; | 2752 | struct channel_confirm *cc; |
@@ -2763,7 +2762,7 @@ channel_input_status_confirm(int type, u_int32_t seq, void *ctxt) | |||
2763 | logit("channel_input_status_confirm: %d: unknown", id); | 2762 | logit("channel_input_status_confirm: %d: unknown", id); |
2764 | return 0; | 2763 | return 0; |
2765 | } | 2764 | } |
2766 | if (channel_proxy_upstream(c, type, seq, ctxt)) | 2765 | if (channel_proxy_upstream(c, type, seq, ssh)) |
2767 | return 0; | 2766 | return 0; |
2768 | packet_check_eom(); | 2767 | packet_check_eom(); |
2769 | if ((cc = TAILQ_FIRST(&c->status_confirms)) == NULL) | 2768 | if ((cc = TAILQ_FIRST(&c->status_confirms)) == NULL) |
diff --git a/channels.h b/channels.h index fa38a4e71..36e5363aa 100644 --- a/channels.h +++ b/channels.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: channels.h,v 1.125 2017/05/26 19:35:50 markus Exp $ */ | 1 | /* $OpenBSD: channels.h,v 1.126 2017/05/30 14:23:52 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -61,6 +61,7 @@ | |||
61 | 61 | ||
62 | #define CHANNEL_CANCEL_PORT_STATIC -1 | 62 | #define CHANNEL_CANCEL_PORT_STATIC -1 |
63 | 63 | ||
64 | struct ssh; | ||
64 | struct Channel; | 65 | struct Channel; |
65 | typedef struct Channel Channel; | 66 | typedef struct Channel Channel; |
66 | 67 | ||
@@ -232,18 +233,19 @@ void channel_send_window_changes(void); | |||
232 | /* mux proxy support */ | 233 | /* mux proxy support */ |
233 | 234 | ||
234 | int channel_proxy_downstream(Channel *mc); | 235 | int channel_proxy_downstream(Channel *mc); |
235 | int channel_proxy_upstream(Channel *, int, u_int32_t, void *); | 236 | int channel_proxy_upstream(Channel *, int, u_int32_t, struct ssh *); |
236 | 237 | ||
237 | /* protocol handler */ | 238 | /* protocol handler */ |
238 | 239 | ||
239 | int channel_input_data(int, u_int32_t, void *); | 240 | int channel_input_data(int, u_int32_t, struct ssh *); |
240 | int channel_input_extended_data(int, u_int32_t, void *); | 241 | int channel_input_extended_data(int, u_int32_t, struct ssh *); |
241 | int channel_input_ieof(int, u_int32_t, void *); | 242 | int channel_input_ieof(int, u_int32_t, struct ssh *); |
242 | int channel_input_oclose(int, u_int32_t, void *); | 243 | int channel_input_oclose(int, u_int32_t, struct ssh *); |
243 | int channel_input_open_confirmation(int, u_int32_t, void *); | 244 | int channel_input_open_confirmation(int, u_int32_t, struct ssh *); |
244 | int channel_input_open_failure(int, u_int32_t, void *); | 245 | int channel_input_open_failure(int, u_int32_t, struct ssh *); |
245 | int channel_input_window_adjust(int, u_int32_t, void *); | 246 | int channel_input_port_open(int, u_int32_t, struct ssh *); |
246 | int channel_input_status_confirm(int, u_int32_t, void *); | 247 | int channel_input_window_adjust(int, u_int32_t, struct ssh *); |
248 | int channel_input_status_confirm(int, u_int32_t, struct ssh *); | ||
247 | 249 | ||
248 | /* file descriptor handling (read/write) */ | 250 | /* file descriptor handling (read/write) */ |
249 | 251 | ||
diff --git a/clientloop.c b/clientloop.c index 367b682ff..0020637e8 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: clientloop.c,v 1.296 2017/05/03 21:08:09 naddy Exp $ */ | 1 | /* $OpenBSD: clientloop.c,v 1.297 2017/05/30 14:23:52 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -459,7 +459,7 @@ client_check_window_change(void) | |||
459 | } | 459 | } |
460 | 460 | ||
461 | static int | 461 | static int |
462 | client_global_request_reply(int type, u_int32_t seq, void *ctxt) | 462 | client_global_request_reply(int type, u_int32_t seq, struct ssh *ssh) |
463 | { | 463 | { |
464 | struct global_confirm *gc; | 464 | struct global_confirm *gc; |
465 | 465 | ||
@@ -1642,7 +1642,7 @@ client_request_tun_fwd(int tun_mode, int local_tun, int remote_tun) | |||
1642 | 1642 | ||
1643 | /* XXXX move to generic input handler */ | 1643 | /* XXXX move to generic input handler */ |
1644 | static int | 1644 | static int |
1645 | client_input_channel_open(int type, u_int32_t seq, void *ctxt) | 1645 | client_input_channel_open(int type, u_int32_t seq, struct ssh *ssh) |
1646 | { | 1646 | { |
1647 | Channel *c = NULL; | 1647 | Channel *c = NULL; |
1648 | char *ctype; | 1648 | char *ctype; |
@@ -1698,7 +1698,7 @@ client_input_channel_open(int type, u_int32_t seq, void *ctxt) | |||
1698 | } | 1698 | } |
1699 | 1699 | ||
1700 | static int | 1700 | static int |
1701 | client_input_channel_req(int type, u_int32_t seq, void *ctxt) | 1701 | client_input_channel_req(int type, u_int32_t seq, struct ssh *ssh) |
1702 | { | 1702 | { |
1703 | Channel *c = NULL; | 1703 | Channel *c = NULL; |
1704 | int exitval, id, reply, success = 0; | 1704 | int exitval, id, reply, success = 0; |
@@ -1706,7 +1706,7 @@ client_input_channel_req(int type, u_int32_t seq, void *ctxt) | |||
1706 | 1706 | ||
1707 | id = packet_get_int(); | 1707 | id = packet_get_int(); |
1708 | c = channel_lookup(id); | 1708 | c = channel_lookup(id); |
1709 | if (channel_proxy_upstream(c, type, seq, ctxt)) | 1709 | if (channel_proxy_upstream(c, type, seq, ssh)) |
1710 | return 0; | 1710 | return 0; |
1711 | rtype = packet_get_string(NULL); | 1711 | rtype = packet_get_string(NULL); |
1712 | reply = packet_get_char(); | 1712 | reply = packet_get_char(); |
@@ -2136,7 +2136,7 @@ client_input_hostkeys(void) | |||
2136 | } | 2136 | } |
2137 | 2137 | ||
2138 | static int | 2138 | static int |
2139 | client_input_global_request(int type, u_int32_t seq, void *ctxt) | 2139 | client_input_global_request(int type, u_int32_t seq, struct ssh *ssh) |
2140 | { | 2140 | { |
2141 | char *rtype; | 2141 | char *rtype; |
2142 | int want_reply; | 2142 | int want_reply; |
diff --git a/dispatch.c b/dispatch.c index 7ef9a38c7..5b2fc41ca 100644 --- a/dispatch.c +++ b/dispatch.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dispatch.c,v 1.29 2017/04/30 23:28:42 djm Exp $ */ | 1 | /* $OpenBSD: dispatch.c,v 1.30 2017/05/30 14:23:52 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -38,9 +38,8 @@ | |||
38 | #include "ssherr.h" | 38 | #include "ssherr.h" |
39 | 39 | ||
40 | int | 40 | int |
41 | dispatch_protocol_error(int type, u_int32_t seq, void *ctx) | 41 | dispatch_protocol_error(int type, u_int32_t seq, struct ssh *ssh) |
42 | { | 42 | { |
43 | struct ssh *ssh = active_state; /* XXX */ | ||
44 | int r; | 43 | int r; |
45 | 44 | ||
46 | logit("dispatch_protocol_error: type %d seq %u", type, seq); | 45 | logit("dispatch_protocol_error: type %d seq %u", type, seq); |
@@ -53,7 +52,7 @@ dispatch_protocol_error(int type, u_int32_t seq, void *ctx) | |||
53 | } | 52 | } |
54 | 53 | ||
55 | int | 54 | int |
56 | dispatch_protocol_ignore(int type, u_int32_t seq, void *ssh) | 55 | dispatch_protocol_ignore(int type, u_int32_t seq, struct ssh *ssh) |
57 | { | 56 | { |
58 | logit("dispatch_protocol_ignore: type %d seq %u", type, seq); | 57 | logit("dispatch_protocol_ignore: type %d seq %u", type, seq); |
59 | return 0; | 58 | return 0; |
diff --git a/dispatch.h b/dispatch.h index cd51dbc0b..7dfc74ee3 100644 --- a/dispatch.h +++ b/dispatch.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dispatch.h,v 1.12 2015/01/19 20:07:45 markus Exp $ */ | 1 | /* $OpenBSD: dispatch.h,v 1.13 2017/05/30 14:23:52 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -36,10 +36,10 @@ enum { | |||
36 | 36 | ||
37 | struct ssh; | 37 | struct ssh; |
38 | 38 | ||
39 | typedef int dispatch_fn(int, u_int32_t, void *); | 39 | typedef int dispatch_fn(int, u_int32_t, struct ssh *); |
40 | 40 | ||
41 | int dispatch_protocol_error(int, u_int32_t, void *); | 41 | int dispatch_protocol_error(int, u_int32_t, struct ssh *); |
42 | int dispatch_protocol_ignore(int, u_int32_t, void *); | 42 | int dispatch_protocol_ignore(int, u_int32_t, struct ssh *); |
43 | void ssh_dispatch_init(struct ssh *, dispatch_fn *); | 43 | void ssh_dispatch_init(struct ssh *, dispatch_fn *); |
44 | void ssh_dispatch_set(struct ssh *, int, dispatch_fn *); | 44 | void ssh_dispatch_set(struct ssh *, int, dispatch_fn *); |
45 | void ssh_dispatch_range(struct ssh *, u_int, u_int, dispatch_fn *); | 45 | void ssh_dispatch_range(struct ssh *, u_int, u_int, dispatch_fn *); |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kex.c,v 1.132 2017/04/30 23:10:43 djm Exp $ */ | 1 | /* $OpenBSD: kex.c,v 1.133 2017/05/30 14:23:52 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -56,7 +56,7 @@ | |||
56 | 56 | ||
57 | /* prototype */ | 57 | /* prototype */ |
58 | static int kex_choose_conf(struct ssh *); | 58 | static int kex_choose_conf(struct ssh *); |
59 | static int kex_input_newkeys(int, u_int32_t, void *); | 59 | static int kex_input_newkeys(int, u_int32_t, struct ssh *); |
60 | 60 | ||
61 | static const char *proposal_names[PROPOSAL_MAX] = { | 61 | static const char *proposal_names[PROPOSAL_MAX] = { |
62 | "KEX algorithms", | 62 | "KEX algorithms", |
@@ -315,9 +315,8 @@ kex_prop_free(char **proposal) | |||
315 | 315 | ||
316 | /* ARGSUSED */ | 316 | /* ARGSUSED */ |
317 | static int | 317 | static int |
318 | kex_protocol_error(int type, u_int32_t seq, void *ctxt) | 318 | kex_protocol_error(int type, u_int32_t seq, struct ssh *ssh) |
319 | { | 319 | { |
320 | struct ssh *ssh = active_state; /* XXX */ | ||
321 | int r; | 320 | int r; |
322 | 321 | ||
323 | error("kex protocol error: type %d seq %u", type, seq); | 322 | error("kex protocol error: type %d seq %u", type, seq); |
@@ -375,9 +374,8 @@ kex_send_newkeys(struct ssh *ssh) | |||
375 | } | 374 | } |
376 | 375 | ||
377 | int | 376 | int |
378 | kex_input_ext_info(int type, u_int32_t seq, void *ctxt) | 377 | kex_input_ext_info(int type, u_int32_t seq, struct ssh *ssh) |
379 | { | 378 | { |
380 | struct ssh *ssh = ctxt; | ||
381 | struct kex *kex = ssh->kex; | 379 | struct kex *kex = ssh->kex; |
382 | u_int32_t i, ninfo; | 380 | u_int32_t i, ninfo; |
383 | char *name, *val, *found; | 381 | char *name, *val, *found; |
@@ -414,9 +412,8 @@ kex_input_ext_info(int type, u_int32_t seq, void *ctxt) | |||
414 | } | 412 | } |
415 | 413 | ||
416 | static int | 414 | static int |
417 | kex_input_newkeys(int type, u_int32_t seq, void *ctxt) | 415 | kex_input_newkeys(int type, u_int32_t seq, struct ssh *ssh) |
418 | { | 416 | { |
419 | struct ssh *ssh = ctxt; | ||
420 | struct kex *kex = ssh->kex; | 417 | struct kex *kex = ssh->kex; |
421 | int r; | 418 | int r; |
422 | 419 | ||
@@ -467,9 +464,8 @@ kex_send_kexinit(struct ssh *ssh) | |||
467 | 464 | ||
468 | /* ARGSUSED */ | 465 | /* ARGSUSED */ |
469 | int | 466 | int |
470 | kex_input_kexinit(int type, u_int32_t seq, void *ctxt) | 467 | kex_input_kexinit(int type, u_int32_t seq, struct ssh *ssh) |
471 | { | 468 | { |
472 | struct ssh *ssh = ctxt; | ||
473 | struct kex *kex = ssh->kex; | 469 | struct kex *kex = ssh->kex; |
474 | const u_char *ptr; | 470 | const u_char *ptr; |
475 | u_int i; | 471 | u_int i; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kex.h,v 1.82 2017/05/03 21:08:09 naddy Exp $ */ | 1 | /* $OpenBSD: kex.h,v 1.83 2017/05/30 14:23:52 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000, 2001 Markus Friedl. All rights reserved. |
@@ -181,8 +181,8 @@ int kex_prop2buf(struct sshbuf *, char *proposal[PROPOSAL_MAX]); | |||
181 | void kex_prop_free(char **); | 181 | void kex_prop_free(char **); |
182 | 182 | ||
183 | int kex_send_kexinit(struct ssh *); | 183 | int kex_send_kexinit(struct ssh *); |
184 | int kex_input_kexinit(int, u_int32_t, void *); | 184 | int kex_input_kexinit(int, u_int32_t, struct ssh *); |
185 | int kex_input_ext_info(int, u_int32_t, void *); | 185 | int kex_input_ext_info(int, u_int32_t, struct ssh *); |
186 | int kex_derive_keys(struct ssh *, u_char *, u_int, const struct sshbuf *); | 186 | int kex_derive_keys(struct ssh *, u_char *, u_int, const struct sshbuf *); |
187 | int kex_derive_keys_bn(struct ssh *, u_char *, u_int, const BIGNUM *); | 187 | int kex_derive_keys_bn(struct ssh *, u_char *, u_int, const BIGNUM *); |
188 | int kex_send_newkeys(struct ssh *); | 188 | int kex_send_newkeys(struct ssh *); |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kexdhc.c,v 1.19 2016/05/02 10:26:04 djm Exp $ */ | 1 | /* $OpenBSD: kexdhc.c,v 1.20 2017/05/30 14:23:52 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -49,7 +49,7 @@ | |||
49 | #include "ssherr.h" | 49 | #include "ssherr.h" |
50 | #include "sshbuf.h" | 50 | #include "sshbuf.h" |
51 | 51 | ||
52 | static int input_kex_dh(int, u_int32_t, void *); | 52 | static int input_kex_dh(int, u_int32_t, struct ssh *); |
53 | 53 | ||
54 | int | 54 | int |
55 | kexdh_client(struct ssh *ssh) | 55 | kexdh_client(struct ssh *ssh) |
@@ -100,9 +100,8 @@ kexdh_client(struct ssh *ssh) | |||
100 | } | 100 | } |
101 | 101 | ||
102 | static int | 102 | static int |
103 | input_kex_dh(int type, u_int32_t seq, void *ctxt) | 103 | input_kex_dh(int type, u_int32_t seq, struct ssh *ssh) |
104 | { | 104 | { |
105 | struct ssh *ssh = ctxt; | ||
106 | struct kex *kex = ssh->kex; | 105 | struct kex *kex = ssh->kex; |
107 | BIGNUM *dh_server_pub = NULL, *shared_secret = NULL; | 106 | BIGNUM *dh_server_pub = NULL, *shared_secret = NULL; |
108 | struct sshkey *server_host_key = NULL; | 107 | struct sshkey *server_host_key = NULL; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kexdhs.c,v 1.24 2016/05/02 10:26:04 djm Exp $ */ | 1 | /* $OpenBSD: kexdhs.c,v 1.25 2017/05/30 14:23:52 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -49,7 +49,7 @@ | |||
49 | #include "ssherr.h" | 49 | #include "ssherr.h" |
50 | #include "sshbuf.h" | 50 | #include "sshbuf.h" |
51 | 51 | ||
52 | static int input_kex_dh_init(int, u_int32_t, void *); | 52 | static int input_kex_dh_init(int, u_int32_t, struct ssh *); |
53 | 53 | ||
54 | int | 54 | int |
55 | kexdh_server(struct ssh *ssh) | 55 | kexdh_server(struct ssh *ssh) |
@@ -91,9 +91,8 @@ kexdh_server(struct ssh *ssh) | |||
91 | } | 91 | } |
92 | 92 | ||
93 | int | 93 | int |
94 | input_kex_dh_init(int type, u_int32_t seq, void *ctxt) | 94 | input_kex_dh_init(int type, u_int32_t seq, struct ssh *ssh) |
95 | { | 95 | { |
96 | struct ssh *ssh = ctxt; | ||
97 | struct kex *kex = ssh->kex; | 96 | struct kex *kex = ssh->kex; |
98 | BIGNUM *shared_secret = NULL, *dh_client_pub = NULL; | 97 | BIGNUM *shared_secret = NULL, *dh_client_pub = NULL; |
99 | struct sshkey *server_host_public, *server_host_private; | 98 | struct sshkey *server_host_public, *server_host_private; |
diff --git a/kexecdhc.c b/kexecdhc.c index 90220ce82..d8a8b660f 100644 --- a/kexecdhc.c +++ b/kexecdhc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kexecdhc.c,v 1.10 2015/01/26 06:10:03 djm Exp $ */ | 1 | /* $OpenBSD: kexecdhc.c,v 1.11 2017/05/30 14:23:52 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2010 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2010 Damien Miller. All rights reserved. |
@@ -49,7 +49,7 @@ | |||
49 | #include "ssherr.h" | 49 | #include "ssherr.h" |
50 | #include "sshbuf.h" | 50 | #include "sshbuf.h" |
51 | 51 | ||
52 | static int input_kex_ecdh_reply(int, u_int32_t, void *); | 52 | static int input_kex_ecdh_reply(int, u_int32_t, struct ssh *); |
53 | 53 | ||
54 | int | 54 | int |
55 | kexecdh_client(struct ssh *ssh) | 55 | kexecdh_client(struct ssh *ssh) |
@@ -95,9 +95,8 @@ kexecdh_client(struct ssh *ssh) | |||
95 | } | 95 | } |
96 | 96 | ||
97 | static int | 97 | static int |
98 | input_kex_ecdh_reply(int type, u_int32_t seq, void *ctxt) | 98 | input_kex_ecdh_reply(int type, u_int32_t seq, struct ssh *ssh) |
99 | { | 99 | { |
100 | struct ssh *ssh = ctxt; | ||
101 | struct kex *kex = ssh->kex; | 100 | struct kex *kex = ssh->kex; |
102 | const EC_GROUP *group; | 101 | const EC_GROUP *group; |
103 | EC_POINT *server_public = NULL; | 102 | EC_POINT *server_public = NULL; |
diff --git a/kexecdhs.c b/kexecdhs.c index ccdbf70b1..dc24a3af6 100644 --- a/kexecdhs.c +++ b/kexecdhs.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kexecdhs.c,v 1.15 2015/12/04 16:41:28 markus Exp $ */ | 1 | /* $OpenBSD: kexecdhs.c,v 1.16 2017/05/30 14:23:52 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2010 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2010 Damien Miller. All rights reserved. |
@@ -47,7 +47,7 @@ | |||
47 | #include "ssherr.h" | 47 | #include "ssherr.h" |
48 | #include "sshbuf.h" | 48 | #include "sshbuf.h" |
49 | 49 | ||
50 | static int input_kex_ecdh_init(int, u_int32_t, void *); | 50 | static int input_kex_ecdh_init(int, u_int32_t, struct ssh *); |
51 | 51 | ||
52 | int | 52 | int |
53 | kexecdh_server(struct ssh *ssh) | 53 | kexecdh_server(struct ssh *ssh) |
@@ -58,9 +58,8 @@ kexecdh_server(struct ssh *ssh) | |||
58 | } | 58 | } |
59 | 59 | ||
60 | static int | 60 | static int |
61 | input_kex_ecdh_init(int type, u_int32_t seq, void *ctxt) | 61 | input_kex_ecdh_init(int type, u_int32_t seq, struct ssh *ssh) |
62 | { | 62 | { |
63 | struct ssh *ssh = ctxt; | ||
64 | struct kex *kex = ssh->kex; | 63 | struct kex *kex = ssh->kex; |
65 | EC_POINT *client_public; | 64 | EC_POINT *client_public; |
66 | EC_KEY *server_key = NULL; | 65 | EC_KEY *server_key = NULL; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kexgexc.c,v 1.24 2017/05/16 16:56:15 djm Exp $ */ | 1 | /* $OpenBSD: kexgexc.c,v 1.25 2017/05/30 14:23:52 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Niels Provos. All rights reserved. | 3 | * Copyright (c) 2000 Niels Provos. All rights reserved. |
4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
@@ -51,8 +51,8 @@ | |||
51 | #include "sshbuf.h" | 51 | #include "sshbuf.h" |
52 | #include "misc.h" | 52 | #include "misc.h" |
53 | 53 | ||
54 | static int input_kex_dh_gex_group(int, u_int32_t, void *); | 54 | static int input_kex_dh_gex_group(int, u_int32_t, struct ssh *); |
55 | static int input_kex_dh_gex_reply(int, u_int32_t, void *); | 55 | static int input_kex_dh_gex_reply(int, u_int32_t, struct ssh *); |
56 | 56 | ||
57 | int | 57 | int |
58 | kexgex_client(struct ssh *ssh) | 58 | kexgex_client(struct ssh *ssh) |
@@ -89,9 +89,8 @@ kexgex_client(struct ssh *ssh) | |||
89 | } | 89 | } |
90 | 90 | ||
91 | static int | 91 | static int |
92 | input_kex_dh_gex_group(int type, u_int32_t seq, void *ctxt) | 92 | input_kex_dh_gex_group(int type, u_int32_t seq, struct ssh *ssh) |
93 | { | 93 | { |
94 | struct ssh *ssh = ctxt; | ||
95 | struct kex *kex = ssh->kex; | 94 | struct kex *kex = ssh->kex; |
96 | BIGNUM *p = NULL, *g = NULL; | 95 | BIGNUM *p = NULL, *g = NULL; |
97 | int r, bits; | 96 | int r, bits; |
@@ -143,9 +142,8 @@ out: | |||
143 | } | 142 | } |
144 | 143 | ||
145 | static int | 144 | static int |
146 | input_kex_dh_gex_reply(int type, u_int32_t seq, void *ctxt) | 145 | input_kex_dh_gex_reply(int type, u_int32_t seq, struct ssh *ssh) |
147 | { | 146 | { |
148 | struct ssh *ssh = ctxt; | ||
149 | struct kex *kex = ssh->kex; | 147 | struct kex *kex = ssh->kex; |
150 | BIGNUM *dh_server_pub = NULL, *shared_secret = NULL; | 148 | BIGNUM *dh_server_pub = NULL, *shared_secret = NULL; |
151 | struct sshkey *server_host_key = NULL; | 149 | struct sshkey *server_host_key = NULL; |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kexgexs.c,v 1.30 2016/09/12 01:22:38 deraadt Exp $ */ | 1 | /* $OpenBSD: kexgexs.c,v 1.31 2017/05/30 14:23:52 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Niels Provos. All rights reserved. | 3 | * Copyright (c) 2000 Niels Provos. All rights reserved. |
4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2001 Markus Friedl. All rights reserved. |
@@ -54,8 +54,8 @@ | |||
54 | #include "sshbuf.h" | 54 | #include "sshbuf.h" |
55 | #include "misc.h" | 55 | #include "misc.h" |
56 | 56 | ||
57 | static int input_kex_dh_gex_request(int, u_int32_t, void *); | 57 | static int input_kex_dh_gex_request(int, u_int32_t, struct ssh *); |
58 | static int input_kex_dh_gex_init(int, u_int32_t, void *); | 58 | static int input_kex_dh_gex_init(int, u_int32_t, struct ssh *); |
59 | 59 | ||
60 | int | 60 | int |
61 | kexgex_server(struct ssh *ssh) | 61 | kexgex_server(struct ssh *ssh) |
@@ -67,9 +67,8 @@ kexgex_server(struct ssh *ssh) | |||
67 | } | 67 | } |
68 | 68 | ||
69 | static int | 69 | static int |
70 | input_kex_dh_gex_request(int type, u_int32_t seq, void *ctxt) | 70 | input_kex_dh_gex_request(int type, u_int32_t seq, struct ssh *ssh) |
71 | { | 71 | { |
72 | struct ssh *ssh = ctxt; | ||
73 | struct kex *kex = ssh->kex; | 72 | struct kex *kex = ssh->kex; |
74 | int r; | 73 | int r; |
75 | u_int min = 0, max = 0, nbits = 0; | 74 | u_int min = 0, max = 0, nbits = 0; |
@@ -120,9 +119,8 @@ input_kex_dh_gex_request(int type, u_int32_t seq, void *ctxt) | |||
120 | } | 119 | } |
121 | 120 | ||
122 | static int | 121 | static int |
123 | input_kex_dh_gex_init(int type, u_int32_t seq, void *ctxt) | 122 | input_kex_dh_gex_init(int type, u_int32_t seq, struct ssh *ssh) |
124 | { | 123 | { |
125 | struct ssh *ssh = ctxt; | ||
126 | struct kex *kex = ssh->kex; | 124 | struct kex *kex = ssh->kex; |
127 | BIGNUM *shared_secret = NULL, *dh_client_pub = NULL; | 125 | BIGNUM *shared_secret = NULL, *dh_client_pub = NULL; |
128 | struct sshkey *server_host_public, *server_host_private; | 126 | struct sshkey *server_host_public, *server_host_private; |
diff --git a/serverloop.c b/serverloop.c index 2976f5594..ea07eef23 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: serverloop.c,v 1.191 2017/02/01 02:59:09 dtucker Exp $ */ | 1 | /* $OpenBSD: serverloop.c,v 1.192 2017/05/30 14:23:52 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -417,7 +417,7 @@ server_loop2(Authctxt *authctxt) | |||
417 | } | 417 | } |
418 | 418 | ||
419 | static int | 419 | static int |
420 | server_input_keep_alive(int type, u_int32_t seq, void *ctxt) | 420 | server_input_keep_alive(int type, u_int32_t seq, struct ssh *ssh) |
421 | { | 421 | { |
422 | debug("Got %d/%u for keepalive", type, seq); | 422 | debug("Got %d/%u for keepalive", type, seq); |
423 | /* | 423 | /* |
@@ -579,7 +579,7 @@ server_request_session(void) | |||
579 | } | 579 | } |
580 | 580 | ||
581 | static int | 581 | static int |
582 | server_input_channel_open(int type, u_int32_t seq, void *ctxt) | 582 | server_input_channel_open(int type, u_int32_t seq, struct ssh *ssh) |
583 | { | 583 | { |
584 | Channel *c = NULL; | 584 | Channel *c = NULL; |
585 | char *ctype; | 585 | char *ctype; |
@@ -703,7 +703,7 @@ server_input_hostkeys_prove(struct sshbuf **respp) | |||
703 | } | 703 | } |
704 | 704 | ||
705 | static int | 705 | static int |
706 | server_input_global_request(int type, u_int32_t seq, void *ctxt) | 706 | server_input_global_request(int type, u_int32_t seq, struct ssh *ssh) |
707 | { | 707 | { |
708 | char *rtype; | 708 | char *rtype; |
709 | int want_reply; | 709 | int want_reply; |
@@ -810,7 +810,7 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt) | |||
810 | } | 810 | } |
811 | 811 | ||
812 | static int | 812 | static int |
813 | server_input_channel_req(int type, u_int32_t seq, void *ctxt) | 813 | server_input_channel_req(int type, u_int32_t seq, struct ssh *ssh) |
814 | { | 814 | { |
815 | Channel *c; | 815 | Channel *c; |
816 | int id, reply, success = 0; | 816 | int id, reply, success = 0; |
diff --git a/sshconnect2.c b/sshconnect2.c index affc5667f..dab905b58 100644 --- a/sshconnect2.c +++ b/sshconnect2.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect2.c,v 1.260 2017/05/30 14:19:15 markus Exp $ */ | 1 | /* $OpenBSD: sshconnect2.c,v 1.261 2017/05/30 14:23:52 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2008 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2008 Damien Miller. All rights reserved. |
@@ -287,16 +287,16 @@ struct cauthmethod { | |||
287 | int *batch_flag; /* flag in option struct that disables method */ | 287 | int *batch_flag; /* flag in option struct that disables method */ |
288 | }; | 288 | }; |
289 | 289 | ||
290 | int input_userauth_service_accept(int, u_int32_t, void *); | 290 | int input_userauth_service_accept(int, u_int32_t, struct ssh *); |
291 | int input_userauth_ext_info(int, u_int32_t, void *); | 291 | int input_userauth_ext_info(int, u_int32_t, struct ssh *); |
292 | int input_userauth_success(int, u_int32_t, void *); | 292 | int input_userauth_success(int, u_int32_t, struct ssh *); |
293 | int input_userauth_success_unexpected(int, u_int32_t, void *); | 293 | int input_userauth_success_unexpected(int, u_int32_t, struct ssh *); |
294 | int input_userauth_failure(int, u_int32_t, void *); | 294 | int input_userauth_failure(int, u_int32_t, struct ssh *); |
295 | int input_userauth_banner(int, u_int32_t, void *); | 295 | int input_userauth_banner(int, u_int32_t, struct ssh *); |
296 | int input_userauth_error(int, u_int32_t, void *); | 296 | int input_userauth_error(int, u_int32_t, struct ssh *); |
297 | int input_userauth_info_req(int, u_int32_t, void *); | 297 | int input_userauth_info_req(int, u_int32_t, struct ssh *); |
298 | int input_userauth_pk_ok(int, u_int32_t, void *); | 298 | int input_userauth_pk_ok(int, u_int32_t, struct ssh *); |
299 | int input_userauth_passwd_changereq(int, u_int32_t, void *); | 299 | int input_userauth_passwd_changereq(int, u_int32_t, struct ssh *); |
300 | 300 | ||
301 | int userauth_none(Authctxt *); | 301 | int userauth_none(Authctxt *); |
302 | int userauth_pubkey(Authctxt *); | 302 | int userauth_pubkey(Authctxt *); |
@@ -306,11 +306,11 @@ int userauth_hostbased(Authctxt *); | |||
306 | 306 | ||
307 | #ifdef GSSAPI | 307 | #ifdef GSSAPI |
308 | int userauth_gssapi(Authctxt *authctxt); | 308 | int userauth_gssapi(Authctxt *authctxt); |
309 | int input_gssapi_response(int type, u_int32_t, void *); | 309 | int input_gssapi_response(int type, u_int32_t, struct ssh *); |
310 | int input_gssapi_token(int type, u_int32_t, void *); | 310 | int input_gssapi_token(int type, u_int32_t, struct ssh *); |
311 | int input_gssapi_hash(int type, u_int32_t, void *); | 311 | int input_gssapi_hash(int type, u_int32_t, struct ssh *); |
312 | int input_gssapi_error(int, u_int32_t, void *); | 312 | int input_gssapi_error(int, u_int32_t, struct ssh *); |
313 | int input_gssapi_errtok(int, u_int32_t, void *); | 313 | int input_gssapi_errtok(int, u_int32_t, struct ssh *); |
314 | #endif | 314 | #endif |
315 | 315 | ||
316 | void userauth(Authctxt *, char *); | 316 | void userauth(Authctxt *, char *); |
@@ -414,9 +414,8 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host, | |||
414 | 414 | ||
415 | /* ARGSUSED */ | 415 | /* ARGSUSED */ |
416 | int | 416 | int |
417 | input_userauth_service_accept(int type, u_int32_t seqnr, void *ctxt) | 417 | input_userauth_service_accept(int type, u_int32_t seq, struct ssh *ssh) |
418 | { | 418 | { |
419 | struct ssh *ssh = ctxt; | ||
420 | Authctxt *authctxt = ssh->authctxt; | 419 | Authctxt *authctxt = ssh->authctxt; |
421 | int r; | 420 | int r; |
422 | 421 | ||
@@ -448,9 +447,9 @@ input_userauth_service_accept(int type, u_int32_t seqnr, void *ctxt) | |||
448 | 447 | ||
449 | /* ARGSUSED */ | 448 | /* ARGSUSED */ |
450 | int | 449 | int |
451 | input_userauth_ext_info(int type, u_int32_t seqnr, void *ctxt) | 450 | input_userauth_ext_info(int type, u_int32_t seqnr, struct ssh *ssh) |
452 | { | 451 | { |
453 | return kex_input_ext_info(type, seqnr, ctxt); | 452 | return kex_input_ext_info(type, seqnr, ssh); |
454 | } | 453 | } |
455 | 454 | ||
456 | void | 455 | void |
@@ -490,7 +489,7 @@ userauth(Authctxt *authctxt, char *authlist) | |||
490 | 489 | ||
491 | /* ARGSUSED */ | 490 | /* ARGSUSED */ |
492 | int | 491 | int |
493 | input_userauth_error(int type, u_int32_t seq, void *ctxt) | 492 | input_userauth_error(int type, u_int32_t seq, struct ssh *ssh) |
494 | { | 493 | { |
495 | fatal("input_userauth_error: bad message during authentication: " | 494 | fatal("input_userauth_error: bad message during authentication: " |
496 | "type %d", type); | 495 | "type %d", type); |
@@ -499,7 +498,7 @@ input_userauth_error(int type, u_int32_t seq, void *ctxt) | |||
499 | 498 | ||
500 | /* ARGSUSED */ | 499 | /* ARGSUSED */ |
501 | int | 500 | int |
502 | input_userauth_banner(int type, u_int32_t seq, void *ctxt) | 501 | input_userauth_banner(int type, u_int32_t seq, struct ssh *ssh) |
503 | { | 502 | { |
504 | char *msg, *lang; | 503 | char *msg, *lang; |
505 | u_int len; | 504 | u_int len; |
@@ -516,9 +515,8 @@ input_userauth_banner(int type, u_int32_t seq, void *ctxt) | |||
516 | 515 | ||
517 | /* ARGSUSED */ | 516 | /* ARGSUSED */ |
518 | int | 517 | int |
519 | input_userauth_success(int type, u_int32_t seq, void *ctxt) | 518 | input_userauth_success(int type, u_int32_t seq, struct ssh *ssh) |
520 | { | 519 | { |
521 | struct ssh *ssh = ctxt; | ||
522 | Authctxt *authctxt = ssh->authctxt; | 520 | Authctxt *authctxt = ssh->authctxt; |
523 | 521 | ||
524 | if (authctxt == NULL) | 522 | if (authctxt == NULL) |
@@ -534,9 +532,8 @@ input_userauth_success(int type, u_int32_t seq, void *ctxt) | |||
534 | } | 532 | } |
535 | 533 | ||
536 | int | 534 | int |
537 | input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt) | 535 | input_userauth_success_unexpected(int type, u_int32_t seq, struct ssh *ssh) |
538 | { | 536 | { |
539 | struct ssh *ssh = ctxt; | ||
540 | Authctxt *authctxt = ssh->authctxt; | 537 | Authctxt *authctxt = ssh->authctxt; |
541 | 538 | ||
542 | if (authctxt == NULL) | 539 | if (authctxt == NULL) |
@@ -549,9 +546,8 @@ input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt) | |||
549 | 546 | ||
550 | /* ARGSUSED */ | 547 | /* ARGSUSED */ |
551 | int | 548 | int |
552 | input_userauth_failure(int type, u_int32_t seq, void *ctxt) | 549 | input_userauth_failure(int type, u_int32_t seq, struct ssh *ssh) |
553 | { | 550 | { |
554 | struct ssh *ssh = ctxt; | ||
555 | Authctxt *authctxt = ssh->authctxt; | 551 | Authctxt *authctxt = ssh->authctxt; |
556 | char *authlist = NULL; | 552 | char *authlist = NULL; |
557 | int partial; | 553 | int partial; |
@@ -576,9 +572,8 @@ input_userauth_failure(int type, u_int32_t seq, void *ctxt) | |||
576 | 572 | ||
577 | /* ARGSUSED */ | 573 | /* ARGSUSED */ |
578 | int | 574 | int |
579 | input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt) | 575 | input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh) |
580 | { | 576 | { |
581 | struct ssh *ssh = ctxt; | ||
582 | Authctxt *authctxt = ssh->authctxt; | 577 | Authctxt *authctxt = ssh->authctxt; |
583 | struct sshkey *key = NULL; | 578 | struct sshkey *key = NULL; |
584 | Identity *id = NULL; | 579 | Identity *id = NULL; |
@@ -764,9 +759,8 @@ process_gssapi_token(void *ctxt, gss_buffer_t recv_tok) | |||
764 | 759 | ||
765 | /* ARGSUSED */ | 760 | /* ARGSUSED */ |
766 | int | 761 | int |
767 | input_gssapi_response(int type, u_int32_t plen, void *ctxt) | 762 | input_gssapi_response(int type, u_int32_t plen, struct ssh *ssh) |
768 | { | 763 | { |
769 | struct ssh *ssh = ctxt; | ||
770 | Authctxt *authctxt = ssh->authctxt; | 764 | Authctxt *authctxt = ssh->authctxt; |
771 | Gssctxt *gssctxt; | 765 | Gssctxt *gssctxt; |
772 | int oidlen; | 766 | int oidlen; |
@@ -806,9 +800,8 @@ input_gssapi_response(int type, u_int32_t plen, void *ctxt) | |||
806 | 800 | ||
807 | /* ARGSUSED */ | 801 | /* ARGSUSED */ |
808 | int | 802 | int |
809 | input_gssapi_token(int type, u_int32_t plen, void *ctxt) | 803 | input_gssapi_token(int type, u_int32_t plen, struct ssh *ssh) |
810 | { | 804 | { |
811 | struct ssh *ssh = ctxt; | ||
812 | Authctxt *authctxt = ssh->authctxt; | 805 | Authctxt *authctxt = ssh->authctxt; |
813 | gss_buffer_desc recv_tok; | 806 | gss_buffer_desc recv_tok; |
814 | OM_uint32 status; | 807 | OM_uint32 status; |
@@ -836,9 +829,8 @@ input_gssapi_token(int type, u_int32_t plen, void *ctxt) | |||
836 | 829 | ||
837 | /* ARGSUSED */ | 830 | /* ARGSUSED */ |
838 | int | 831 | int |
839 | input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) | 832 | input_gssapi_errtok(int type, u_int32_t plen, struct ssh *ssh) |
840 | { | 833 | { |
841 | struct ssh *ssh = ctxt; | ||
842 | Authctxt *authctxt = ssh->authctxt; | 834 | Authctxt *authctxt = ssh->authctxt; |
843 | Gssctxt *gssctxt; | 835 | Gssctxt *gssctxt; |
844 | gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; | 836 | gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; |
@@ -868,7 +860,7 @@ input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) | |||
868 | 860 | ||
869 | /* ARGSUSED */ | 861 | /* ARGSUSED */ |
870 | int | 862 | int |
871 | input_gssapi_error(int type, u_int32_t plen, void *ctxt) | 863 | input_gssapi_error(int type, u_int32_t plen, struct ssh *ssh) |
872 | { | 864 | { |
873 | char *msg; | 865 | char *msg; |
874 | char *lang; | 866 | char *lang; |
@@ -939,9 +931,8 @@ userauth_passwd(Authctxt *authctxt) | |||
939 | */ | 931 | */ |
940 | /* ARGSUSED */ | 932 | /* ARGSUSED */ |
941 | int | 933 | int |
942 | input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) | 934 | input_userauth_passwd_changereq(int type, u_int32_t seqnr, struct ssh *ssh) |
943 | { | 935 | { |
944 | struct ssh *ssh = ctxt; | ||
945 | Authctxt *authctxt = ssh->authctxt; | 936 | Authctxt *authctxt = ssh->authctxt; |
946 | char *info, *lang, *password = NULL, *retype = NULL; | 937 | char *info, *lang, *password = NULL, *retype = NULL; |
947 | char prompt[150]; | 938 | char prompt[150]; |
@@ -1570,9 +1561,8 @@ userauth_kbdint(Authctxt *authctxt) | |||
1570 | * parse INFO_REQUEST, prompt user and send INFO_RESPONSE | 1561 | * parse INFO_REQUEST, prompt user and send INFO_RESPONSE |
1571 | */ | 1562 | */ |
1572 | int | 1563 | int |
1573 | input_userauth_info_req(int type, u_int32_t seq, void *ctxt) | 1564 | input_userauth_info_req(int type, u_int32_t seq, struct ssh *ssh) |
1574 | { | 1565 | { |
1575 | struct ssh *ssh = ctxt; | ||
1576 | Authctxt *authctxt = ssh->authctxt; | 1566 | Authctxt *authctxt = ssh->authctxt; |
1577 | char *name, *inst, *lang, *prompt, *response; | 1567 | char *name, *inst, *lang, *prompt, *response; |
1578 | u_int num_prompts, i; | 1568 | u_int num_prompts, i; |