Lines Matching refs:authctxt
287 int (*userauth)(Authctxt *authctxt);
288 void (*cleanup)(Authctxt *authctxt);
311 int userauth_gssapi(Authctxt *authctxt);
372 Authctxt authctxt; in ssh_userauth2() local
381 memset(&authctxt, 0, sizeof(authctxt)); in ssh_userauth2()
382 pubkey_prepare(&authctxt); in ssh_userauth2()
383 authctxt.server_user = server_user; in ssh_userauth2()
384 authctxt.local_user = local_user; in ssh_userauth2()
385 authctxt.host = host; in ssh_userauth2()
386 authctxt.service = "ssh-connection"; /* service name */ in ssh_userauth2()
387 authctxt.success = 0; in ssh_userauth2()
388 authctxt.method = authmethod_lookup("none"); in ssh_userauth2()
389 authctxt.authlist = NULL; in ssh_userauth2()
390 authctxt.methoddata = NULL; in ssh_userauth2()
391 authctxt.sensitive = sensitive; in ssh_userauth2()
392 authctxt.active_ktype = authctxt.oktypes = authctxt.ktypes = NULL; in ssh_userauth2()
393 authctxt.info_req_seen = 0; in ssh_userauth2()
394 authctxt.agent_fd = -1; in ssh_userauth2()
395 if (authctxt.method == NULL) in ssh_userauth2()
403 ssh->authctxt = &authctxt; in ssh_userauth2()
407 ssh_dispatch_run_fatal(ssh, DISPATCH_BLOCK, &authctxt.success); /* loop until success */ in ssh_userauth2()
408 ssh->authctxt = NULL; in ssh_userauth2()
410 pubkey_cleanup(&authctxt); in ssh_userauth2()
413 if (!authctxt.success) in ssh_userauth2()
415 debug("Authentication succeeded (%s).", authctxt.method->name); in ssh_userauth2()
422 Authctxt *authctxt = ssh->authctxt; in input_userauth_service_accept() local
440 userauth_none(authctxt); in input_userauth_service_accept()
459 userauth(Authctxt *authctxt, char *authlist) in userauth() argument
463 if (authctxt->method != NULL && authctxt->method->cleanup != NULL) in userauth()
464 authctxt->method->cleanup(authctxt); in userauth()
466 free(authctxt->methoddata); in userauth()
467 authctxt->methoddata = NULL; in userauth()
469 authlist = authctxt->authlist; in userauth()
471 free(authctxt->authlist); in userauth()
472 authctxt->authlist = authlist; in userauth()
478 authctxt->server_user, authctxt->host, authlist); in userauth()
479 authctxt->method = method; in userauth()
486 if (method->userauth(authctxt) != 0) { in userauth()
526 Authctxt *authctxt = ssh->authctxt; in input_userauth_success() local
528 if (authctxt == NULL) in input_userauth_success()
530 free(authctxt->authlist); in input_userauth_success()
531 authctxt->authlist = NULL; in input_userauth_success()
532 if (authctxt->method != NULL && authctxt->method->cleanup != NULL) in input_userauth_success()
533 authctxt->method->cleanup(authctxt); in input_userauth_success()
534 free(authctxt->methoddata); in input_userauth_success()
535 authctxt->methoddata = NULL; in input_userauth_success()
536 authctxt->success = 1; /* break out */ in input_userauth_success()
543 Authctxt *authctxt = ssh->authctxt; in input_userauth_success_unexpected() local
545 if (authctxt == NULL) in input_userauth_success_unexpected()
549 authctxt->method->name); in input_userauth_success_unexpected()
557 Authctxt *authctxt = ssh->authctxt; in input_userauth_failure() local
562 if (authctxt == NULL) in input_userauth_failure()
573 pubkey_reset(authctxt); in input_userauth_failure()
577 userauth(authctxt, authlist); in input_userauth_failure()
588 Authctxt *authctxt = ssh->authctxt; in input_userauth_pk_ok() local
597 if (authctxt == NULL) in input_userauth_pk_ok()
632 TAILQ_FOREACH_REVERSE(id, &authctxt->keys, idlist, next) { in input_userauth_pk_ok()
634 sent = sign_and_send_pubkey(ssh, authctxt, id); in input_userauth_pk_ok()
646 userauth(authctxt, NULL); in input_userauth_pk_ok()
652 userauth_gssapi(Authctxt *authctxt) in userauth_gssapi() argument
672 &gss_supported->elements[mech], authctxt->host)) { in userauth_gssapi()
682 authctxt->methoddata=(void *)gssctxt; in userauth_gssapi()
685 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_gssapi()
686 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_gssapi()
687 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_gssapi()
713 Authctxt *authctxt = ssh->authctxt; in process_gssapi_token() local
714 Gssctxt *gssctxt = authctxt->methoddata; in process_gssapi_token()
750 ssh_gssapi_buildmic(b, authctxt->server_user, in process_gssapi_token()
751 authctxt->service, "gssapi-with-mic"); in process_gssapi_token()
780 Authctxt *authctxt = ssh->authctxt; in input_gssapi_response() local
786 if (authctxt == NULL) in input_gssapi_response()
788 gssctxt = authctxt->methoddata; in input_gssapi_response()
798 userauth(authctxt, NULL); in input_gssapi_response()
811 userauth(authctxt, NULL); in input_gssapi_response()
825 Authctxt *authctxt = ssh->authctxt; in input_gssapi_token() local
832 if (authctxt == NULL) in input_gssapi_token()
845 userauth(authctxt, NULL); in input_gssapi_token()
858 Authctxt *authctxt = ssh->authctxt; in input_gssapi_errtok() local
867 if (authctxt == NULL) in input_gssapi_errtok()
869 gssctxt = authctxt->methoddata; in input_gssapi_errtok()
912 userauth_none(Authctxt *authctxt) in userauth_none() argument
919 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_none()
920 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_none()
921 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_none()
928 userauth_passwd(Authctxt *authctxt) in userauth_passwd() argument
935 authctxt->host; in userauth_passwd()
945 authctxt->server_user, host); in userauth_passwd()
948 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_passwd()
949 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_passwd()
950 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_passwd()
973 Authctxt *authctxt = ssh->authctxt; in input_userauth_passwd_changereq() local
981 if (authctxt == NULL) in input_userauth_passwd_changereq()
984 host = options.host_key_alias ? options.host_key_alias : authctxt->host; in input_userauth_passwd_changereq()
992 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in input_userauth_passwd_changereq()
993 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in input_userauth_passwd_changereq()
994 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in input_userauth_passwd_changereq()
1000 authctxt->server_user, host); in input_userauth_passwd_changereq()
1010 authctxt->server_user, host); in input_userauth_passwd_changereq()
1019 authctxt->server_user, host); in input_userauth_passwd_changereq()
1153 sign_and_send_pubkey(struct ssh *ssh, Authctxt *authctxt, Identity *id) in sign_and_send_pubkey() argument
1178 TAILQ_FOREACH(private_id, &authctxt->keys, next) { in sign_and_send_pubkey()
1195 TAILQ_FOREACH(private_id, &authctxt->keys, next) { in sign_and_send_pubkey()
1250 (r = sshbuf_put_cstring(b, authctxt->server_user)) != 0 || in sign_and_send_pubkey()
1251 (r = sshbuf_put_cstring(b, authctxt->service)) != 0 || in sign_and_send_pubkey()
1252 (r = sshbuf_put_cstring(b, authctxt->method->name)) != 0 || in sign_and_send_pubkey()
1312 send_pubkey_test(struct ssh *ssh, Authctxt *authctxt, Identity *id) in send_pubkey_test() argument
1334 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in send_pubkey_test()
1335 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in send_pubkey_test()
1336 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in send_pubkey_test()
1453 pubkey_prepare(Authctxt *authctxt) in pubkey_prepare() argument
1464 preferred = &authctxt->keys; in pubkey_prepare()
1536 authctxt->agent_fd = agent_fd; in pubkey_prepare()
1584 pubkey_cleanup(Authctxt *authctxt) in pubkey_cleanup() argument
1588 if (authctxt->agent_fd != -1) in pubkey_cleanup()
1589 ssh_close_authentication_socket(authctxt->agent_fd); in pubkey_cleanup()
1590 for (id = TAILQ_FIRST(&authctxt->keys); id; in pubkey_cleanup()
1591 id = TAILQ_FIRST(&authctxt->keys)) { in pubkey_cleanup()
1592 TAILQ_REMOVE(&authctxt->keys, id, next); in pubkey_cleanup()
1600 pubkey_reset(Authctxt *authctxt) in pubkey_reset() argument
1604 TAILQ_FOREACH(id, &authctxt->keys, next) in pubkey_reset()
1623 userauth_pubkey(Authctxt *authctxt) in userauth_pubkey() argument
1630 while ((id = TAILQ_FIRST(&authctxt->keys))) { in userauth_pubkey()
1634 TAILQ_REMOVE(&authctxt->keys, id, next); in userauth_pubkey()
1635 TAILQ_INSERT_TAIL(&authctxt->keys, id, next); in userauth_pubkey()
1653 sent = send_pubkey_test(ssh, authctxt, id); in userauth_pubkey()
1662 authctxt, id); in userauth_pubkey()
1679 userauth_kbdint(Authctxt *authctxt) in userauth_kbdint() argument
1688 if (attempt > 1 && !authctxt->info_req_seen) { in userauth_kbdint()
1696 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_kbdint()
1697 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_kbdint()
1698 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_kbdint()
1715 Authctxt *authctxt = ssh->authctxt; in input_userauth_info_req() local
1724 if (authctxt == NULL) in input_userauth_info_req()
1727 authctxt->info_req_seen = 1; in input_userauth_info_req()
1892 userauth_hostbased(Authctxt *authctxt) in userauth_hostbased() argument
1902 if (authctxt->ktypes == NULL) { in userauth_hostbased()
1903 authctxt->oktypes = xstrdup(options.hostbased_key_types); in userauth_hostbased()
1904 authctxt->ktypes = authctxt->oktypes; in userauth_hostbased()
1912 if (authctxt->active_ktype == NULL) in userauth_hostbased()
1913 authctxt->active_ktype = strsep(&authctxt->ktypes, ","); in userauth_hostbased()
1914 if (authctxt->active_ktype == NULL || in userauth_hostbased()
1915 *authctxt->active_ktype == '\0') in userauth_hostbased()
1918 authctxt->active_ktype); in userauth_hostbased()
1922 for (i = 0; i < authctxt->sensitive->nkeys; i++) { in userauth_hostbased()
1923 if (authctxt->sensitive->keys[i] == NULL || in userauth_hostbased()
1924 authctxt->sensitive->keys[i]->type == KEY_UNSPEC) in userauth_hostbased()
1927 sshkey_ssh_name(authctxt->sensitive->keys[i]), in userauth_hostbased()
1928 authctxt->active_ktype, 0) != 1) in userauth_hostbased()
1931 private = authctxt->sensitive->keys[i]; in userauth_hostbased()
1932 authctxt->sensitive->keys[i] = NULL; in userauth_hostbased()
1939 authctxt->active_ktype = NULL; in userauth_hostbased()
1942 free(authctxt->oktypes); in userauth_hostbased()
1943 authctxt->oktypes = authctxt->ktypes = NULL; in userauth_hostbased()
1944 authctxt->active_ktype = NULL; in userauth_hostbased()
1978 (r = sshbuf_put_cstring(b, authctxt->server_user)) != 0 || in userauth_hostbased()
1979 (r = sshbuf_put_cstring(b, authctxt->service)) != 0 || in userauth_hostbased()
1980 (r = sshbuf_put_cstring(b, authctxt->method->name)) != 0 || in userauth_hostbased()
1984 (r = sshbuf_put_cstring(b, authctxt->local_user)) != 0) { in userauth_hostbased()
2000 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 || in userauth_hostbased()
2001 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 || in userauth_hostbased()
2002 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 || in userauth_hostbased()
2006 (r = sshpkt_put_cstring(ssh, authctxt->local_user)) != 0 || in userauth_hostbased()