summaryrefslogtreecommitdiff
path: root/sshconnect2.c
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 /sshconnect2.c
parent94583beb24a6c5fd19cedb9104ab2d2d5cd052b6 (diff)
upstream commit
protocol handlers all get struct ssh passed; ok djm@ Upstream-ID: 0ca9ea2a5d01a6d2ded94c5024456a930c5bfb5d
Diffstat (limited to 'sshconnect2.c')
-rw-r--r--sshconnect2.c72
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
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;