diff options
author | markus@openbsd.org <markus@openbsd.org> | 2017-05-30 14:23:52 +0000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2017-05-31 10:50:05 +1000 |
commit | 2ae666a8fc20b3b871b2f1b90ad65cc027336ccd (patch) | |
tree | f13f1c949ae60c16160acebbfb680c3dc7b13fe5 /sshconnect2.c | |
parent | 94583beb24a6c5fd19cedb9104ab2d2d5cd052b6 (diff) |
upstream commit
protocol handlers all get struct ssh passed; ok djm@
Upstream-ID: 0ca9ea2a5d01a6d2ded94c5024456a930c5bfb5d
Diffstat (limited to 'sshconnect2.c')
-rw-r--r-- | sshconnect2.c | 72 |
1 files changed, 31 insertions, 41 deletions
diff --git a/sshconnect2.c b/sshconnect2.c index affc5667f..dab905b58 100644 --- a/sshconnect2.c +++ b/sshconnect2.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshconnect2.c,v 1.260 2017/05/30 14:19:15 markus Exp $ */ | 1 | /* $OpenBSD: sshconnect2.c,v 1.261 2017/05/30 14:23:52 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * Copyright (c) 2008 Damien Miller. All rights reserved. | 4 | * Copyright (c) 2008 Damien Miller. All rights reserved. |
@@ -287,16 +287,16 @@ struct cauthmethod { | |||
287 | int *batch_flag; /* flag in option struct that disables method */ | 287 | int *batch_flag; /* flag in option struct that disables method */ |
288 | }; | 288 | }; |
289 | 289 | ||
290 | int input_userauth_service_accept(int, u_int32_t, void *); | 290 | int input_userauth_service_accept(int, u_int32_t, struct ssh *); |
291 | int input_userauth_ext_info(int, u_int32_t, void *); | 291 | int input_userauth_ext_info(int, u_int32_t, struct ssh *); |
292 | int input_userauth_success(int, u_int32_t, void *); | 292 | int input_userauth_success(int, u_int32_t, struct ssh *); |
293 | int input_userauth_success_unexpected(int, u_int32_t, void *); | 293 | int input_userauth_success_unexpected(int, u_int32_t, struct ssh *); |
294 | int input_userauth_failure(int, u_int32_t, void *); | 294 | int input_userauth_failure(int, u_int32_t, struct ssh *); |
295 | int input_userauth_banner(int, u_int32_t, void *); | 295 | int input_userauth_banner(int, u_int32_t, struct ssh *); |
296 | int input_userauth_error(int, u_int32_t, void *); | 296 | int input_userauth_error(int, u_int32_t, struct ssh *); |
297 | int input_userauth_info_req(int, u_int32_t, void *); | 297 | int input_userauth_info_req(int, u_int32_t, struct ssh *); |
298 | int input_userauth_pk_ok(int, u_int32_t, void *); | 298 | int input_userauth_pk_ok(int, u_int32_t, struct ssh *); |
299 | int input_userauth_passwd_changereq(int, u_int32_t, void *); | 299 | int input_userauth_passwd_changereq(int, u_int32_t, struct ssh *); |
300 | 300 | ||
301 | int userauth_none(Authctxt *); | 301 | int userauth_none(Authctxt *); |
302 | int userauth_pubkey(Authctxt *); | 302 | int userauth_pubkey(Authctxt *); |
@@ -306,11 +306,11 @@ int userauth_hostbased(Authctxt *); | |||
306 | 306 | ||
307 | #ifdef GSSAPI | 307 | #ifdef GSSAPI |
308 | int userauth_gssapi(Authctxt *authctxt); | 308 | int userauth_gssapi(Authctxt *authctxt); |
309 | int input_gssapi_response(int type, u_int32_t, void *); | 309 | int input_gssapi_response(int type, u_int32_t, struct ssh *); |
310 | int input_gssapi_token(int type, u_int32_t, void *); | 310 | int input_gssapi_token(int type, u_int32_t, struct ssh *); |
311 | int input_gssapi_hash(int type, u_int32_t, void *); | 311 | int input_gssapi_hash(int type, u_int32_t, struct ssh *); |
312 | int input_gssapi_error(int, u_int32_t, void *); | 312 | int input_gssapi_error(int, u_int32_t, struct ssh *); |
313 | int input_gssapi_errtok(int, u_int32_t, void *); | 313 | int input_gssapi_errtok(int, u_int32_t, struct ssh *); |
314 | #endif | 314 | #endif |
315 | 315 | ||
316 | void userauth(Authctxt *, char *); | 316 | void userauth(Authctxt *, char *); |
@@ -414,9 +414,8 @@ ssh_userauth2(const char *local_user, const char *server_user, char *host, | |||
414 | 414 | ||
415 | /* ARGSUSED */ | 415 | /* ARGSUSED */ |
416 | int | 416 | int |
417 | input_userauth_service_accept(int type, u_int32_t seqnr, void *ctxt) | 417 | input_userauth_service_accept(int type, u_int32_t seq, struct ssh *ssh) |
418 | { | 418 | { |
419 | struct ssh *ssh = ctxt; | ||
420 | Authctxt *authctxt = ssh->authctxt; | 419 | Authctxt *authctxt = ssh->authctxt; |
421 | int r; | 420 | int r; |
422 | 421 | ||
@@ -448,9 +447,9 @@ input_userauth_service_accept(int type, u_int32_t seqnr, void *ctxt) | |||
448 | 447 | ||
449 | /* ARGSUSED */ | 448 | /* ARGSUSED */ |
450 | int | 449 | int |
451 | input_userauth_ext_info(int type, u_int32_t seqnr, void *ctxt) | 450 | input_userauth_ext_info(int type, u_int32_t seqnr, struct ssh *ssh) |
452 | { | 451 | { |
453 | return kex_input_ext_info(type, seqnr, ctxt); | 452 | return kex_input_ext_info(type, seqnr, ssh); |
454 | } | 453 | } |
455 | 454 | ||
456 | void | 455 | void |
@@ -490,7 +489,7 @@ userauth(Authctxt *authctxt, char *authlist) | |||
490 | 489 | ||
491 | /* ARGSUSED */ | 490 | /* ARGSUSED */ |
492 | int | 491 | int |
493 | input_userauth_error(int type, u_int32_t seq, void *ctxt) | 492 | input_userauth_error(int type, u_int32_t seq, struct ssh *ssh) |
494 | { | 493 | { |
495 | fatal("input_userauth_error: bad message during authentication: " | 494 | fatal("input_userauth_error: bad message during authentication: " |
496 | "type %d", type); | 495 | "type %d", type); |
@@ -499,7 +498,7 @@ input_userauth_error(int type, u_int32_t seq, void *ctxt) | |||
499 | 498 | ||
500 | /* ARGSUSED */ | 499 | /* ARGSUSED */ |
501 | int | 500 | int |
502 | input_userauth_banner(int type, u_int32_t seq, void *ctxt) | 501 | input_userauth_banner(int type, u_int32_t seq, struct ssh *ssh) |
503 | { | 502 | { |
504 | char *msg, *lang; | 503 | char *msg, *lang; |
505 | u_int len; | 504 | u_int len; |
@@ -516,9 +515,8 @@ input_userauth_banner(int type, u_int32_t seq, void *ctxt) | |||
516 | 515 | ||
517 | /* ARGSUSED */ | 516 | /* ARGSUSED */ |
518 | int | 517 | int |
519 | input_userauth_success(int type, u_int32_t seq, void *ctxt) | 518 | input_userauth_success(int type, u_int32_t seq, struct ssh *ssh) |
520 | { | 519 | { |
521 | struct ssh *ssh = ctxt; | ||
522 | Authctxt *authctxt = ssh->authctxt; | 520 | Authctxt *authctxt = ssh->authctxt; |
523 | 521 | ||
524 | if (authctxt == NULL) | 522 | if (authctxt == NULL) |
@@ -534,9 +532,8 @@ input_userauth_success(int type, u_int32_t seq, void *ctxt) | |||
534 | } | 532 | } |
535 | 533 | ||
536 | int | 534 | int |
537 | input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt) | 535 | input_userauth_success_unexpected(int type, u_int32_t seq, struct ssh *ssh) |
538 | { | 536 | { |
539 | struct ssh *ssh = ctxt; | ||
540 | Authctxt *authctxt = ssh->authctxt; | 537 | Authctxt *authctxt = ssh->authctxt; |
541 | 538 | ||
542 | if (authctxt == NULL) | 539 | if (authctxt == NULL) |
@@ -549,9 +546,8 @@ input_userauth_success_unexpected(int type, u_int32_t seq, void *ctxt) | |||
549 | 546 | ||
550 | /* ARGSUSED */ | 547 | /* ARGSUSED */ |
551 | int | 548 | int |
552 | input_userauth_failure(int type, u_int32_t seq, void *ctxt) | 549 | input_userauth_failure(int type, u_int32_t seq, struct ssh *ssh) |
553 | { | 550 | { |
554 | struct ssh *ssh = ctxt; | ||
555 | Authctxt *authctxt = ssh->authctxt; | 551 | Authctxt *authctxt = ssh->authctxt; |
556 | char *authlist = NULL; | 552 | char *authlist = NULL; |
557 | int partial; | 553 | int partial; |
@@ -576,9 +572,8 @@ input_userauth_failure(int type, u_int32_t seq, void *ctxt) | |||
576 | 572 | ||
577 | /* ARGSUSED */ | 573 | /* ARGSUSED */ |
578 | int | 574 | int |
579 | input_userauth_pk_ok(int type, u_int32_t seq, void *ctxt) | 575 | input_userauth_pk_ok(int type, u_int32_t seq, struct ssh *ssh) |
580 | { | 576 | { |
581 | struct ssh *ssh = ctxt; | ||
582 | Authctxt *authctxt = ssh->authctxt; | 577 | Authctxt *authctxt = ssh->authctxt; |
583 | struct sshkey *key = NULL; | 578 | struct sshkey *key = NULL; |
584 | Identity *id = NULL; | 579 | Identity *id = NULL; |
@@ -764,9 +759,8 @@ process_gssapi_token(void *ctxt, gss_buffer_t recv_tok) | |||
764 | 759 | ||
765 | /* ARGSUSED */ | 760 | /* ARGSUSED */ |
766 | int | 761 | int |
767 | input_gssapi_response(int type, u_int32_t plen, void *ctxt) | 762 | input_gssapi_response(int type, u_int32_t plen, struct ssh *ssh) |
768 | { | 763 | { |
769 | struct ssh *ssh = ctxt; | ||
770 | Authctxt *authctxt = ssh->authctxt; | 764 | Authctxt *authctxt = ssh->authctxt; |
771 | Gssctxt *gssctxt; | 765 | Gssctxt *gssctxt; |
772 | int oidlen; | 766 | int oidlen; |
@@ -806,9 +800,8 @@ input_gssapi_response(int type, u_int32_t plen, void *ctxt) | |||
806 | 800 | ||
807 | /* ARGSUSED */ | 801 | /* ARGSUSED */ |
808 | int | 802 | int |
809 | input_gssapi_token(int type, u_int32_t plen, void *ctxt) | 803 | input_gssapi_token(int type, u_int32_t plen, struct ssh *ssh) |
810 | { | 804 | { |
811 | struct ssh *ssh = ctxt; | ||
812 | Authctxt *authctxt = ssh->authctxt; | 805 | Authctxt *authctxt = ssh->authctxt; |
813 | gss_buffer_desc recv_tok; | 806 | gss_buffer_desc recv_tok; |
814 | OM_uint32 status; | 807 | OM_uint32 status; |
@@ -836,9 +829,8 @@ input_gssapi_token(int type, u_int32_t plen, void *ctxt) | |||
836 | 829 | ||
837 | /* ARGSUSED */ | 830 | /* ARGSUSED */ |
838 | int | 831 | int |
839 | input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) | 832 | input_gssapi_errtok(int type, u_int32_t plen, struct ssh *ssh) |
840 | { | 833 | { |
841 | struct ssh *ssh = ctxt; | ||
842 | Authctxt *authctxt = ssh->authctxt; | 834 | Authctxt *authctxt = ssh->authctxt; |
843 | Gssctxt *gssctxt; | 835 | Gssctxt *gssctxt; |
844 | gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; | 836 | gss_buffer_desc send_tok = GSS_C_EMPTY_BUFFER; |
@@ -868,7 +860,7 @@ input_gssapi_errtok(int type, u_int32_t plen, void *ctxt) | |||
868 | 860 | ||
869 | /* ARGSUSED */ | 861 | /* ARGSUSED */ |
870 | int | 862 | int |
871 | input_gssapi_error(int type, u_int32_t plen, void *ctxt) | 863 | input_gssapi_error(int type, u_int32_t plen, struct ssh *ssh) |
872 | { | 864 | { |
873 | char *msg; | 865 | char *msg; |
874 | char *lang; | 866 | char *lang; |
@@ -939,9 +931,8 @@ userauth_passwd(Authctxt *authctxt) | |||
939 | */ | 931 | */ |
940 | /* ARGSUSED */ | 932 | /* ARGSUSED */ |
941 | int | 933 | int |
942 | input_userauth_passwd_changereq(int type, u_int32_t seqnr, void *ctxt) | 934 | input_userauth_passwd_changereq(int type, u_int32_t seqnr, struct ssh *ssh) |
943 | { | 935 | { |
944 | struct ssh *ssh = ctxt; | ||
945 | Authctxt *authctxt = ssh->authctxt; | 936 | Authctxt *authctxt = ssh->authctxt; |
946 | char *info, *lang, *password = NULL, *retype = NULL; | 937 | char *info, *lang, *password = NULL, *retype = NULL; |
947 | char prompt[150]; | 938 | char prompt[150]; |
@@ -1570,9 +1561,8 @@ userauth_kbdint(Authctxt *authctxt) | |||
1570 | * parse INFO_REQUEST, prompt user and send INFO_RESPONSE | 1561 | * parse INFO_REQUEST, prompt user and send INFO_RESPONSE |
1571 | */ | 1562 | */ |
1572 | int | 1563 | int |
1573 | input_userauth_info_req(int type, u_int32_t seq, void *ctxt) | 1564 | input_userauth_info_req(int type, u_int32_t seq, struct ssh *ssh) |
1574 | { | 1565 | { |
1575 | struct ssh *ssh = ctxt; | ||
1576 | Authctxt *authctxt = ssh->authctxt; | 1566 | Authctxt *authctxt = ssh->authctxt; |
1577 | char *name, *inst, *lang, *prompt, *response; | 1567 | char *name, *inst, *lang, *prompt, *response; |
1578 | u_int num_prompts, i; | 1568 | u_int num_prompts, i; |