summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarkus@openbsd.org <markus@openbsd.org>2017-05-30 14:23:52 +0000
committerDamien Miller <djm@mindrot.org>2017-05-31 10:50:05 +1000
commit2ae666a8fc20b3b871b2f1b90ad65cc027336ccd (patch)
treef13f1c949ae60c16160acebbfb680c3dc7b13fe5
parent94583beb24a6c5fd19cedb9104ab2d2d5cd052b6 (diff)
upstream commit
protocol handlers all get struct ssh passed; ok djm@ Upstream-ID: 0ca9ea2a5d01a6d2ded94c5024456a930c5bfb5d
-rw-r--r--auth2-chall.c7
-rw-r--r--auth2-gss.c22
-rw-r--r--auth2.c12
-rw-r--r--channels.c37
-rw-r--r--channels.h22
-rw-r--r--clientloop.c12
-rw-r--r--dispatch.c7
-rw-r--r--dispatch.h8
-rw-r--r--kex.c16
-rw-r--r--kex.h6
-rw-r--r--kexdhc.c7
-rw-r--r--kexdhs.c7
-rw-r--r--kexecdhc.c7
-rw-r--r--kexecdhs.c7
-rw-r--r--kexgexc.c12
-rw-r--r--kexgexs.c12
-rw-r--r--serverloop.c10
-rw-r--r--sshconnect2.c72
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
50static int auth2_challenge_start(Authctxt *); 50static int auth2_challenge_start(Authctxt *);
51static int send_userauth_info_request(Authctxt *); 51static int send_userauth_info_request(Authctxt *);
52static int input_userauth_info_response(int, u_int32_t, void *); 52static int input_userauth_info_response(int, u_int32_t, struct ssh *);
53 53
54#ifdef BSD_AUTH 54#ifdef BSD_AUTH
55extern KbdintDevice bsdauth_device; 55extern KbdintDevice bsdauth_device;
@@ -285,9 +285,8 @@ send_userauth_info_request(Authctxt *authctxt)
285} 285}
286 286
287static int 287static int
288input_userauth_info_response(int type, u_int32_t seq, void *ctxt) 288input_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
49extern ServerOptions options; 49extern ServerOptions options;
50 50
51static int input_gssapi_token(int type, u_int32_t plen, void *ctxt); 51static int input_gssapi_token(int type, u_int32_t plen, struct ssh *ssh);
52static int input_gssapi_mic(int type, u_int32_t plen, void *ctxt); 52static int input_gssapi_mic(int type, u_int32_t plen, struct ssh *ssh);
53static int input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt); 53static int input_gssapi_exchange_complete(int type, u_int32_t plen, struct ssh *ssh);
54static int input_gssapi_errtok(int, u_int32_t, void *); 54static 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
129static int 129static int
130input_gssapi_token(int type, u_int32_t plen, void *ctxt) 130input_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
185static int 184static int
186input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) 185input_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
227static int 225static int
228input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt) 226input_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
255static int 252static int
256input_gssapi_mic(int type, u_int32_t plen, void *ctxt) 253input_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;
diff --git a/auth2.c b/auth2.c
index 13ff95eac..cfbf9d250 100644
--- a/auth2.c
+++ b/auth2.c
@@ -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
90static int input_service_request(int, u_int32_t, void *); 90static int input_service_request(int, u_int32_t, struct ssh *);
91static int input_userauth_request(int, u_int32_t, void *); 91static int input_userauth_request(int, u_int32_t, struct ssh *);
92 92
93/* helper */ 93/* helper */
94static Authmethod *authmethod_lookup(Authctxt *, const char *); 94static Authmethod *authmethod_lookup(Authctxt *, const char *);
@@ -178,9 +178,8 @@ do_authentication2(Authctxt *authctxt)
178 178
179/*ARGSUSED*/ 179/*ARGSUSED*/
180static int 180static int
181input_service_request(int type, u_int32_t seq, void *ctxt) 181input_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*/
216static int 215static int
217input_userauth_request(int type, u_int32_t seq, void *ctxt) 216input_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 */
2396int 2396int
2397channel_proxy_upstream(Channel *c, int type, u_int32_t seq, void *ctxt) 2397channel_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 */
2478int 2477int
2479channel_input_data(int type, u_int32_t seq, void *ctxt) 2478channel_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 */
2538int 2537int
2539channel_input_extended_data(int type, u_int32_t seq, void *ctxt) 2538channel_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 */
2588int 2587int
2589channel_input_ieof(int type, u_int32_t seq, void *ctxt) 2588channel_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 */
2614int 2613int
2615channel_input_oclose(int type, u_int32_t seq, void *ctxt) 2614channel_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 */
2630int 2629int
2631channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt) 2630channel_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 */
2682int 2681int
2683channel_input_open_failure(int type, u_int32_t seq, void *ctxt) 2682channel_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 */
2721int 2720int
2722channel_input_window_adjust(int type, u_int32_t seq, void *ctxt) 2721channel_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 */
2749int 2748int
2750channel_input_status_confirm(int type, u_int32_t seq, void *ctxt) 2749channel_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
64struct ssh;
64struct Channel; 65struct Channel;
65typedef struct Channel Channel; 66typedef 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
234int channel_proxy_downstream(Channel *mc); 235int channel_proxy_downstream(Channel *mc);
235int channel_proxy_upstream(Channel *, int, u_int32_t, void *); 236int channel_proxy_upstream(Channel *, int, u_int32_t, struct ssh *);
236 237
237/* protocol handler */ 238/* protocol handler */
238 239
239int channel_input_data(int, u_int32_t, void *); 240int channel_input_data(int, u_int32_t, struct ssh *);
240int channel_input_extended_data(int, u_int32_t, void *); 241int channel_input_extended_data(int, u_int32_t, struct ssh *);
241int channel_input_ieof(int, u_int32_t, void *); 242int channel_input_ieof(int, u_int32_t, struct ssh *);
242int channel_input_oclose(int, u_int32_t, void *); 243int channel_input_oclose(int, u_int32_t, struct ssh *);
243int channel_input_open_confirmation(int, u_int32_t, void *); 244int channel_input_open_confirmation(int, u_int32_t, struct ssh *);
244int channel_input_open_failure(int, u_int32_t, void *); 245int channel_input_open_failure(int, u_int32_t, struct ssh *);
245int channel_input_window_adjust(int, u_int32_t, void *); 246int channel_input_port_open(int, u_int32_t, struct ssh *);
246int channel_input_status_confirm(int, u_int32_t, void *); 247int channel_input_window_adjust(int, u_int32_t, struct ssh *);
248int 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
461static int 461static int
462client_global_request_reply(int type, u_int32_t seq, void *ctxt) 462client_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 */
1644static int 1644static int
1645client_input_channel_open(int type, u_int32_t seq, void *ctxt) 1645client_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
1700static int 1700static int
1701client_input_channel_req(int type, u_int32_t seq, void *ctxt) 1701client_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
2138static int 2138static int
2139client_input_global_request(int type, u_int32_t seq, void *ctxt) 2139client_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
40int 40int
41dispatch_protocol_error(int type, u_int32_t seq, void *ctx) 41dispatch_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
55int 54int
56dispatch_protocol_ignore(int type, u_int32_t seq, void *ssh) 55dispatch_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
37struct ssh; 37struct ssh;
38 38
39typedef int dispatch_fn(int, u_int32_t, void *); 39typedef int dispatch_fn(int, u_int32_t, struct ssh *);
40 40
41int dispatch_protocol_error(int, u_int32_t, void *); 41int dispatch_protocol_error(int, u_int32_t, struct ssh *);
42int dispatch_protocol_ignore(int, u_int32_t, void *); 42int dispatch_protocol_ignore(int, u_int32_t, struct ssh *);
43void ssh_dispatch_init(struct ssh *, dispatch_fn *); 43void ssh_dispatch_init(struct ssh *, dispatch_fn *);
44void ssh_dispatch_set(struct ssh *, int, dispatch_fn *); 44void ssh_dispatch_set(struct ssh *, int, dispatch_fn *);
45void ssh_dispatch_range(struct ssh *, u_int, u_int, dispatch_fn *); 45void ssh_dispatch_range(struct ssh *, u_int, u_int, dispatch_fn *);
diff --git a/kex.c b/kex.c
index 9a40759c1..cf44fbc04 100644
--- a/kex.c
+++ b/kex.c
@@ -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 */
58static int kex_choose_conf(struct ssh *); 58static int kex_choose_conf(struct ssh *);
59static int kex_input_newkeys(int, u_int32_t, void *); 59static int kex_input_newkeys(int, u_int32_t, struct ssh *);
60 60
61static const char *proposal_names[PROPOSAL_MAX] = { 61static 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 */
317static int 317static int
318kex_protocol_error(int type, u_int32_t seq, void *ctxt) 318kex_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
377int 376int
378kex_input_ext_info(int type, u_int32_t seq, void *ctxt) 377kex_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
416static int 414static int
417kex_input_newkeys(int type, u_int32_t seq, void *ctxt) 415kex_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 */
469int 466int
470kex_input_kexinit(int type, u_int32_t seq, void *ctxt) 467kex_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;
diff --git a/kex.h b/kex.h
index 13b22351f..01bb3986a 100644
--- a/kex.h
+++ b/kex.h
@@ -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]);
181void kex_prop_free(char **); 181void kex_prop_free(char **);
182 182
183int kex_send_kexinit(struct ssh *); 183int kex_send_kexinit(struct ssh *);
184int kex_input_kexinit(int, u_int32_t, void *); 184int kex_input_kexinit(int, u_int32_t, struct ssh *);
185int kex_input_ext_info(int, u_int32_t, void *); 185int kex_input_ext_info(int, u_int32_t, struct ssh *);
186int kex_derive_keys(struct ssh *, u_char *, u_int, const struct sshbuf *); 186int kex_derive_keys(struct ssh *, u_char *, u_int, const struct sshbuf *);
187int kex_derive_keys_bn(struct ssh *, u_char *, u_int, const BIGNUM *); 187int kex_derive_keys_bn(struct ssh *, u_char *, u_int, const BIGNUM *);
188int kex_send_newkeys(struct ssh *); 188int kex_send_newkeys(struct ssh *);
diff --git a/kexdhc.c b/kexdhc.c
index ad3975f09..9864ee2ec 100644
--- a/kexdhc.c
+++ b/kexdhc.c
@@ -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
52static int input_kex_dh(int, u_int32_t, void *); 52static int input_kex_dh(int, u_int32_t, struct ssh *);
53 53
54int 54int
55kexdh_client(struct ssh *ssh) 55kexdh_client(struct ssh *ssh)
@@ -100,9 +100,8 @@ kexdh_client(struct ssh *ssh)
100} 100}
101 101
102static int 102static int
103input_kex_dh(int type, u_int32_t seq, void *ctxt) 103input_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;
diff --git a/kexdhs.c b/kexdhs.c
index 108f66427..81ce56d7a 100644
--- a/kexdhs.c
+++ b/kexdhs.c
@@ -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
52static int input_kex_dh_init(int, u_int32_t, void *); 52static int input_kex_dh_init(int, u_int32_t, struct ssh *);
53 53
54int 54int
55kexdh_server(struct ssh *ssh) 55kexdh_server(struct ssh *ssh)
@@ -91,9 +91,8 @@ kexdh_server(struct ssh *ssh)
91} 91}
92 92
93int 93int
94input_kex_dh_init(int type, u_int32_t seq, void *ctxt) 94input_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
52static int input_kex_ecdh_reply(int, u_int32_t, void *); 52static int input_kex_ecdh_reply(int, u_int32_t, struct ssh *);
53 53
54int 54int
55kexecdh_client(struct ssh *ssh) 55kexecdh_client(struct ssh *ssh)
@@ -95,9 +95,8 @@ kexecdh_client(struct ssh *ssh)
95} 95}
96 96
97static int 97static int
98input_kex_ecdh_reply(int type, u_int32_t seq, void *ctxt) 98input_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
50static int input_kex_ecdh_init(int, u_int32_t, void *); 50static int input_kex_ecdh_init(int, u_int32_t, struct ssh *);
51 51
52int 52int
53kexecdh_server(struct ssh *ssh) 53kexecdh_server(struct ssh *ssh)
@@ -58,9 +58,8 @@ kexecdh_server(struct ssh *ssh)
58} 58}
59 59
60static int 60static int
61input_kex_ecdh_init(int type, u_int32_t seq, void *ctxt) 61input_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;
diff --git a/kexgexc.c b/kexgexc.c
index b881c4e97..cd1128752 100644
--- a/kexgexc.c
+++ b/kexgexc.c
@@ -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
54static int input_kex_dh_gex_group(int, u_int32_t, void *); 54static int input_kex_dh_gex_group(int, u_int32_t, struct ssh *);
55static int input_kex_dh_gex_reply(int, u_int32_t, void *); 55static int input_kex_dh_gex_reply(int, u_int32_t, struct ssh *);
56 56
57int 57int
58kexgex_client(struct ssh *ssh) 58kexgex_client(struct ssh *ssh)
@@ -89,9 +89,8 @@ kexgex_client(struct ssh *ssh)
89} 89}
90 90
91static int 91static int
92input_kex_dh_gex_group(int type, u_int32_t seq, void *ctxt) 92input_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
145static int 144static int
146input_kex_dh_gex_reply(int type, u_int32_t seq, void *ctxt) 145input_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;
diff --git a/kexgexs.c b/kexgexs.c
index 449603592..c5dd00578 100644
--- a/kexgexs.c
+++ b/kexgexs.c
@@ -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
57static int input_kex_dh_gex_request(int, u_int32_t, void *); 57static int input_kex_dh_gex_request(int, u_int32_t, struct ssh *);
58static int input_kex_dh_gex_init(int, u_int32_t, void *); 58static int input_kex_dh_gex_init(int, u_int32_t, struct ssh *);
59 59
60int 60int
61kexgex_server(struct ssh *ssh) 61kexgex_server(struct ssh *ssh)
@@ -67,9 +67,8 @@ kexgex_server(struct ssh *ssh)
67} 67}
68 68
69static int 69static int
70input_kex_dh_gex_request(int type, u_int32_t seq, void *ctxt) 70input_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
122static int 121static int
123input_kex_dh_gex_init(int type, u_int32_t seq, void *ctxt) 122input_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
419static int 419static int
420server_input_keep_alive(int type, u_int32_t seq, void *ctxt) 420server_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
581static int 581static int
582server_input_channel_open(int type, u_int32_t seq, void *ctxt) 582server_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
705static int 705static int
706server_input_global_request(int type, u_int32_t seq, void *ctxt) 706server_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
812static int 812static int
813server_input_channel_req(int type, u_int32_t seq, void *ctxt) 813server_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
290int input_userauth_service_accept(int, u_int32_t, void *); 290int input_userauth_service_accept(int, u_int32_t, struct ssh *);
291int input_userauth_ext_info(int, u_int32_t, void *); 291int input_userauth_ext_info(int, u_int32_t, struct ssh *);
292int input_userauth_success(int, u_int32_t, void *); 292int input_userauth_success(int, u_int32_t, struct ssh *);
293int input_userauth_success_unexpected(int, u_int32_t, void *); 293int input_userauth_success_unexpected(int, u_int32_t, struct ssh *);
294int input_userauth_failure(int, u_int32_t, void *); 294int input_userauth_failure(int, u_int32_t, struct ssh *);
295int input_userauth_banner(int, u_int32_t, void *); 295int input_userauth_banner(int, u_int32_t, struct ssh *);
296int input_userauth_error(int, u_int32_t, void *); 296int input_userauth_error(int, u_int32_t, struct ssh *);
297int input_userauth_info_req(int, u_int32_t, void *); 297int input_userauth_info_req(int, u_int32_t, struct ssh *);
298int input_userauth_pk_ok(int, u_int32_t, void *); 298int input_userauth_pk_ok(int, u_int32_t, struct ssh *);
299int input_userauth_passwd_changereq(int, u_int32_t, void *); 299int input_userauth_passwd_changereq(int, u_int32_t, struct ssh *);
300 300
301int userauth_none(Authctxt *); 301int userauth_none(Authctxt *);
302int userauth_pubkey(Authctxt *); 302int userauth_pubkey(Authctxt *);
@@ -306,11 +306,11 @@ int userauth_hostbased(Authctxt *);
306 306
307#ifdef GSSAPI 307#ifdef GSSAPI
308int userauth_gssapi(Authctxt *authctxt); 308int userauth_gssapi(Authctxt *authctxt);
309int input_gssapi_response(int type, u_int32_t, void *); 309int input_gssapi_response(int type, u_int32_t, struct ssh *);
310int input_gssapi_token(int type, u_int32_t, void *); 310int input_gssapi_token(int type, u_int32_t, struct ssh *);
311int input_gssapi_hash(int type, u_int32_t, void *); 311int input_gssapi_hash(int type, u_int32_t, struct ssh *);
312int input_gssapi_error(int, u_int32_t, void *); 312int input_gssapi_error(int, u_int32_t, struct ssh *);
313int input_gssapi_errtok(int, u_int32_t, void *); 313int input_gssapi_errtok(int, u_int32_t, struct ssh *);
314#endif 314#endif
315 315
316void userauth(Authctxt *, char *); 316void 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 */
416int 416int
417input_userauth_service_accept(int type, u_int32_t seqnr, void *ctxt) 417input_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 */
450int 449int
451input_userauth_ext_info(int type, u_int32_t seqnr, void *ctxt) 450input_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
456void 455void
@@ -490,7 +489,7 @@ userauth(Authctxt *authctxt, char *authlist)
490 489
491/* ARGSUSED */ 490/* ARGSUSED */
492int 491int
493input_userauth_error(int type, u_int32_t seq, void *ctxt) 492input_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 */
501int 500int
502input_userauth_banner(int type, u_int32_t seq, void *ctxt) 501input_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 */
518int 517int
519input_userauth_success(int type, u_int32_t seq, void *ctxt) 518input_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
536int 534int
537input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt) 535input_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 */
551int 548int
552input_userauth_failure(int type, u_int32_t seq, void *ctxt) 549input_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 */
578int 574int
579input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt) 575input_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 */
766int 761int
767input_gssapi_response(int type, u_int32_t plen, void *ctxt) 762input_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 */
808int 802int
809input_gssapi_token(int type, u_int32_t plen, void *ctxt) 803input_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 */
838int 831int
839input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) 832input_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 */
870int 862int
871input_gssapi_error(int type, u_int32_t plen, void *ctxt) 863input_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 */
941int 933int
942input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) 934input_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 */
1572int 1563int
1573input_userauth_info_req(int type, u_int32_t seq, void *ctxt) 1564input_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;