Lines Matching refs:authctxt
442 Authctxt authctxt; in ssh_userauth2() local
449 memset(&authctxt, 0, sizeof(authctxt)); in ssh_userauth2()
450 authctxt.server_user = server_user; in ssh_userauth2()
451 authctxt.local_user = local_user; in ssh_userauth2()
452 authctxt.host = host; in ssh_userauth2()
453 authctxt.service = "ssh-connection"; /* service name */ in ssh_userauth2()
454 authctxt.success = 0; in ssh_userauth2()
455 authctxt.method = authmethod_lookup("none"); in ssh_userauth2()
456 authctxt.authlist = NULL; in ssh_userauth2()
457 authctxt.methoddata = NULL; in ssh_userauth2()
458 authctxt.sensitive = sensitive; in ssh_userauth2()
459 authctxt.active_ktype = authctxt.oktypes = authctxt.ktypes = NULL; in ssh_userauth2()
460 authctxt.info_req_seen = 0; in ssh_userauth2()
461 authctxt.attempt_kbdint = 0; in ssh_userauth2()
462 authctxt.attempt_passwd = 0; in ssh_userauth2()
464 authctxt.gss_supported_mechs = NULL; in ssh_userauth2()
465 authctxt.mech_tried = 0; in ssh_userauth2()
467 authctxt.agent_fd = -1; in ssh_userauth2()
468 pubkey_prepare(&authctxt); in ssh_userauth2()
469 if (authctxt.method == NULL) { in ssh_userauth2()
478 ssh->authctxt = &authctxt; in ssh_userauth2()
482 ssh_dispatch_run_fatal(ssh, DISPATCH_BLOCK, &authctxt.success); /* loop until success */ in ssh_userauth2()
484 ssh->authctxt = NULL; in ssh_userauth2()
488 if (!authctxt.success) in ssh_userauth2()
493 authctxt.method->name); in ssh_userauth2()
496 authctxt.method->name); in ssh_userauth2()
542 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth() local
544 if (authctxt->method != NULL && authctxt->method->cleanup != NULL) in userauth()
545 authctxt->method->cleanup(ssh); in userauth()
547 free(authctxt->methoddata); in userauth()
548 authctxt->methoddata = NULL; in userauth()
550 authlist = authctxt->authlist; in userauth()
552 free(authctxt->authlist); in userauth()
553 authctxt->authlist = authlist; in userauth()
559 authctxt->server_user, authctxt->host, authlist); in userauth()
560 authctxt->method = method; in userauth()
609 Authctxt *authctxt = ssh->authctxt; in input_userauth_success() local
611 if (authctxt == NULL) in input_userauth_success()
613 free(authctxt->authlist); in input_userauth_success()
614 authctxt->authlist = NULL; in input_userauth_success()
615 if (authctxt->method != NULL && authctxt->method->cleanup != NULL) in input_userauth_success()
616 authctxt->method->cleanup(ssh); in input_userauth_success()
617 free(authctxt->methoddata); in input_userauth_success()
618 authctxt->methoddata = NULL; in input_userauth_success()
619 authctxt->success = 1; /* break out */ in input_userauth_success()
627 Authctxt *authctxt = ssh->authctxt;
629 if (authctxt == NULL)
633 authctxt->method->name);
642 Authctxt *authctxt = ssh->authctxt; in input_userauth_failure() local
646 if (authctxt == NULL) in input_userauth_failure()
656 authctxt->method->name); in input_userauth_failure()
658 pubkey_reset(authctxt); in input_userauth_failure()
703 Authctxt *authctxt = ssh->authctxt; in input_userauth_pk_ok() local
712 if (authctxt == NULL) in input_userauth_pk_ok()
740 TAILQ_FOREACH_REVERSE(id, &authctxt->keys, idlist, next) { in input_userauth_pk_ok()
774 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth_gssapi() local
783 if (authctxt->gss_supported_mechs == NULL) in userauth_gssapi()
784 gss_indicate_mechs(&min, &authctxt->gss_supported_mechs); in userauth_gssapi()
787 while (authctxt->mech_tried < authctxt->gss_supported_mechs->count && in userauth_gssapi()
789 mech = &authctxt->gss_supported_mechs-> in userauth_gssapi()
790 elements[authctxt->mech_tried]; in userauth_gssapi()
793 mech, authctxt->host)) { in userauth_gssapi()
796 authctxt->mech_tried++; in userauth_gssapi()
803 authctxt->methoddata=(void *)gssctxt; in userauth_gssapi()
806 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_gssapi()
807 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_gssapi()
808 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_gssapi()
822 authctxt->mech_tried++; /* Move along to next candidate */ in userauth_gssapi()
830 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth_gssapi_cleanup() local
831 Gssctxt *gssctxt = (Gssctxt *)authctxt->methoddata; in userauth_gssapi_cleanup()
834 authctxt->methoddata = NULL; in userauth_gssapi_cleanup()
836 free(authctxt->gss_supported_mechs); in userauth_gssapi_cleanup()
837 authctxt->gss_supported_mechs = NULL; in userauth_gssapi_cleanup()
843 Authctxt *authctxt = ssh->authctxt; in process_gssapi_token() local
844 Gssctxt *gssctxt = authctxt->methoddata; in process_gssapi_token()
880 ssh_gssapi_buildmic(b, authctxt->server_user, in process_gssapi_token()
881 authctxt->service, "gssapi-with-mic", in process_gssapi_token()
911 Authctxt *authctxt = ssh->authctxt; in input_gssapi_response() local
917 if (authctxt == NULL) in input_gssapi_response()
919 gssctxt = authctxt->methoddata; in input_gssapi_response()
956 Authctxt *authctxt = ssh->authctxt; in input_gssapi_token() local
963 if (authctxt == NULL) in input_gssapi_token()
989 Authctxt *authctxt = ssh->authctxt; in input_gssapi_errtok() local
998 if (authctxt == NULL) in input_gssapi_errtok()
1000 gssctxt = authctxt->methoddata; in input_gssapi_errtok()
1045 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth_none() local
1050 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_none()
1051 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_none()
1052 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_none()
1061 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth_passwd() local
1064 authctxt->host; in userauth_passwd()
1067 if (authctxt->attempt_passwd++ >= options.number_of_password_prompts) in userauth_passwd()
1070 if (authctxt->attempt_passwd != 1) in userauth_passwd()
1073 xasprintf(&prompt, "%s@%s's password: ", authctxt->server_user, host); in userauth_passwd()
1076 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_passwd()
1077 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_passwd()
1078 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_passwd()
1102 Authctxt *authctxt = ssh->authctxt; in input_userauth_passwd_changereq() local
1110 if (authctxt == NULL) in input_userauth_passwd_changereq()
1113 host = options.host_key_alias ? options.host_key_alias : authctxt->host; in input_userauth_passwd_changereq()
1121 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in input_userauth_passwd_changereq()
1122 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in input_userauth_passwd_changereq()
1123 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in input_userauth_passwd_changereq()
1129 authctxt->server_user, host); in input_userauth_passwd_changereq()
1139 authctxt->server_user, host); in input_userauth_passwd_changereq()
1148 authctxt->server_user, host); in input_userauth_passwd_changereq()
1340 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in sign_and_send_pubkey() local
1364 TAILQ_FOREACH(private_id, &authctxt->keys, next) { in sign_and_send_pubkey()
1381 TAILQ_FOREACH(private_id, &authctxt->keys, next) { in sign_and_send_pubkey()
1431 (r = sshbuf_put_cstring(b, authctxt->server_user)) != 0 || in sign_and_send_pubkey()
1432 (r = sshbuf_put_cstring(b, authctxt->service)) != 0 || in sign_and_send_pubkey()
1433 (r = sshbuf_put_cstring(b, authctxt->method->name)) != 0 || in sign_and_send_pubkey()
1496 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in send_pubkey_test() local
1517 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in send_pubkey_test()
1518 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in send_pubkey_test()
1519 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in send_pubkey_test()
1644 pubkey_prepare(Authctxt *authctxt) in pubkey_prepare() argument
1656 preferred = &authctxt->keys; in pubkey_prepare()
1743 authctxt->agent_fd = agent_fd; in pubkey_prepare()
1794 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in pubkey_cleanup() local
1797 if (authctxt->agent_fd != -1) { in pubkey_cleanup()
1798 ssh_close_authentication_socket(authctxt->agent_fd); in pubkey_cleanup()
1799 authctxt->agent_fd = -1; in pubkey_cleanup()
1801 for (id = TAILQ_FIRST(&authctxt->keys); id; in pubkey_cleanup()
1802 id = TAILQ_FIRST(&authctxt->keys)) { in pubkey_cleanup()
1803 TAILQ_REMOVE(&authctxt->keys, id, next); in pubkey_cleanup()
1811 pubkey_reset(Authctxt *authctxt) in pubkey_reset() argument
1815 TAILQ_FOREACH(id, &authctxt->keys, next) in pubkey_reset()
1836 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth_pubkey() local
1841 while ((id = TAILQ_FIRST(&authctxt->keys))) { in userauth_pubkey()
1845 TAILQ_REMOVE(&authctxt->keys, id, next); in userauth_pubkey()
1846 TAILQ_INSERT_TAIL(&authctxt->keys, id, next); in userauth_pubkey()
1884 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth_kbdint() local
1887 if (authctxt->attempt_kbdint++ >= options.number_of_password_prompts) in userauth_kbdint()
1890 if (authctxt->attempt_kbdint > 1 && !authctxt->info_req_seen) { in userauth_kbdint()
1898 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_kbdint()
1899 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_kbdint()
1900 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_kbdint()
1917 Authctxt *authctxt = ssh->authctxt; in input_userauth_info_req() local
1926 if (authctxt == NULL) in input_userauth_info_req()
1929 authctxt->info_req_seen = 1; in input_userauth_info_req()
1958 authctxt->server_user, options.host_key_alias ? in input_userauth_info_req()
1959 options.host_key_alias : authctxt->host, prompt) == -1) in input_userauth_info_req()
2103 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth_hostbased() local
2111 if (authctxt->ktypes == NULL) { in userauth_hostbased()
2112 authctxt->oktypes = xstrdup(options.hostbased_accepted_algos); in userauth_hostbased()
2113 authctxt->ktypes = authctxt->oktypes; in userauth_hostbased()
2121 if (authctxt->active_ktype == NULL) in userauth_hostbased()
2122 authctxt->active_ktype = strsep(&authctxt->ktypes, ","); in userauth_hostbased()
2123 if (authctxt->active_ktype == NULL || in userauth_hostbased()
2124 *authctxt->active_ktype == '\0') in userauth_hostbased()
2126 debug3_f("trying key type %s", authctxt->active_ktype); in userauth_hostbased()
2130 for (i = 0; i < authctxt->sensitive->nkeys; i++) { in userauth_hostbased()
2131 if (authctxt->sensitive->keys[i] == NULL || in userauth_hostbased()
2132 authctxt->sensitive->keys[i]->type == KEY_UNSPEC) in userauth_hostbased()
2135 sshkey_ssh_name(authctxt->sensitive->keys[i]), in userauth_hostbased()
2136 authctxt->active_ktype, 0) != 1) in userauth_hostbased()
2139 private = authctxt->sensitive->keys[i]; in userauth_hostbased()
2140 authctxt->sensitive->keys[i] = NULL; in userauth_hostbased()
2147 authctxt->active_ktype = NULL; in userauth_hostbased()
2150 free(authctxt->oktypes); in userauth_hostbased()
2151 authctxt->oktypes = authctxt->ktypes = NULL; in userauth_hostbased()
2152 authctxt->active_ktype = NULL; in userauth_hostbased()
2186 (r = sshbuf_put_cstring(b, authctxt->server_user)) != 0 || in userauth_hostbased()
2187 (r = sshbuf_put_cstring(b, authctxt->service)) != 0 || in userauth_hostbased()
2188 (r = sshbuf_put_cstring(b, authctxt->method->name)) != 0 || in userauth_hostbased()
2189 (r = sshbuf_put_cstring(b, authctxt->active_ktype)) != 0 || in userauth_hostbased()
2192 (r = sshbuf_put_cstring(b, authctxt->local_user)) != 0) { in userauth_hostbased()
2207 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_hostbased()
2208 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_hostbased()
2209 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_hostbased()
2210 (r = sshpkt_put_cstring(ssh, authctxt->active_ktype)) != 0 || in userauth_hostbased()
2213 (r = sshpkt_put_cstring(ssh, authctxt->local_user)) != 0 || in userauth_hostbased()