Lines Matching refs:authctxt
427 Authctxt authctxt; in ssh_userauth2() local
434 memset(&authctxt, 0, sizeof(authctxt)); in ssh_userauth2()
435 authctxt.server_user = server_user; in ssh_userauth2()
436 authctxt.local_user = local_user; in ssh_userauth2()
437 authctxt.host = host; in ssh_userauth2()
438 authctxt.service = "ssh-connection"; /* service name */ in ssh_userauth2()
439 authctxt.success = 0; in ssh_userauth2()
440 authctxt.method = authmethod_lookup("none"); in ssh_userauth2()
441 authctxt.authlist = NULL; in ssh_userauth2()
442 authctxt.methoddata = NULL; in ssh_userauth2()
443 authctxt.sensitive = sensitive; in ssh_userauth2()
444 authctxt.active_ktype = authctxt.oktypes = authctxt.ktypes = NULL; in ssh_userauth2()
445 authctxt.info_req_seen = 0; in ssh_userauth2()
446 authctxt.attempt_kbdint = 0; in ssh_userauth2()
447 authctxt.attempt_passwd = 0; in ssh_userauth2()
449 authctxt.gss_supported_mechs = NULL; in ssh_userauth2()
450 authctxt.mech_tried = 0; in ssh_userauth2()
452 authctxt.agent_fd = -1; in ssh_userauth2()
453 if (authctxt.method == NULL) in ssh_userauth2()
461 ssh->authctxt = &authctxt; in ssh_userauth2()
465 ssh_dispatch_run_fatal(ssh, DISPATCH_BLOCK, &authctxt.success); /* loop until success */ in ssh_userauth2()
468 if (authctxt.gss_supported_mechs != NULL) { in ssh_userauth2()
471 gss_release_oid_set(&ms, &authctxt.gss_supported_mechs); in ssh_userauth2()
472 authctxt.gss_supported_mechs = NULL; in ssh_userauth2()
475 ssh->authctxt = NULL; in ssh_userauth2()
479 if (!authctxt.success) in ssh_userauth2()
484 authctxt.method->name); in ssh_userauth2()
487 authctxt.method->name); in ssh_userauth2()
527 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth() local
529 if (authctxt->method != NULL && authctxt->method->cleanup != NULL) in userauth()
530 authctxt->method->cleanup(ssh); in userauth()
532 free(authctxt->methoddata); in userauth()
533 authctxt->methoddata = NULL; in userauth()
535 authlist = authctxt->authlist; in userauth()
537 free(authctxt->authlist); in userauth()
538 authctxt->authlist = authlist; in userauth()
544 authctxt->server_user, authctxt->host, authlist); in userauth()
545 authctxt->method = method; in userauth()
591 Authctxt *authctxt = ssh->authctxt; in input_userauth_success() local
593 if (authctxt == NULL) in input_userauth_success()
595 free(authctxt->authlist); in input_userauth_success()
596 authctxt->authlist = NULL; in input_userauth_success()
597 if (authctxt->method != NULL && authctxt->method->cleanup != NULL) in input_userauth_success()
598 authctxt->method->cleanup(ssh); in input_userauth_success()
599 free(authctxt->methoddata); in input_userauth_success()
600 authctxt->methoddata = NULL; in input_userauth_success()
601 authctxt->success = 1; /* break out */ in input_userauth_success()
610 Authctxt *authctxt = ssh->authctxt;
612 if (authctxt == NULL)
616 authctxt->method->name);
624 Authctxt *authctxt = ssh->authctxt; in input_userauth_failure() local
628 if (authctxt == NULL) in input_userauth_failure()
638 authctxt->method->name); in input_userauth_failure()
640 pubkey_reset(authctxt); in input_userauth_failure()
684 Authctxt *authctxt = ssh->authctxt; in input_userauth_pk_ok() local
693 if (authctxt == NULL) in input_userauth_pk_ok()
723 TAILQ_FOREACH_REVERSE(id, &authctxt->keys, idlist, next) { in input_userauth_pk_ok()
758 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth_gssapi() local
767 if (authctxt->gss_supported_mechs == NULL) in userauth_gssapi()
768 gss_indicate_mechs(&min, &authctxt->gss_supported_mechs); in userauth_gssapi()
771 while (authctxt->mech_tried < authctxt->gss_supported_mechs->count && in userauth_gssapi()
773 mech = &authctxt->gss_supported_mechs-> in userauth_gssapi()
774 elements[authctxt->mech_tried]; in userauth_gssapi()
777 mech, authctxt->host)) { in userauth_gssapi()
780 authctxt->mech_tried++; in userauth_gssapi()
787 authctxt->methoddata=(void *)gssctxt; in userauth_gssapi()
790 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_gssapi()
791 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_gssapi()
792 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_gssapi()
806 authctxt->mech_tried++; /* Move along to next candidate */ in userauth_gssapi()
814 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth_gssapi_cleanup() local
815 Gssctxt *gssctxt = (Gssctxt *)authctxt->methoddata; in userauth_gssapi_cleanup()
818 authctxt->methoddata = NULL; in userauth_gssapi_cleanup()
824 Authctxt *authctxt = ssh->authctxt; in process_gssapi_token() local
825 Gssctxt *gssctxt = authctxt->methoddata; in process_gssapi_token()
861 ssh_gssapi_buildmic(b, authctxt->server_user, in process_gssapi_token()
862 authctxt->service, "gssapi-with-mic", in process_gssapi_token()
891 Authctxt *authctxt = ssh->authctxt; in input_gssapi_response() local
897 if (authctxt == NULL) in input_gssapi_response()
899 gssctxt = authctxt->methoddata; in input_gssapi_response()
935 Authctxt *authctxt = ssh->authctxt; in input_gssapi_token() local
942 if (authctxt == NULL) in input_gssapi_token()
967 Authctxt *authctxt = ssh->authctxt; in input_gssapi_errtok() local
976 if (authctxt == NULL) in input_gssapi_errtok()
978 gssctxt = authctxt->methoddata; in input_gssapi_errtok()
1022 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth_none() local
1027 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_none()
1028 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_none()
1029 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_none()
1038 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth_passwd() local
1041 authctxt->host; in userauth_passwd()
1044 if (authctxt->attempt_passwd++ >= options.number_of_password_prompts) in userauth_passwd()
1047 if (authctxt->attempt_passwd != 1) in userauth_passwd()
1050 xasprintf(&prompt, "%s@%s's password: ", authctxt->server_user, host); in userauth_passwd()
1053 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_passwd()
1054 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_passwd()
1055 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_passwd()
1078 Authctxt *authctxt = ssh->authctxt; in input_userauth_passwd_changereq() local
1086 if (authctxt == NULL) in input_userauth_passwd_changereq()
1089 host = options.host_key_alias ? options.host_key_alias : authctxt->host; in input_userauth_passwd_changereq()
1097 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in input_userauth_passwd_changereq()
1098 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in input_userauth_passwd_changereq()
1099 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in input_userauth_passwd_changereq()
1105 authctxt->server_user, host); in input_userauth_passwd_changereq()
1115 authctxt->server_user, host); in input_userauth_passwd_changereq()
1124 authctxt->server_user, host); in input_userauth_passwd_changereq()
1314 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in sign_and_send_pubkey() local
1346 TAILQ_FOREACH(private_id, &authctxt->keys, next) { in sign_and_send_pubkey()
1363 TAILQ_FOREACH(private_id, &authctxt->keys, next) { in sign_and_send_pubkey()
1413 (r = sshbuf_put_cstring(b, authctxt->server_user)) != 0 || in sign_and_send_pubkey()
1414 (r = sshbuf_put_cstring(b, authctxt->service)) != 0 || in sign_and_send_pubkey()
1485 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in send_pubkey_test() local
1506 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in send_pubkey_test()
1507 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in send_pubkey_test()
1508 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in send_pubkey_test()
1670 pubkey_prepare(struct ssh *ssh, Authctxt *authctxt) in pubkey_prepare() argument
1682 preferred = &authctxt->keys; in pubkey_prepare()
1768 authctxt->agent_fd = agent_fd; in pubkey_prepare()
1833 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in pubkey_cleanup() local
1836 if (authctxt->agent_fd != -1) { in pubkey_cleanup()
1837 ssh_close_authentication_socket(authctxt->agent_fd); in pubkey_cleanup()
1838 authctxt->agent_fd = -1; in pubkey_cleanup()
1840 for (id = TAILQ_FIRST(&authctxt->keys); id; in pubkey_cleanup()
1841 id = TAILQ_FIRST(&authctxt->keys)) { in pubkey_cleanup()
1842 TAILQ_REMOVE(&authctxt->keys, id, next); in pubkey_cleanup()
1850 pubkey_reset(Authctxt *authctxt) in pubkey_reset() argument
1854 TAILQ_FOREACH(id, &authctxt->keys, next) in pubkey_reset()
1861 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth_pubkey() local
1868 pubkey_prepare(ssh, authctxt); in userauth_pubkey()
1872 while ((id = TAILQ_FIRST(&authctxt->keys))) { in userauth_pubkey()
1876 TAILQ_REMOVE(&authctxt->keys, id, next); in userauth_pubkey()
1877 TAILQ_INSERT_TAIL(&authctxt->keys, id, next); in userauth_pubkey()
1913 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth_kbdint() local
1916 if (authctxt->attempt_kbdint++ >= options.number_of_password_prompts) in userauth_kbdint()
1919 if (authctxt->attempt_kbdint > 1 && !authctxt->info_req_seen) { in userauth_kbdint()
1927 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_kbdint()
1928 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_kbdint()
1929 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_kbdint()
1946 Authctxt *authctxt = ssh->authctxt; in input_userauth_info_req() local
1955 if (authctxt == NULL) in input_userauth_info_req()
1958 authctxt->info_req_seen = 1; in input_userauth_info_req()
1987 authctxt->server_user, options.host_key_alias ? in input_userauth_info_req()
1988 options.host_key_alias : authctxt->host, prompt) == -1) in input_userauth_info_req()
2133 Authctxt *authctxt = (Authctxt *)ssh->authctxt; in userauth_hostbased() local
2141 if (authctxt->ktypes == NULL) { in userauth_hostbased()
2142 authctxt->oktypes = xstrdup(options.hostbased_accepted_algos); in userauth_hostbased()
2143 authctxt->ktypes = authctxt->oktypes; in userauth_hostbased()
2151 if (authctxt->active_ktype == NULL) in userauth_hostbased()
2152 authctxt->active_ktype = strsep(&authctxt->ktypes, ","); in userauth_hostbased()
2153 if (authctxt->active_ktype == NULL || in userauth_hostbased()
2154 *authctxt->active_ktype == '\0') in userauth_hostbased()
2156 debug3_f("trying key type %s", authctxt->active_ktype); in userauth_hostbased()
2160 for (i = 0; i < authctxt->sensitive->nkeys; i++) { in userauth_hostbased()
2161 if (authctxt->sensitive->keys[i] == NULL || in userauth_hostbased()
2162 authctxt->sensitive->keys[i]->type == KEY_UNSPEC) in userauth_hostbased()
2165 sshkey_ssh_name(authctxt->sensitive->keys[i]), in userauth_hostbased()
2166 authctxt->active_ktype)) in userauth_hostbased()
2169 private = authctxt->sensitive->keys[i]; in userauth_hostbased()
2170 authctxt->sensitive->keys[i] = NULL; in userauth_hostbased()
2177 authctxt->active_ktype = NULL; in userauth_hostbased()
2180 free(authctxt->oktypes); in userauth_hostbased()
2181 authctxt->oktypes = authctxt->ktypes = NULL; in userauth_hostbased()
2182 authctxt->active_ktype = NULL; in userauth_hostbased()
2193 sshkey_ssh_name(private), fp, authctxt->active_ktype); in userauth_hostbased()
2217 (r = sshbuf_put_cstring(b, authctxt->server_user)) != 0 || in userauth_hostbased()
2218 (r = sshbuf_put_cstring(b, authctxt->service)) != 0 || in userauth_hostbased()
2219 (r = sshbuf_put_cstring(b, authctxt->method->name)) != 0 || in userauth_hostbased()
2220 (r = sshbuf_put_cstring(b, authctxt->active_ktype)) != 0 || in userauth_hostbased()
2223 (r = sshbuf_put_cstring(b, authctxt->local_user)) != 0) { in userauth_hostbased()
2238 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_hostbased()
2239 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_hostbased()
2240 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_hostbased()
2241 (r = sshpkt_put_cstring(ssh, authctxt->active_ktype)) != 0 || in userauth_hostbased()
2244 (r = sshpkt_put_cstring(ssh, authctxt->local_user)) != 0 || in userauth_hostbased()