diff options
author | markus@openbsd.org <markus@openbsd.org> | 2015-01-19 20:07:45 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2015-01-20 09:14:16 +1100 |
commit | 3fdc88a0def4f86aa88a5846ac079dc964c0546a (patch) | |
tree | d26470c8ffb49bb4417af2b729d933d6ce3f75f8 /sshconnect2.c | |
parent | 091c302829210c41e7f57c3f094c7b9c054306f0 (diff) |
upstream commit
move dispatch to struct ssh; ok djm@
Diffstat (limited to 'sshconnect2.c')
-rw-r--r-- | sshconnect2.c | 54 |
1 files changed, 31 insertions, 23 deletions
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 |