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 | 63 | ||||
-rw-r--r-- | channels.h | 28 | ||||
-rw-r--r-- | clientloop.c | 28 | ||||
-rw-r--r-- | dispatch.c | 102 | ||||
-rw-r--r-- | dispatch.h | 35 | ||||
-rw-r--r-- | kex.c | 8 | ||||
-rw-r--r-- | kex.h | 4 | ||||
-rw-r--r-- | packet.h | 9 | ||||
-rw-r--r-- | serverloop.c | 25 | ||||
-rw-r--r-- | sshconnect2.c | 54 |
13 files changed, 251 insertions, 146 deletions
diff --git a/auth2-chall.c b/auth2-chall.c index ea4eb6952..ddabe1a90 100644 --- a/auth2-chall.c +++ b/auth2-chall.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth2-chall.c,v 1.41 2014/02/02 03:44:31 djm Exp $ */ | 1 | /* $OpenBSD: auth2-chall.c,v 1.42 2015/01/19 20:07:45 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 void input_userauth_info_response(int, u_int32_t, void *); | 52 | static int input_userauth_info_response(int, u_int32_t, void *); |
53 | 53 | ||
54 | #ifdef BSD_AUTH | 54 | #ifdef BSD_AUTH |
55 | extern KbdintDevice bsdauth_device; | 55 | extern KbdintDevice bsdauth_device; |
@@ -279,7 +279,7 @@ send_userauth_info_request(Authctxt *authctxt) | |||
279 | return 1; | 279 | return 1; |
280 | } | 280 | } |
281 | 281 | ||
282 | static void | 282 | static int |
283 | input_userauth_info_response(int type, u_int32_t seq, void *ctxt) | 283 | input_userauth_info_response(int type, u_int32_t seq, void *ctxt) |
284 | { | 284 | { |
285 | Authctxt *authctxt = ctxt; | 285 | Authctxt *authctxt = ctxt; |
@@ -344,6 +344,7 @@ input_userauth_info_response(int type, u_int32_t seq, void *ctxt) | |||
344 | } | 344 | } |
345 | userauth_finish(authctxt, authenticated, "keyboard-interactive", | 345 | userauth_finish(authctxt, authenticated, "keyboard-interactive", |
346 | devicename); | 346 | devicename); |
347 | return 0; | ||
347 | } | 348 | } |
348 | 349 | ||
349 | void | 350 | void |
diff --git a/auth2-gss.c b/auth2-gss.c index 447f896f2..1ca835773 100644 --- a/auth2-gss.c +++ b/auth2-gss.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth2-gss.c,v 1.21 2014/02/26 20:28:44 djm Exp $ */ | 1 | /* $OpenBSD: auth2-gss.c,v 1.22 2015/01/19 20:07:45 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 void input_gssapi_token(int type, u_int32_t plen, void *ctxt); | 51 | static int input_gssapi_token(int type, u_int32_t plen, void *ctxt); |
52 | static void input_gssapi_mic(int type, u_int32_t plen, void *ctxt); | 52 | static int input_gssapi_mic(int type, u_int32_t plen, void *ctxt); |
53 | static void 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, void *ctxt); |
54 | static void input_gssapi_errtok(int, u_int32_t, void *); | 54 | static int input_gssapi_errtok(int, u_int32_t, void *); |
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 |
@@ -126,7 +126,7 @@ userauth_gssapi(Authctxt *authctxt) | |||
126 | return (0); | 126 | return (0); |
127 | } | 127 | } |
128 | 128 | ||
129 | static void | 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, void *ctxt) |
131 | { | 131 | { |
132 | Authctxt *authctxt = ctxt; | 132 | Authctxt *authctxt = ctxt; |
@@ -178,9 +178,10 @@ input_gssapi_token(int type, u_int32_t plen, void *ctxt) | |||
178 | } | 178 | } |
179 | 179 | ||
180 | gss_release_buffer(&min_status, &send_tok); | 180 | gss_release_buffer(&min_status, &send_tok); |
181 | return 0; | ||
181 | } | 182 | } |
182 | 183 | ||
183 | static void | 184 | static int |
184 | input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) | 185 | input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) |
185 | { | 186 | { |
186 | Authctxt *authctxt = ctxt; | 187 | Authctxt *authctxt = ctxt; |
@@ -212,6 +213,7 @@ input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) | |||
212 | /* The client will have already moved on to the next auth */ | 213 | /* The client will have already moved on to the next auth */ |
213 | 214 | ||
214 | gss_release_buffer(&maj_status, &send_tok); | 215 | gss_release_buffer(&maj_status, &send_tok); |
216 | return 0; | ||
215 | } | 217 | } |
216 | 218 | ||
217 | /* | 219 | /* |
@@ -220,7 +222,7 @@ input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) | |||
220 | * which only enables it once the GSSAPI exchange is complete. | 222 | * which only enables it once the GSSAPI exchange is complete. |
221 | */ | 223 | */ |
222 | 224 | ||
223 | static void | 225 | static int |
224 | input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt) | 226 | input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt) |
225 | { | 227 | { |
226 | Authctxt *authctxt = ctxt; | 228 | Authctxt *authctxt = ctxt; |
@@ -244,9 +246,10 @@ input_gssapi_exchange_complete(int type, u_int32_t plen, void *ctxt) | |||
244 | dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL); | 246 | dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL); |
245 | dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL); | 247 | dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL); |
246 | userauth_finish(authctxt, authenticated, "gssapi-with-mic", NULL); | 248 | userauth_finish(authctxt, authenticated, "gssapi-with-mic", NULL); |
249 | return 0; | ||
247 | } | 250 | } |
248 | 251 | ||
249 | static void | 252 | static int |
250 | input_gssapi_mic(int type, u_int32_t plen, void *ctxt) | 253 | input_gssapi_mic(int type, u_int32_t plen, void *ctxt) |
251 | { | 254 | { |
252 | Authctxt *authctxt = ctxt; | 255 | Authctxt *authctxt = ctxt; |
@@ -284,6 +287,7 @@ input_gssapi_mic(int type, u_int32_t plen, void *ctxt) | |||
284 | dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL); | 287 | dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_MIC, NULL); |
285 | dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL); | 288 | dispatch_set(SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE, NULL); |
286 | userauth_finish(authctxt, authenticated, "gssapi-with-mic", NULL); | 289 | userauth_finish(authctxt, authenticated, "gssapi-with-mic", NULL); |
290 | return 0; | ||
287 | } | 291 | } |
288 | 292 | ||
289 | Authmethod method_gssapi = { | 293 | Authmethod method_gssapi = { |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth2.c,v 1.134 2014/12/22 07:55:51 djm Exp $ */ | 1 | /* $OpenBSD: auth2.c,v 1.135 2015/01/19 20:07:45 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 void input_service_request(int, u_int32_t, void *); | 90 | static int input_service_request(int, u_int32_t, void *); |
91 | static void input_userauth_request(int, u_int32_t, void *); | 91 | static int input_userauth_request(int, u_int32_t, void *); |
92 | 92 | ||
93 | /* helper */ | 93 | /* helper */ |
94 | static Authmethod *authmethod_lookup(Authctxt *, const char *); | 94 | static Authmethod *authmethod_lookup(Authctxt *, const char *); |
@@ -174,7 +174,7 @@ do_authentication2(Authctxt *authctxt) | |||
174 | } | 174 | } |
175 | 175 | ||
176 | /*ARGSUSED*/ | 176 | /*ARGSUSED*/ |
177 | static void | 177 | static int |
178 | input_service_request(int type, u_int32_t seq, void *ctxt) | 178 | input_service_request(int type, u_int32_t seq, void *ctxt) |
179 | { | 179 | { |
180 | Authctxt *authctxt = ctxt; | 180 | Authctxt *authctxt = ctxt; |
@@ -205,10 +205,11 @@ input_service_request(int type, u_int32_t seq, void *ctxt) | |||
205 | packet_disconnect("bad service request %s", service); | 205 | packet_disconnect("bad service request %s", service); |
206 | } | 206 | } |
207 | free(service); | 207 | free(service); |
208 | return 0; | ||
208 | } | 209 | } |
209 | 210 | ||
210 | /*ARGSUSED*/ | 211 | /*ARGSUSED*/ |
211 | static void | 212 | static int |
212 | input_userauth_request(int type, u_int32_t seq, void *ctxt) | 213 | input_userauth_request(int type, u_int32_t seq, void *ctxt) |
213 | { | 214 | { |
214 | Authctxt *authctxt = ctxt; | 215 | Authctxt *authctxt = ctxt; |
@@ -284,6 +285,7 @@ input_userauth_request(int type, u_int32_t seq, void *ctxt) | |||
284 | free(service); | 285 | free(service); |
285 | free(user); | 286 | free(user); |
286 | free(method); | 287 | free(method); |
288 | return 0; | ||
287 | } | 289 | } |
288 | 290 | ||
289 | void | 291 | void |
diff --git a/channels.c b/channels.c index 6db92cbac..29a62f70a 100644 --- a/channels.c +++ b/channels.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: channels.c,v 1.338 2014/12/11 08:20:09 djm Exp $ */ | 1 | /* $OpenBSD: channels.c,v 1.339 2015/01/19 20:07:45 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 |
@@ -2343,7 +2343,7 @@ channel_output_poll(void) | |||
2343 | /* -- protocol input */ | 2343 | /* -- protocol input */ |
2344 | 2344 | ||
2345 | /* ARGSUSED */ | 2345 | /* ARGSUSED */ |
2346 | void | 2346 | int |
2347 | channel_input_data(int type, u_int32_t seq, void *ctxt) | 2347 | channel_input_data(int type, u_int32_t seq, void *ctxt) |
2348 | { | 2348 | { |
2349 | int id; | 2349 | int id; |
@@ -2360,7 +2360,7 @@ channel_input_data(int type, u_int32_t seq, void *ctxt) | |||
2360 | /* Ignore any data for non-open channels (might happen on close) */ | 2360 | /* Ignore any data for non-open channels (might happen on close) */ |
2361 | if (c->type != SSH_CHANNEL_OPEN && | 2361 | if (c->type != SSH_CHANNEL_OPEN && |
2362 | c->type != SSH_CHANNEL_X11_OPEN) | 2362 | c->type != SSH_CHANNEL_X11_OPEN) |
2363 | return; | 2363 | return 0; |
2364 | 2364 | ||
2365 | /* Get the data. */ | 2365 | /* Get the data. */ |
2366 | data = packet_get_string_ptr(&data_len); | 2366 | data = packet_get_string_ptr(&data_len); |
@@ -2380,7 +2380,7 @@ channel_input_data(int type, u_int32_t seq, void *ctxt) | |||
2380 | c->local_window -= win_len; | 2380 | c->local_window -= win_len; |
2381 | c->local_consumed += win_len; | 2381 | c->local_consumed += win_len; |
2382 | } | 2382 | } |
2383 | return; | 2383 | return 0; |
2384 | } | 2384 | } |
2385 | 2385 | ||
2386 | if (compat20) { | 2386 | if (compat20) { |
@@ -2391,7 +2391,7 @@ channel_input_data(int type, u_int32_t seq, void *ctxt) | |||
2391 | if (win_len > c->local_window) { | 2391 | if (win_len > c->local_window) { |
2392 | logit("channel %d: rcvd too much data %d, win %d", | 2392 | logit("channel %d: rcvd too much data %d, win %d", |
2393 | c->self, win_len, c->local_window); | 2393 | c->self, win_len, c->local_window); |
2394 | return; | 2394 | return 0; |
2395 | } | 2395 | } |
2396 | c->local_window -= win_len; | 2396 | c->local_window -= win_len; |
2397 | } | 2397 | } |
@@ -2400,10 +2400,11 @@ channel_input_data(int type, u_int32_t seq, void *ctxt) | |||
2400 | else | 2400 | else |
2401 | buffer_append(&c->output, data, data_len); | 2401 | buffer_append(&c->output, data, data_len); |
2402 | packet_check_eom(); | 2402 | packet_check_eom(); |
2403 | return 0; | ||
2403 | } | 2404 | } |
2404 | 2405 | ||
2405 | /* ARGSUSED */ | 2406 | /* ARGSUSED */ |
2406 | void | 2407 | int |
2407 | channel_input_extended_data(int type, u_int32_t seq, void *ctxt) | 2408 | channel_input_extended_data(int type, u_int32_t seq, void *ctxt) |
2408 | { | 2409 | { |
2409 | int id; | 2410 | int id; |
@@ -2419,7 +2420,7 @@ channel_input_extended_data(int type, u_int32_t seq, void *ctxt) | |||
2419 | packet_disconnect("Received extended_data for bad channel %d.", id); | 2420 | packet_disconnect("Received extended_data for bad channel %d.", id); |
2420 | if (c->type != SSH_CHANNEL_OPEN) { | 2421 | if (c->type != SSH_CHANNEL_OPEN) { |
2421 | logit("channel %d: ext data for non open", id); | 2422 | logit("channel %d: ext data for non open", id); |
2422 | return; | 2423 | return 0; |
2423 | } | 2424 | } |
2424 | if (c->flags & CHAN_EOF_RCVD) { | 2425 | if (c->flags & CHAN_EOF_RCVD) { |
2425 | if (datafellows & SSH_BUG_EXTEOF) | 2426 | if (datafellows & SSH_BUG_EXTEOF) |
@@ -2433,7 +2434,7 @@ channel_input_extended_data(int type, u_int32_t seq, void *ctxt) | |||
2433 | c->extended_usage != CHAN_EXTENDED_WRITE || | 2434 | c->extended_usage != CHAN_EXTENDED_WRITE || |
2434 | tcode != SSH2_EXTENDED_DATA_STDERR) { | 2435 | tcode != SSH2_EXTENDED_DATA_STDERR) { |
2435 | logit("channel %d: bad ext data", c->self); | 2436 | logit("channel %d: bad ext data", c->self); |
2436 | return; | 2437 | return 0; |
2437 | } | 2438 | } |
2438 | data = packet_get_string(&data_len); | 2439 | data = packet_get_string(&data_len); |
2439 | packet_check_eom(); | 2440 | packet_check_eom(); |
@@ -2441,16 +2442,17 @@ channel_input_extended_data(int type, u_int32_t seq, void *ctxt) | |||
2441 | logit("channel %d: rcvd too much extended_data %d, win %d", | 2442 | logit("channel %d: rcvd too much extended_data %d, win %d", |
2442 | c->self, data_len, c->local_window); | 2443 | c->self, data_len, c->local_window); |
2443 | free(data); | 2444 | free(data); |
2444 | return; | 2445 | return 0; |
2445 | } | 2446 | } |
2446 | debug2("channel %d: rcvd ext data %d", c->self, data_len); | 2447 | debug2("channel %d: rcvd ext data %d", c->self, data_len); |
2447 | c->local_window -= data_len; | 2448 | c->local_window -= data_len; |
2448 | buffer_append(&c->extended, data, data_len); | 2449 | buffer_append(&c->extended, data, data_len); |
2449 | free(data); | 2450 | free(data); |
2451 | return 0; | ||
2450 | } | 2452 | } |
2451 | 2453 | ||
2452 | /* ARGSUSED */ | 2454 | /* ARGSUSED */ |
2453 | void | 2455 | int |
2454 | channel_input_ieof(int type, u_int32_t seq, void *ctxt) | 2456 | channel_input_ieof(int type, u_int32_t seq, void *ctxt) |
2455 | { | 2457 | { |
2456 | int id; | 2458 | int id; |
@@ -2470,11 +2472,11 @@ channel_input_ieof(int type, u_int32_t seq, void *ctxt) | |||
2470 | if (buffer_len(&c->input) == 0) | 2472 | if (buffer_len(&c->input) == 0) |
2471 | chan_ibuf_empty(c); | 2473 | chan_ibuf_empty(c); |
2472 | } | 2474 | } |
2473 | 2475 | return 0; | |
2474 | } | 2476 | } |
2475 | 2477 | ||
2476 | /* ARGSUSED */ | 2478 | /* ARGSUSED */ |
2477 | void | 2479 | int |
2478 | channel_input_close(int type, u_int32_t seq, void *ctxt) | 2480 | channel_input_close(int type, u_int32_t seq, void *ctxt) |
2479 | { | 2481 | { |
2480 | int id; | 2482 | int id; |
@@ -2509,11 +2511,12 @@ channel_input_close(int type, u_int32_t seq, void *ctxt) | |||
2509 | buffer_clear(&c->input); | 2511 | buffer_clear(&c->input); |
2510 | c->type = SSH_CHANNEL_OUTPUT_DRAINING; | 2512 | c->type = SSH_CHANNEL_OUTPUT_DRAINING; |
2511 | } | 2513 | } |
2514 | return 0; | ||
2512 | } | 2515 | } |
2513 | 2516 | ||
2514 | /* proto version 1.5 overloads CLOSE_CONFIRMATION with OCLOSE */ | 2517 | /* proto version 1.5 overloads CLOSE_CONFIRMATION with OCLOSE */ |
2515 | /* ARGSUSED */ | 2518 | /* ARGSUSED */ |
2516 | void | 2519 | int |
2517 | channel_input_oclose(int type, u_int32_t seq, void *ctxt) | 2520 | channel_input_oclose(int type, u_int32_t seq, void *ctxt) |
2518 | { | 2521 | { |
2519 | int id = packet_get_int(); | 2522 | int id = packet_get_int(); |
@@ -2523,10 +2526,11 @@ channel_input_oclose(int type, u_int32_t seq, void *ctxt) | |||
2523 | if (c == NULL) | 2526 | if (c == NULL) |
2524 | packet_disconnect("Received oclose for nonexistent channel %d.", id); | 2527 | packet_disconnect("Received oclose for nonexistent channel %d.", id); |
2525 | chan_rcvd_oclose(c); | 2528 | chan_rcvd_oclose(c); |
2529 | return 0; | ||
2526 | } | 2530 | } |
2527 | 2531 | ||
2528 | /* ARGSUSED */ | 2532 | /* ARGSUSED */ |
2529 | void | 2533 | int |
2530 | channel_input_close_confirmation(int type, u_int32_t seq, void *ctxt) | 2534 | channel_input_close_confirmation(int type, u_int32_t seq, void *ctxt) |
2531 | { | 2535 | { |
2532 | int id = packet_get_int(); | 2536 | int id = packet_get_int(); |
@@ -2540,10 +2544,11 @@ channel_input_close_confirmation(int type, u_int32_t seq, void *ctxt) | |||
2540 | packet_disconnect("Received close confirmation for " | 2544 | packet_disconnect("Received close confirmation for " |
2541 | "non-closed channel %d (type %d).", id, c->type); | 2545 | "non-closed channel %d (type %d).", id, c->type); |
2542 | channel_free(c); | 2546 | channel_free(c); |
2547 | return 0; | ||
2543 | } | 2548 | } |
2544 | 2549 | ||
2545 | /* ARGSUSED */ | 2550 | /* ARGSUSED */ |
2546 | void | 2551 | int |
2547 | channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt) | 2552 | channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt) |
2548 | { | 2553 | { |
2549 | int id, remote_id; | 2554 | int id, remote_id; |
@@ -2572,6 +2577,7 @@ channel_input_open_confirmation(int type, u_int32_t seq, void *ctxt) | |||
2572 | c->remote_window, c->remote_maxpacket); | 2577 | c->remote_window, c->remote_maxpacket); |
2573 | } | 2578 | } |
2574 | packet_check_eom(); | 2579 | packet_check_eom(); |
2580 | return 0; | ||
2575 | } | 2581 | } |
2576 | 2582 | ||
2577 | static char * | 2583 | static char * |
@@ -2591,7 +2597,7 @@ reason2txt(int reason) | |||
2591 | } | 2597 | } |
2592 | 2598 | ||
2593 | /* ARGSUSED */ | 2599 | /* ARGSUSED */ |
2594 | void | 2600 | int |
2595 | channel_input_open_failure(int type, u_int32_t seq, void *ctxt) | 2601 | channel_input_open_failure(int type, u_int32_t seq, void *ctxt) |
2596 | { | 2602 | { |
2597 | int id, reason; | 2603 | int id, reason; |
@@ -2623,10 +2629,11 @@ channel_input_open_failure(int type, u_int32_t seq, void *ctxt) | |||
2623 | packet_check_eom(); | 2629 | packet_check_eom(); |
2624 | /* Schedule the channel for cleanup/deletion. */ | 2630 | /* Schedule the channel for cleanup/deletion. */ |
2625 | chan_mark_dead(c); | 2631 | chan_mark_dead(c); |
2632 | return 0; | ||
2626 | } | 2633 | } |
2627 | 2634 | ||
2628 | /* ARGSUSED */ | 2635 | /* ARGSUSED */ |
2629 | void | 2636 | int |
2630 | channel_input_window_adjust(int type, u_int32_t seq, void *ctxt) | 2637 | channel_input_window_adjust(int type, u_int32_t seq, void *ctxt) |
2631 | { | 2638 | { |
2632 | Channel *c; | 2639 | Channel *c; |
@@ -2634,7 +2641,7 @@ channel_input_window_adjust(int type, u_int32_t seq, void *ctxt) | |||
2634 | u_int adjust; | 2641 | u_int adjust; |
2635 | 2642 | ||
2636 | if (!compat20) | 2643 | if (!compat20) |
2637 | return; | 2644 | return 0; |
2638 | 2645 | ||
2639 | /* Get the channel number and verify it. */ | 2646 | /* Get the channel number and verify it. */ |
2640 | id = packet_get_int(); | 2647 | id = packet_get_int(); |
@@ -2642,16 +2649,17 @@ channel_input_window_adjust(int type, u_int32_t seq, void *ctxt) | |||
2642 | 2649 | ||
2643 | if (c == NULL) { | 2650 | if (c == NULL) { |
2644 | logit("Received window adjust for non-open channel %d.", id); | 2651 | logit("Received window adjust for non-open channel %d.", id); |
2645 | return; | 2652 | return 0; |
2646 | } | 2653 | } |
2647 | adjust = packet_get_int(); | 2654 | adjust = packet_get_int(); |
2648 | packet_check_eom(); | 2655 | packet_check_eom(); |
2649 | debug2("channel %d: rcvd adjust %u", id, adjust); | 2656 | debug2("channel %d: rcvd adjust %u", id, adjust); |
2650 | c->remote_window += adjust; | 2657 | c->remote_window += adjust; |
2658 | return 0; | ||
2651 | } | 2659 | } |
2652 | 2660 | ||
2653 | /* ARGSUSED */ | 2661 | /* ARGSUSED */ |
2654 | void | 2662 | int |
2655 | channel_input_port_open(int type, u_int32_t seq, void *ctxt) | 2663 | channel_input_port_open(int type, u_int32_t seq, void *ctxt) |
2656 | { | 2664 | { |
2657 | Channel *c = NULL; | 2665 | Channel *c = NULL; |
@@ -2679,10 +2687,11 @@ channel_input_port_open(int type, u_int32_t seq, void *ctxt) | |||
2679 | packet_send(); | 2687 | packet_send(); |
2680 | } else | 2688 | } else |
2681 | c->remote_id = remote_id; | 2689 | c->remote_id = remote_id; |
2690 | return 0; | ||
2682 | } | 2691 | } |
2683 | 2692 | ||
2684 | /* ARGSUSED */ | 2693 | /* ARGSUSED */ |
2685 | void | 2694 | int |
2686 | channel_input_status_confirm(int type, u_int32_t seq, void *ctxt) | 2695 | channel_input_status_confirm(int type, u_int32_t seq, void *ctxt) |
2687 | { | 2696 | { |
2688 | Channel *c; | 2697 | Channel *c; |
@@ -2699,15 +2708,15 @@ channel_input_status_confirm(int type, u_int32_t seq, void *ctxt) | |||
2699 | 2708 | ||
2700 | if ((c = channel_lookup(id)) == NULL) { | 2709 | if ((c = channel_lookup(id)) == NULL) { |
2701 | logit("channel_input_status_confirm: %d: unknown", id); | 2710 | logit("channel_input_status_confirm: %d: unknown", id); |
2702 | return; | 2711 | return 0; |
2703 | } | 2712 | } |
2704 | ; | ||
2705 | if ((cc = TAILQ_FIRST(&c->status_confirms)) == NULL) | 2713 | if ((cc = TAILQ_FIRST(&c->status_confirms)) == NULL) |
2706 | return; | 2714 | return 0; |
2707 | cc->cb(type, c, cc->ctx); | 2715 | cc->cb(type, c, cc->ctx); |
2708 | TAILQ_REMOVE(&c->status_confirms, cc, entry); | 2716 | TAILQ_REMOVE(&c->status_confirms, cc, entry); |
2709 | explicit_bzero(cc, sizeof(*cc)); | 2717 | explicit_bzero(cc, sizeof(*cc)); |
2710 | free(cc); | 2718 | free(cc); |
2719 | return 0; | ||
2711 | } | 2720 | } |
2712 | 2721 | ||
2713 | /* -- tcp forwarding */ | 2722 | /* -- tcp forwarding */ |
@@ -4095,7 +4104,7 @@ x11_connect_display(void) | |||
4095 | */ | 4104 | */ |
4096 | 4105 | ||
4097 | /* ARGSUSED */ | 4106 | /* ARGSUSED */ |
4098 | void | 4107 | int |
4099 | x11_input_open(int type, u_int32_t seq, void *ctxt) | 4108 | x11_input_open(int type, u_int32_t seq, void *ctxt) |
4100 | { | 4109 | { |
4101 | Channel *c = NULL; | 4110 | Channel *c = NULL; |
@@ -4135,11 +4144,12 @@ x11_input_open(int type, u_int32_t seq, void *ctxt) | |||
4135 | packet_put_int(c->self); | 4144 | packet_put_int(c->self); |
4136 | } | 4145 | } |
4137 | packet_send(); | 4146 | packet_send(); |
4147 | return 0; | ||
4138 | } | 4148 | } |
4139 | 4149 | ||
4140 | /* dummy protocol handler that denies SSH-1 requests (agent/x11) */ | 4150 | /* dummy protocol handler that denies SSH-1 requests (agent/x11) */ |
4141 | /* ARGSUSED */ | 4151 | /* ARGSUSED */ |
4142 | void | 4152 | int |
4143 | deny_input_open(int type, u_int32_t seq, void *ctxt) | 4153 | deny_input_open(int type, u_int32_t seq, void *ctxt) |
4144 | { | 4154 | { |
4145 | int rchan = packet_get_int(); | 4155 | int rchan = packet_get_int(); |
@@ -4159,6 +4169,7 @@ deny_input_open(int type, u_int32_t seq, void *ctxt) | |||
4159 | packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); | 4169 | packet_start(SSH_MSG_CHANNEL_OPEN_FAILURE); |
4160 | packet_put_int(rchan); | 4170 | packet_put_int(rchan); |
4161 | packet_send(); | 4171 | packet_send(); |
4172 | return 0; | ||
4162 | } | 4173 | } |
4163 | 4174 | ||
4164 | /* | 4175 | /* |
diff --git a/channels.h b/channels.h index a000c98e5..5a672f22e 100644 --- a/channels.h +++ b/channels.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: channels.h,v 1.115 2014/07/15 15:54:14 millert Exp $ */ | 1 | /* $OpenBSD: channels.h,v 1.116 2015/01/19 20:07:45 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -230,17 +230,17 @@ void channel_send_window_changes(void); | |||
230 | 230 | ||
231 | /* protocol handler */ | 231 | /* protocol handler */ |
232 | 232 | ||
233 | void channel_input_close(int, u_int32_t, void *); | 233 | int channel_input_close(int, u_int32_t, void *); |
234 | void channel_input_close_confirmation(int, u_int32_t, void *); | 234 | int channel_input_close_confirmation(int, u_int32_t, void *); |
235 | void channel_input_data(int, u_int32_t, void *); | 235 | int channel_input_data(int, u_int32_t, void *); |
236 | void channel_input_extended_data(int, u_int32_t, void *); | 236 | int channel_input_extended_data(int, u_int32_t, void *); |
237 | void channel_input_ieof(int, u_int32_t, void *); | 237 | int channel_input_ieof(int, u_int32_t, void *); |
238 | void channel_input_oclose(int, u_int32_t, void *); | 238 | int channel_input_oclose(int, u_int32_t, void *); |
239 | void channel_input_open_confirmation(int, u_int32_t, void *); | 239 | int channel_input_open_confirmation(int, u_int32_t, void *); |
240 | void channel_input_open_failure(int, u_int32_t, void *); | 240 | int channel_input_open_failure(int, u_int32_t, void *); |
241 | void channel_input_port_open(int, u_int32_t, void *); | 241 | int channel_input_port_open(int, u_int32_t, void *); |
242 | void channel_input_window_adjust(int, u_int32_t, void *); | 242 | int channel_input_window_adjust(int, u_int32_t, void *); |
243 | void channel_input_status_confirm(int, u_int32_t, void *); | 243 | int channel_input_status_confirm(int, u_int32_t, void *); |
244 | 244 | ||
245 | /* file descriptor handling (read/write) */ | 245 | /* file descriptor handling (read/write) */ |
246 | 246 | ||
@@ -286,10 +286,10 @@ int permitopen_port(const char *); | |||
286 | 286 | ||
287 | int x11_connect_display(void); | 287 | int x11_connect_display(void); |
288 | int x11_create_display_inet(int, int, int, u_int *, int **); | 288 | int x11_create_display_inet(int, int, int, u_int *, int **); |
289 | void x11_input_open(int, u_int32_t, void *); | 289 | int x11_input_open(int, u_int32_t, void *); |
290 | void x11_request_forwarding_with_spoofing(int, const char *, const char *, | 290 | void x11_request_forwarding_with_spoofing(int, const char *, const char *, |
291 | const char *, int); | 291 | const char *, int); |
292 | void deny_input_open(int, u_int32_t, void *); | 292 | int deny_input_open(int, u_int32_t, void *); |
293 | 293 | ||
294 | /* agent forwarding */ | 294 | /* agent forwarding */ |
295 | 295 | ||
diff --git a/clientloop.c b/clientloop.c index 3b9700aa4..672d06989 100644 --- a/clientloop.c +++ b/clientloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: clientloop.c,v 1.263 2015/01/19 19:52:16 markus Exp $ */ | 1 | /* $OpenBSD: clientloop.c,v 1.264 2015/01/19 20:07:45 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 |
@@ -536,13 +536,13 @@ client_check_window_change(void) | |||
536 | } | 536 | } |
537 | } | 537 | } |
538 | 538 | ||
539 | static void | 539 | static int |
540 | client_global_request_reply(int type, u_int32_t seq, void *ctxt) | 540 | client_global_request_reply(int type, u_int32_t seq, void *ctxt) |
541 | { | 541 | { |
542 | struct global_confirm *gc; | 542 | struct global_confirm *gc; |
543 | 543 | ||
544 | if ((gc = TAILQ_FIRST(&global_confirms)) == NULL) | 544 | if ((gc = TAILQ_FIRST(&global_confirms)) == NULL) |
545 | return; | 545 | return 0; |
546 | if (gc->cb != NULL) | 546 | if (gc->cb != NULL) |
547 | gc->cb(type, seq, gc->ctx); | 547 | gc->cb(type, seq, gc->ctx); |
548 | if (--gc->ref_count <= 0) { | 548 | if (--gc->ref_count <= 0) { |
@@ -552,6 +552,7 @@ client_global_request_reply(int type, u_int32_t seq, void *ctxt) | |||
552 | } | 552 | } |
553 | 553 | ||
554 | packet_set_alive_timeouts(0); | 554 | packet_set_alive_timeouts(0); |
555 | return 0; | ||
555 | } | 556 | } |
556 | 557 | ||
557 | static void | 558 | static void |
@@ -1739,7 +1740,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id) | |||
1739 | 1740 | ||
1740 | /*********/ | 1741 | /*********/ |
1741 | 1742 | ||
1742 | static void | 1743 | static int |
1743 | client_input_stdout_data(int type, u_int32_t seq, void *ctxt) | 1744 | client_input_stdout_data(int type, u_int32_t seq, void *ctxt) |
1744 | { | 1745 | { |
1745 | u_int data_len; | 1746 | u_int data_len; |
@@ -1748,8 +1749,9 @@ client_input_stdout_data(int type, u_int32_t seq, void *ctxt) | |||
1748 | buffer_append(&stdout_buffer, data, data_len); | 1749 | buffer_append(&stdout_buffer, data, data_len); |
1749 | explicit_bzero(data, data_len); | 1750 | explicit_bzero(data, data_len); |
1750 | free(data); | 1751 | free(data); |
1752 | return 0; | ||
1751 | } | 1753 | } |
1752 | static void | 1754 | static int |
1753 | client_input_stderr_data(int type, u_int32_t seq, void *ctxt) | 1755 | client_input_stderr_data(int type, u_int32_t seq, void *ctxt) |
1754 | { | 1756 | { |
1755 | u_int data_len; | 1757 | u_int data_len; |
@@ -1758,8 +1760,9 @@ client_input_stderr_data(int type, u_int32_t seq, void *ctxt) | |||
1758 | buffer_append(&stderr_buffer, data, data_len); | 1760 | buffer_append(&stderr_buffer, data, data_len); |
1759 | explicit_bzero(data, data_len); | 1761 | explicit_bzero(data, data_len); |
1760 | free(data); | 1762 | free(data); |
1763 | return 0; | ||
1761 | } | 1764 | } |
1762 | static void | 1765 | static int |
1763 | client_input_exit_status(int type, u_int32_t seq, void *ctxt) | 1766 | client_input_exit_status(int type, u_int32_t seq, void *ctxt) |
1764 | { | 1767 | { |
1765 | exit_status = packet_get_int(); | 1768 | exit_status = packet_get_int(); |
@@ -1774,8 +1777,9 @@ client_input_exit_status(int type, u_int32_t seq, void *ctxt) | |||
1774 | packet_write_wait(); | 1777 | packet_write_wait(); |
1775 | /* Flag that we want to exit. */ | 1778 | /* Flag that we want to exit. */ |
1776 | quit_pending = 1; | 1779 | quit_pending = 1; |
1780 | return 0; | ||
1777 | } | 1781 | } |
1778 | static void | 1782 | static int |
1779 | client_input_agent_open(int type, u_int32_t seq, void *ctxt) | 1783 | client_input_agent_open(int type, u_int32_t seq, void *ctxt) |
1780 | { | 1784 | { |
1781 | Channel *c = NULL; | 1785 | Channel *c = NULL; |
@@ -1818,6 +1822,7 @@ client_input_agent_open(int type, u_int32_t seq, void *ctxt) | |||
1818 | packet_put_int(c->self); | 1822 | packet_put_int(c->self); |
1819 | } | 1823 | } |
1820 | packet_send(); | 1824 | packet_send(); |
1825 | return 0; | ||
1821 | } | 1826 | } |
1822 | 1827 | ||
1823 | static Channel * | 1828 | static Channel * |
@@ -1978,7 +1983,7 @@ client_request_tun_fwd(int tun_mode, int local_tun, int remote_tun) | |||
1978 | } | 1983 | } |
1979 | 1984 | ||
1980 | /* XXXX move to generic input handler */ | 1985 | /* XXXX move to generic input handler */ |
1981 | static void | 1986 | static int |
1982 | client_input_channel_open(int type, u_int32_t seq, void *ctxt) | 1987 | client_input_channel_open(int type, u_int32_t seq, void *ctxt) |
1983 | { | 1988 | { |
1984 | Channel *c = NULL; | 1989 | Channel *c = NULL; |
@@ -2029,8 +2034,9 @@ client_input_channel_open(int type, u_int32_t seq, void *ctxt) | |||
2029 | packet_send(); | 2034 | packet_send(); |
2030 | } | 2035 | } |
2031 | free(ctype); | 2036 | free(ctype); |
2037 | return 0; | ||
2032 | } | 2038 | } |
2033 | static void | 2039 | static int |
2034 | client_input_channel_req(int type, u_int32_t seq, void *ctxt) | 2040 | client_input_channel_req(int type, u_int32_t seq, void *ctxt) |
2035 | { | 2041 | { |
2036 | Channel *c = NULL; | 2042 | Channel *c = NULL; |
@@ -2075,8 +2081,9 @@ client_input_channel_req(int type, u_int32_t seq, void *ctxt) | |||
2075 | packet_send(); | 2081 | packet_send(); |
2076 | } | 2082 | } |
2077 | free(rtype); | 2083 | free(rtype); |
2084 | return 0; | ||
2078 | } | 2085 | } |
2079 | static void | 2086 | static int |
2080 | client_input_global_request(int type, u_int32_t seq, void *ctxt) | 2087 | client_input_global_request(int type, u_int32_t seq, void *ctxt) |
2081 | { | 2088 | { |
2082 | char *rtype; | 2089 | char *rtype; |
@@ -2094,6 +2101,7 @@ client_input_global_request(int type, u_int32_t seq, void *ctxt) | |||
2094 | packet_write_wait(); | 2101 | packet_write_wait(); |
2095 | } | 2102 | } |
2096 | free(rtype); | 2103 | free(rtype); |
2104 | return 0; | ||
2097 | } | 2105 | } |
2098 | 2106 | ||
2099 | void | 2107 | void |
diff --git a/dispatch.c b/dispatch.c index 64bb80947..70fa84f70 100644 --- a/dispatch.c +++ b/dispatch.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dispatch.c,v 1.22 2008/10/31 15:05:34 stevesk Exp $ */ | 1 | /* $OpenBSD: dispatch.c,v 1.23 2015/01/19 20:07:45 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -36,69 +36,107 @@ | |||
36 | #include "dispatch.h" | 36 | #include "dispatch.h" |
37 | #include "packet.h" | 37 | #include "packet.h" |
38 | #include "compat.h" | 38 | #include "compat.h" |
39 | #include "ssherr.h" | ||
39 | 40 | ||
40 | #define DISPATCH_MAX 255 | 41 | int |
41 | 42 | dispatch_protocol_error(int type, u_int32_t seq, void *ctx) | |
42 | dispatch_fn *dispatch[DISPATCH_MAX]; | ||
43 | |||
44 | void | ||
45 | dispatch_protocol_error(int type, u_int32_t seq, void *ctxt) | ||
46 | { | 43 | { |
44 | struct ssh *ssh = active_state; /* XXX */ | ||
45 | int r; | ||
46 | |||
47 | logit("dispatch_protocol_error: type %d seq %u", type, seq); | 47 | logit("dispatch_protocol_error: type %d seq %u", type, seq); |
48 | if (!compat20) | 48 | if (!compat20) |
49 | fatal("protocol error"); | 49 | fatal("protocol error"); |
50 | packet_start(SSH2_MSG_UNIMPLEMENTED); | 50 | if ((r = sshpkt_start(ssh, SSH2_MSG_UNIMPLEMENTED)) != 0 || |
51 | packet_put_int(seq); | 51 | (r = sshpkt_put_u32(ssh, seq)) != 0 || |
52 | packet_send(); | 52 | (r = sshpkt_send(ssh)) != 0) |
53 | packet_write_wait(); | 53 | fatal("%s: %s", __func__, ssh_err(r)); |
54 | ssh_packet_write_wait(ssh); | ||
55 | return 0; | ||
54 | } | 56 | } |
55 | void | 57 | |
56 | dispatch_protocol_ignore(int type, u_int32_t seq, void *ctxt) | 58 | int |
59 | dispatch_protocol_ignore(int type, u_int32_t seq, void *ssh) | ||
57 | { | 60 | { |
58 | logit("dispatch_protocol_ignore: type %d seq %u", type, seq); | 61 | logit("dispatch_protocol_ignore: type %d seq %u", type, seq); |
62 | return 0; | ||
59 | } | 63 | } |
64 | |||
60 | void | 65 | void |
61 | dispatch_init(dispatch_fn *dflt) | 66 | ssh_dispatch_init(struct ssh *ssh, dispatch_fn *dflt) |
62 | { | 67 | { |
63 | u_int i; | 68 | u_int i; |
64 | for (i = 0; i < DISPATCH_MAX; i++) | 69 | for (i = 0; i < DISPATCH_MAX; i++) |
65 | dispatch[i] = dflt; | 70 | ssh->dispatch[i] = dflt; |
66 | } | 71 | } |
72 | |||
67 | void | 73 | void |
68 | dispatch_range(u_int from, u_int to, dispatch_fn *fn) | 74 | ssh_dispatch_range(struct ssh *ssh, u_int from, u_int to, dispatch_fn *fn) |
69 | { | 75 | { |
70 | u_int i; | 76 | u_int i; |
71 | 77 | ||
72 | for (i = from; i <= to; i++) { | 78 | for (i = from; i <= to; i++) { |
73 | if (i >= DISPATCH_MAX) | 79 | if (i >= DISPATCH_MAX) |
74 | break; | 80 | break; |
75 | dispatch[i] = fn; | 81 | ssh->dispatch[i] = fn; |
76 | } | 82 | } |
77 | } | 83 | } |
84 | |||
78 | void | 85 | void |
79 | dispatch_set(int type, dispatch_fn *fn) | 86 | ssh_dispatch_set(struct ssh *ssh, int type, dispatch_fn *fn) |
80 | { | 87 | { |
81 | dispatch[type] = fn; | 88 | ssh->dispatch[type] = fn; |
82 | } | 89 | } |
83 | void | 90 | |
84 | dispatch_run(int mode, volatile sig_atomic_t *done, void *ctxt) | 91 | int |
92 | ssh_dispatch_run(struct ssh *ssh, int mode, volatile sig_atomic_t *done, | ||
93 | void *ctxt) | ||
85 | { | 94 | { |
86 | for (;;) { | 95 | int r; |
87 | int type; | 96 | u_char type; |
88 | u_int32_t seqnr; | 97 | u_int32_t seqnr; |
89 | 98 | ||
99 | for (;;) { | ||
90 | if (mode == DISPATCH_BLOCK) { | 100 | if (mode == DISPATCH_BLOCK) { |
91 | type = packet_read_seqnr(&seqnr); | 101 | r = ssh_packet_read_seqnr(ssh, &type, &seqnr); |
102 | if (r != 0) | ||
103 | return r; | ||
92 | } else { | 104 | } else { |
93 | type = packet_read_poll_seqnr(&seqnr); | 105 | r = ssh_packet_read_poll_seqnr(ssh, &type, &seqnr); |
106 | if (r != 0) | ||
107 | return r; | ||
94 | if (type == SSH_MSG_NONE) | 108 | if (type == SSH_MSG_NONE) |
95 | return; | 109 | return 0; |
110 | } | ||
111 | if (type > 0 && type < DISPATCH_MAX && | ||
112 | ssh->dispatch[type] != NULL) { | ||
113 | if (ssh->dispatch_skip_packets) { | ||
114 | debug2("skipped packet (type %u)", type); | ||
115 | ssh->dispatch_skip_packets--; | ||
116 | continue; | ||
117 | } | ||
118 | /* XXX 'ssh' will replace 'ctxt' later */ | ||
119 | r = (*ssh->dispatch[type])(type, seqnr, ctxt); | ||
120 | if (r != 0) | ||
121 | return r; | ||
122 | } else { | ||
123 | r = sshpkt_disconnect(ssh, | ||
124 | "protocol error: rcvd type %d", type); | ||
125 | if (r != 0) | ||
126 | return r; | ||
127 | return SSH_ERR_DISCONNECTED; | ||
96 | } | 128 | } |
97 | if (type > 0 && type < DISPATCH_MAX && dispatch[type] != NULL) | ||
98 | (*dispatch[type])(type, seqnr, ctxt); | ||
99 | else | ||
100 | packet_disconnect("protocol error: rcvd type %d", type); | ||
101 | if (done != NULL && *done) | 129 | if (done != NULL && *done) |
102 | return; | 130 | return 0; |
103 | } | 131 | } |
104 | } | 132 | } |
133 | |||
134 | void | ||
135 | ssh_dispatch_run_fatal(struct ssh *ssh, int mode, volatile sig_atomic_t *done, | ||
136 | void *ctxt) | ||
137 | { | ||
138 | int r; | ||
139 | |||
140 | if ((r = ssh_dispatch_run(ssh, mode, done, ctxt)) != 0) | ||
141 | fatal("%s: %s", __func__, ssh_err(r)); | ||
142 | } | ||
diff --git a/dispatch.h b/dispatch.h index 3e3d1a1ad..cd51dbc0b 100644 --- a/dispatch.h +++ b/dispatch.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dispatch.h,v 1.11 2006/04/20 09:27:09 djm Exp $ */ | 1 | /* $OpenBSD: dispatch.h,v 1.12 2015/01/19 20:07:45 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 4 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
@@ -24,18 +24,35 @@ | |||
24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #include <signal.h> | 27 | #ifndef DISPATCH_H |
28 | #define DISPATCH_H | ||
29 | |||
30 | #define DISPATCH_MAX 255 | ||
28 | 31 | ||
29 | enum { | 32 | enum { |
30 | DISPATCH_BLOCK, | 33 | DISPATCH_BLOCK, |
31 | DISPATCH_NONBLOCK | 34 | DISPATCH_NONBLOCK |
32 | }; | 35 | }; |
33 | 36 | ||
34 | typedef void dispatch_fn(int, u_int32_t, void *); | 37 | struct ssh; |
38 | |||
39 | typedef int dispatch_fn(int, u_int32_t, void *); | ||
40 | |||
41 | int dispatch_protocol_error(int, u_int32_t, void *); | ||
42 | int dispatch_protocol_ignore(int, u_int32_t, void *); | ||
43 | void ssh_dispatch_init(struct ssh *, 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 *); | ||
46 | int ssh_dispatch_run(struct ssh *, int, volatile sig_atomic_t *, void *); | ||
47 | void ssh_dispatch_run_fatal(struct ssh *, int, volatile sig_atomic_t *, void *); | ||
48 | |||
49 | #define dispatch_init(dflt) \ | ||
50 | ssh_dispatch_init(active_state, (dflt)) | ||
51 | #define dispatch_range(from, to, fn) \ | ||
52 | ssh_dispatch_range(active_state, (from), (to), (fn)) | ||
53 | #define dispatch_set(type, fn) \ | ||
54 | ssh_dispatch_set(active_state, (type), (fn)) | ||
55 | #define dispatch_run(mode, done, ctxt) \ | ||
56 | ssh_dispatch_run_fatal(active_state, (mode), (done), (ctxt)) | ||
35 | 57 | ||
36 | void dispatch_init(dispatch_fn *); | 58 | #endif |
37 | void dispatch_set(int, dispatch_fn *); | ||
38 | void dispatch_range(u_int, u_int, dispatch_fn *); | ||
39 | void dispatch_run(int, volatile sig_atomic_t *, void *); | ||
40 | void dispatch_protocol_error(int, u_int32_t, void *); | ||
41 | void dispatch_protocol_ignore(int, u_int32_t, void *); | ||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kex.c,v 1.100 2015/01/19 19:52:16 markus Exp $ */ | 1 | /* $OpenBSD: kex.c,v 1.101 2015/01/19 20:07:45 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 | * |
@@ -209,10 +209,11 @@ kex_prop_free(char **proposal) | |||
209 | } | 209 | } |
210 | 210 | ||
211 | /* ARGSUSED */ | 211 | /* ARGSUSED */ |
212 | static void | 212 | static int |
213 | kex_protocol_error(int type, u_int32_t seq, void *ctxt) | 213 | kex_protocol_error(int type, u_int32_t seq, void *ctxt) |
214 | { | 214 | { |
215 | error("Hm, kex protocol error: type %d seq %u", type, seq); | 215 | error("Hm, kex protocol error: type %d seq %u", type, seq); |
216 | return 0; | ||
216 | } | 217 | } |
217 | 218 | ||
218 | static void | 219 | static void |
@@ -281,7 +282,7 @@ kex_send_kexinit(Kex *kex) | |||
281 | } | 282 | } |
282 | 283 | ||
283 | /* ARGSUSED */ | 284 | /* ARGSUSED */ |
284 | void | 285 | int |
285 | kex_input_kexinit(int type, u_int32_t seq, void *ctxt) | 286 | kex_input_kexinit(int type, u_int32_t seq, void *ctxt) |
286 | { | 287 | { |
287 | const char *ptr; | 288 | const char *ptr; |
@@ -316,6 +317,7 @@ kex_input_kexinit(int type, u_int32_t seq, void *ctxt) | |||
316 | packet_check_eom(); | 317 | packet_check_eom(); |
317 | 318 | ||
318 | kex_kexinit_finish(kex); | 319 | kex_kexinit_finish(kex); |
320 | return 0; | ||
319 | } | 321 | } |
320 | 322 | ||
321 | void | 323 | void |
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: kex.h,v 1.67 2015/01/19 19:52:16 markus Exp $ */ | 1 | /* $OpenBSD: kex.h,v 1.68 2015/01/19 20:07:45 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. |
@@ -143,7 +143,7 @@ void kex_finish(Kex *); | |||
143 | void kex_free_newkeys(struct newkeys *); | 143 | void kex_free_newkeys(struct newkeys *); |
144 | 144 | ||
145 | void kex_send_kexinit(Kex *); | 145 | void kex_send_kexinit(Kex *); |
146 | void kex_input_kexinit(int, u_int32_t, void *); | 146 | int kex_input_kexinit(int, u_int32_t, void *); |
147 | void kex_derive_keys(Kex *, u_char *, u_int, const u_char *, u_int); | 147 | void kex_derive_keys(Kex *, u_char *, u_int, const u_char *, u_int); |
148 | void kex_derive_keys_bn(Kex *, u_char *, u_int, const BIGNUM *); | 148 | void kex_derive_keys_bn(Kex *, u_char *, u_int, const BIGNUM *); |
149 | 149 | ||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: packet.h,v 1.62 2015/01/19 19:52:16 markus Exp $ */ | 1 | /* $OpenBSD: packet.h,v 1.63 2015/01/19 20:07:45 markus Exp $ */ |
2 | 2 | ||
3 | /* | 3 | /* |
4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 4 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
@@ -32,6 +32,8 @@ struct sshkey; | |||
32 | struct sshbuf; | 32 | struct sshbuf; |
33 | struct session_state; /* private session data */ | 33 | struct session_state; /* private session data */ |
34 | 34 | ||
35 | #include "dispatch.h" /* typedef, DISPATCH_MAX */ | ||
36 | |||
35 | struct ssh { | 37 | struct ssh { |
36 | /* Session state */ | 38 | /* Session state */ |
37 | struct session_state *state; | 39 | struct session_state *state; |
@@ -43,6 +45,11 @@ struct ssh { | |||
43 | char *remote_ipaddr; | 45 | char *remote_ipaddr; |
44 | int remote_port; | 46 | int remote_port; |
45 | 47 | ||
48 | /* Dispatcher table */ | ||
49 | dispatch_fn *dispatch[DISPATCH_MAX]; | ||
50 | /* number of packets to ignore in the dispatcher */ | ||
51 | int dispatch_skip_packets; | ||
52 | |||
46 | /* datafellows */ | 53 | /* datafellows */ |
47 | int compat; | 54 | int compat; |
48 | }; | 55 | }; |
diff --git a/serverloop.c b/serverloop.c index f1fbb0512..edf6a813f 100644 --- a/serverloop.c +++ b/serverloop.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: serverloop.c,v 1.173 2015/01/19 19:52:16 markus Exp $ */ | 1 | /* $OpenBSD: serverloop.c,v 1.174 2015/01/19 20:07:45 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 |
@@ -894,7 +894,7 @@ server_loop2(Authctxt *authctxt) | |||
894 | session_destroy_all(NULL); | 894 | session_destroy_all(NULL); |
895 | } | 895 | } |
896 | 896 | ||
897 | static void | 897 | static int |
898 | server_input_keep_alive(int type, u_int32_t seq, void *ctxt) | 898 | server_input_keep_alive(int type, u_int32_t seq, void *ctxt) |
899 | { | 899 | { |
900 | debug("Got %d/%u for keepalive", type, seq); | 900 | debug("Got %d/%u for keepalive", type, seq); |
@@ -904,9 +904,10 @@ server_input_keep_alive(int type, u_int32_t seq, void *ctxt) | |||
904 | * the bogus CHANNEL_REQUEST we send for keepalives. | 904 | * the bogus CHANNEL_REQUEST we send for keepalives. |
905 | */ | 905 | */ |
906 | packet_set_alive_timeouts(0); | 906 | packet_set_alive_timeouts(0); |
907 | return 0; | ||
907 | } | 908 | } |
908 | 909 | ||
909 | static void | 910 | static int |
910 | server_input_stdin_data(int type, u_int32_t seq, void *ctxt) | 911 | server_input_stdin_data(int type, u_int32_t seq, void *ctxt) |
911 | { | 912 | { |
912 | char *data; | 913 | char *data; |
@@ -915,15 +916,16 @@ server_input_stdin_data(int type, u_int32_t seq, void *ctxt) | |||
915 | /* Stdin data from the client. Append it to the buffer. */ | 916 | /* Stdin data from the client. Append it to the buffer. */ |
916 | /* Ignore any data if the client has closed stdin. */ | 917 | /* Ignore any data if the client has closed stdin. */ |
917 | if (fdin == -1) | 918 | if (fdin == -1) |
918 | return; | 919 | return 0; |
919 | data = packet_get_string(&data_len); | 920 | data = packet_get_string(&data_len); |
920 | packet_check_eom(); | 921 | packet_check_eom(); |
921 | buffer_append(&stdin_buffer, data, data_len); | 922 | buffer_append(&stdin_buffer, data, data_len); |
922 | explicit_bzero(data, data_len); | 923 | explicit_bzero(data, data_len); |
923 | free(data); | 924 | free(data); |
925 | return 0; | ||
924 | } | 926 | } |
925 | 927 | ||
926 | static void | 928 | static int |
927 | server_input_eof(int type, u_int32_t seq, void *ctxt) | 929 | server_input_eof(int type, u_int32_t seq, void *ctxt) |
928 | { | 930 | { |
929 | /* | 931 | /* |
@@ -934,9 +936,10 @@ server_input_eof(int type, u_int32_t seq, void *ctxt) | |||
934 | debug("EOF received for stdin."); | 936 | debug("EOF received for stdin."); |
935 | packet_check_eom(); | 937 | packet_check_eom(); |
936 | stdin_eof = 1; | 938 | stdin_eof = 1; |
939 | return 0; | ||
937 | } | 940 | } |
938 | 941 | ||
939 | static void | 942 | static int |
940 | server_input_window_size(int type, u_int32_t seq, void *ctxt) | 943 | server_input_window_size(int type, u_int32_t seq, void *ctxt) |
941 | { | 944 | { |
942 | u_int row = packet_get_int(); | 945 | u_int row = packet_get_int(); |
@@ -948,6 +951,7 @@ server_input_window_size(int type, u_int32_t seq, void *ctxt) | |||
948 | packet_check_eom(); | 951 | packet_check_eom(); |
949 | if (fdin != -1) | 952 | if (fdin != -1) |
950 | pty_change_window_size(fdin, row, col, xpixel, ypixel); | 953 | pty_change_window_size(fdin, row, col, xpixel, ypixel); |
954 | return 0; | ||
951 | } | 955 | } |
952 | 956 | ||
953 | static Channel * | 957 | static Channel * |
@@ -1092,7 +1096,7 @@ server_request_session(void) | |||
1092 | return c; | 1096 | return c; |
1093 | } | 1097 | } |
1094 | 1098 | ||
1095 | static void | 1099 | static int |
1096 | server_input_channel_open(int type, u_int32_t seq, void *ctxt) | 1100 | server_input_channel_open(int type, u_int32_t seq, void *ctxt) |
1097 | { | 1101 | { |
1098 | Channel *c = NULL; | 1102 | Channel *c = NULL; |
@@ -1142,9 +1146,10 @@ server_input_channel_open(int type, u_int32_t seq, void *ctxt) | |||
1142 | packet_send(); | 1146 | packet_send(); |
1143 | } | 1147 | } |
1144 | free(ctype); | 1148 | free(ctype); |
1149 | return 0; | ||
1145 | } | 1150 | } |
1146 | 1151 | ||
1147 | static void | 1152 | static int |
1148 | server_input_global_request(int type, u_int32_t seq, void *ctxt) | 1153 | server_input_global_request(int type, u_int32_t seq, void *ctxt) |
1149 | { | 1154 | { |
1150 | char *rtype; | 1155 | char *rtype; |
@@ -1239,9 +1244,10 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt) | |||
1239 | packet_write_wait(); | 1244 | packet_write_wait(); |
1240 | } | 1245 | } |
1241 | free(rtype); | 1246 | free(rtype); |
1247 | return 0; | ||
1242 | } | 1248 | } |
1243 | 1249 | ||
1244 | static void | 1250 | static int |
1245 | server_input_channel_req(int type, u_int32_t seq, void *ctxt) | 1251 | server_input_channel_req(int type, u_int32_t seq, void *ctxt) |
1246 | { | 1252 | { |
1247 | Channel *c; | 1253 | Channel *c; |
@@ -1271,6 +1277,7 @@ server_input_channel_req(int type, u_int32_t seq, void *ctxt) | |||
1271 | packet_send(); | 1277 | packet_send(); |
1272 | } | 1278 | } |
1273 | free(rtype); | 1279 | free(rtype); |
1280 | return 0; | ||
1274 | } | 1281 | } |
1275 | 1282 | ||
1276 | static void | 1283 | static void |
diff --git a/sshconnect2.c b/sshconnect2.c index ba34762ea..e0d129996 100644 --- a/sshconnect2.c +++ b/sshconnect2.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect2.c,v 1.217 2015/01/19 19:52:16 markus Exp $ */ | 1 | /* $OpenBSD: sshconnect2.c,v 1.218 2015/01/19 20:07:45 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. |
@@ -285,14 +285,14 @@ struct cauthmethod { | |||
285 | int *batch_flag; /* flag in option struct that disables method */ | 285 | int *batch_flag; /* flag in option struct that disables method */ |
286 | }; | 286 | }; |
287 | 287 | ||
288 | void input_userauth_success(int, u_int32_t, void *); | 288 | int input_userauth_success(int, u_int32_t, void *); |
289 | void input_userauth_success_unexpected(int, u_int32_t, void *); | 289 | int input_userauth_success_unexpected(int, u_int32_t, void *); |
290 | void input_userauth_failure(int, u_int32_t, void *); | 290 | int input_userauth_failure(int, u_int32_t, void *); |
291 | void input_userauth_banner(int, u_int32_t, void *); | 291 | int input_userauth_banner(int, u_int32_t, void *); |
292 | void input_userauth_error(int, u_int32_t, void *); | 292 | int input_userauth_error(int, u_int32_t, void *); |
293 | void input_userauth_info_req(int, u_int32_t, void *); | 293 | int input_userauth_info_req(int, u_int32_t, void *); |
294 | void input_userauth_pk_ok(int, u_int32_t, void *); | 294 | int input_userauth_pk_ok(int, u_int32_t, void *); |
295 | void input_userauth_passwd_changereq(int, u_int32_t, void *); | 295 | int input_userauth_passwd_changereq(int, u_int32_t, void *); |
296 | 296 | ||
297 | int userauth_none(Authctxt *); | 297 | int userauth_none(Authctxt *); |
298 | int userauth_pubkey(Authctxt *); | 298 | int userauth_pubkey(Authctxt *); |
@@ -302,11 +302,11 @@ int userauth_hostbased(Authctxt *); | |||
302 | 302 | ||
303 | #ifdef GSSAPI | 303 | #ifdef GSSAPI |
304 | int userauth_gssapi(Authctxt *authctxt); | 304 | int userauth_gssapi(Authctxt *authctxt); |
305 | void input_gssapi_response(int type, u_int32_t, void *); | 305 | int input_gssapi_response(int type, u_int32_t, void *); |
306 | void input_gssapi_token(int type, u_int32_t, void *); | 306 | int input_gssapi_token(int type, u_int32_t, void *); |
307 | void input_gssapi_hash(int type, u_int32_t, void *); | 307 | int input_gssapi_hash(int type, u_int32_t, void *); |
308 | void input_gssapi_error(int, u_int32_t, void *); | 308 | int input_gssapi_error(int, u_int32_t, void *); |
309 | void input_gssapi_errtok(int, u_int32_t, void *); | 309 | int input_gssapi_errtok(int, u_int32_t, void *); |
310 | #endif | 310 | #endif |
311 | 311 | ||
312 | void userauth(Authctxt *, char *); | 312 | void userauth(Authctxt *, char *); |
@@ -455,15 +455,16 @@ userauth(Authctxt *authctxt, char *authlist) | |||
455 | } | 455 | } |
456 | 456 | ||
457 | /* ARGSUSED */ | 457 | /* ARGSUSED */ |
458 | void | 458 | int |
459 | input_userauth_error(int type, u_int32_t seq, void *ctxt) | 459 | input_userauth_error(int type, u_int32_t seq, void *ctxt) |
460 | { | 460 | { |
461 | fatal("input_userauth_error: bad message during authentication: " | 461 | fatal("input_userauth_error: bad message during authentication: " |
462 | "type %d", type); | 462 | "type %d", type); |
463 | return 0; | ||
463 | } | 464 | } |
464 | 465 | ||
465 | /* ARGSUSED */ | 466 | /* ARGSUSED */ |
466 | void | 467 | int |
467 | input_userauth_banner(int type, u_int32_t seq, void *ctxt) | 468 | input_userauth_banner(int type, u_int32_t seq, void *ctxt) |
468 | { | 469 | { |
469 | char *msg, *raw, *lang; | 470 | char *msg, *raw, *lang; |
@@ -482,10 +483,11 @@ input_userauth_banner(int type, u_int32_t seq, void *ctxt) | |||
482 | } | 483 | } |
483 | free(raw); | 484 | free(raw); |
484 | free(lang); | 485 | free(lang); |
486 | return 0; | ||
485 | } | 487 | } |
486 | 488 | ||
487 | /* ARGSUSED */ | 489 | /* ARGSUSED */ |
488 | void | 490 | int |
489 | input_userauth_success(int type, u_int32_t seq, void *ctxt) | 491 | input_userauth_success(int type, u_int32_t seq, void *ctxt) |
490 | { | 492 | { |
491 | Authctxt *authctxt = ctxt; | 493 | Authctxt *authctxt = ctxt; |
@@ -499,9 +501,10 @@ input_userauth_success(int type, u_int32_t seq, void *ctxt) | |||
499 | free(authctxt->methoddata); | 501 | free(authctxt->methoddata); |
500 | authctxt->methoddata = NULL; | 502 | authctxt->methoddata = NULL; |
501 | authctxt->success = 1; /* break out */ | 503 | authctxt->success = 1; /* break out */ |
504 | return 0; | ||
502 | } | 505 | } |
503 | 506 | ||
504 | void | 507 | int |
505 | input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt) | 508 | input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt) |
506 | { | 509 | { |
507 | Authctxt *authctxt = ctxt; | 510 | Authctxt *authctxt = ctxt; |
@@ -511,10 +514,11 @@ input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt) | |||
511 | 514 | ||
512 | fatal("Unexpected authentication success during %s.", | 515 | fatal("Unexpected authentication success during %s.", |
513 | authctxt->method->name); | 516 | authctxt->method->name); |
517 | return 0; | ||
514 | } | 518 | } |
515 | 519 | ||
516 | /* ARGSUSED */ | 520 | /* ARGSUSED */ |
517 | void | 521 | int |
518 | input_userauth_failure(int type, u_int32_t seq, void *ctxt) | 522 | input_userauth_failure(int type, u_int32_t seq, void *ctxt) |
519 | { | 523 | { |
520 | Authctxt *authctxt = ctxt; | 524 | Authctxt *authctxt = ctxt; |
@@ -537,10 +541,11 @@ input_userauth_failure(int type, u_int32_t seq, void *ctxt) | |||
537 | debug("Authentications that can continue: %s", authlist); | 541 | debug("Authentications that can continue: %s", authlist); |
538 | 542 | ||
539 | userauth(authctxt, authlist); | 543 | userauth(authctxt, authlist); |
544 | return 0; | ||
540 | } | 545 | } |
541 | 546 | ||
542 | /* ARGSUSED */ | 547 | /* ARGSUSED */ |
543 | void | 548 | int |
544 | input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt) | 549 | input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt) |
545 | { | 550 | { |
546 | Authctxt *authctxt = ctxt; | 551 | Authctxt *authctxt = ctxt; |
@@ -608,6 +613,7 @@ done: | |||
608 | /* try another method if we did not send a packet */ | 613 | /* try another method if we did not send a packet */ |
609 | if (sent == 0) | 614 | if (sent == 0) |
610 | userauth(authctxt, NULL); | 615 | userauth(authctxt, NULL); |
616 | return 0; | ||
611 | } | 617 | } |
612 | 618 | ||
613 | #ifdef GSSAPI | 619 | #ifdef GSSAPI |
@@ -891,7 +897,7 @@ userauth_passwd(Authctxt *authctxt) | |||
891 | * parse PASSWD_CHANGEREQ, prompt user and send SSH2_MSG_USERAUTH_REQUEST | 897 | * parse PASSWD_CHANGEREQ, prompt user and send SSH2_MSG_USERAUTH_REQUEST |
892 | */ | 898 | */ |
893 | /* ARGSUSED */ | 899 | /* ARGSUSED */ |
894 | void | 900 | int |
895 | input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) | 901 | input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) |
896 | { | 902 | { |
897 | Authctxt *authctxt = ctxt; | 903 | Authctxt *authctxt = ctxt; |
@@ -932,7 +938,7 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) | |||
932 | password = read_passphrase(prompt, RP_ALLOW_EOF); | 938 | password = read_passphrase(prompt, RP_ALLOW_EOF); |
933 | if (password == NULL) { | 939 | if (password == NULL) { |
934 | /* bail out */ | 940 | /* bail out */ |
935 | return; | 941 | return 0; |
936 | } | 942 | } |
937 | snprintf(prompt, sizeof(prompt), | 943 | snprintf(prompt, sizeof(prompt), |
938 | "Retype %.30s@%.128s's new password: ", | 944 | "Retype %.30s@%.128s's new password: ", |
@@ -955,6 +961,7 @@ input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) | |||
955 | 961 | ||
956 | dispatch_set(SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ, | 962 | dispatch_set(SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ, |
957 | &input_userauth_passwd_changereq); | 963 | &input_userauth_passwd_changereq); |
964 | return 0; | ||
958 | } | 965 | } |
959 | 966 | ||
960 | static int | 967 | static int |
@@ -1379,7 +1386,7 @@ userauth_kbdint(Authctxt *authctxt) | |||
1379 | /* | 1386 | /* |
1380 | * parse INFO_REQUEST, prompt user and send INFO_RESPONSE | 1387 | * parse INFO_REQUEST, prompt user and send INFO_RESPONSE |
1381 | */ | 1388 | */ |
1382 | void | 1389 | int |
1383 | input_userauth_info_req(int type, u_int32_t seq, void *ctxt) | 1390 | input_userauth_info_req(int type, u_int32_t seq, void *ctxt) |
1384 | { | 1391 | { |
1385 | Authctxt *authctxt = ctxt; | 1392 | Authctxt *authctxt = ctxt; |
@@ -1431,6 +1438,7 @@ input_userauth_info_req(int type, u_int32_t seq, void *ctxt) | |||
1431 | 1438 | ||
1432 | packet_add_padding(64); | 1439 | packet_add_padding(64); |
1433 | packet_send(); | 1440 | packet_send(); |
1441 | return 0; | ||
1434 | } | 1442 | } |
1435 | 1443 | ||
1436 | static int | 1444 | static int |