Lines Matching defs:authctxt
419 Authctxt authctxt;
426 memset(&authctxt, 0, sizeof(authctxt));
427 authctxt.server_user = server_user;
428 authctxt.local_user = local_user;
429 authctxt.host = host;
430 authctxt.service = "ssh-connection"; /* service name */
431 authctxt.success = 0;
432 authctxt.method = authmethod_lookup("none");
433 authctxt.authlist = NULL;
434 authctxt.methoddata = NULL;
435 authctxt.sensitive = sensitive;
436 authctxt.active_ktype = authctxt.oktypes = authctxt.ktypes = NULL;
437 authctxt.info_req_seen = 0;
438 authctxt.attempt_kbdint = 0;
439 authctxt.attempt_passwd = 0;
441 authctxt.gss_supported_mechs = NULL;
442 authctxt.mech_tried = 0;
444 authctxt.agent_fd = -1;
445 if (authctxt.method == NULL)
453 ssh->authctxt = &authctxt;
457 ssh_dispatch_run_fatal(ssh, DISPATCH_BLOCK, &authctxt.success); /* loop until success */
460 if (authctxt.gss_supported_mechs != NULL) {
463 gss_release_oid_set(&ms, &authctxt.gss_supported_mechs);
464 authctxt.gss_supported_mechs = NULL;
467 ssh->authctxt = NULL;
471 if (!authctxt.success)
476 authctxt.method->name);
479 authctxt.method->name);
519 Authctxt *authctxt = (Authctxt *)ssh->authctxt;
521 if (authctxt->method != NULL && authctxt->method->cleanup != NULL)
522 authctxt->method->cleanup(ssh);
524 free(authctxt->methoddata);
525 authctxt->methoddata = NULL;
527 authlist = authctxt->authlist;
529 free(authctxt->authlist);
530 authctxt->authlist = authlist;
536 authctxt->server_user, authctxt->host, authlist);
537 authctxt->method = method;
583 Authctxt *authctxt = ssh->authctxt;
585 if (authctxt == NULL)
587 free(authctxt->authlist);
588 authctxt->authlist = NULL;
589 if (authctxt->method != NULL && authctxt->method->cleanup != NULL)
590 authctxt->method->cleanup(ssh);
591 free(authctxt->methoddata);
592 authctxt->methoddata = NULL;
593 authctxt->success = 1; /* break out */
602 Authctxt *authctxt = ssh->authctxt;
604 if (authctxt == NULL)
608 authctxt->method->name);
616 Authctxt *authctxt = ssh->authctxt;
620 if (authctxt == NULL)
630 authctxt->method->name);
632 pubkey_reset(authctxt);
676 Authctxt *authctxt = ssh->authctxt;
685 if (authctxt == NULL)
713 TAILQ_FOREACH_REVERSE(id, &authctxt->keys, idlist, next) {
747 Authctxt *authctxt = (Authctxt *)ssh->authctxt;
756 if (authctxt->gss_supported_mechs == NULL)
757 gss_indicate_mechs(&min, &authctxt->gss_supported_mechs);
760 while (authctxt->mech_tried < authctxt->gss_supported_mechs->count &&
762 mech = &authctxt->gss_supported_mechs->
763 elements[authctxt->mech_tried];
766 mech, authctxt->host)) {
769 authctxt->mech_tried++;
776 authctxt->methoddata=(void *)gssctxt;
779 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 ||
780 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 ||
781 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 ||
795 authctxt->mech_tried++; /* Move along to next candidate */
803 Authctxt *authctxt = (Authctxt *)ssh->authctxt;
804 Gssctxt *gssctxt = (Gssctxt *)authctxt->methoddata;
807 authctxt->methoddata = NULL;
813 Authctxt *authctxt = ssh->authctxt;
814 Gssctxt *gssctxt = authctxt->methoddata;
850 ssh_gssapi_buildmic(b, authctxt->server_user,
851 authctxt->service, "gssapi-with-mic",
880 Authctxt *authctxt = ssh->authctxt;
886 if (authctxt == NULL)
888 gssctxt = authctxt->methoddata;
924 Authctxt *authctxt = ssh->authctxt;
931 if (authctxt == NULL)
956 Authctxt *authctxt = ssh->authctxt;
965 if (authctxt == NULL)
967 gssctxt = authctxt->methoddata;
1011 Authctxt *authctxt = (Authctxt *)ssh->authctxt;
1016 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 ||
1017 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 ||
1018 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 ||
1027 Authctxt *authctxt = (Authctxt *)ssh->authctxt;
1030 authctxt->host;
1033 if (authctxt->attempt_passwd++ >= options.number_of_password_prompts)
1036 if (authctxt->attempt_passwd != 1)
1039 xasprintf(&prompt, "%s@%s's password: ", authctxt->server_user, host);
1042 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 ||
1043 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 ||
1044 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 ||
1067 Authctxt *authctxt = ssh->authctxt;
1075 if (authctxt == NULL)
1078 host = options.host_key_alias ? options.host_key_alias : authctxt->host;
1086 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 ||
1087 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 ||
1088 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 ||
1094 authctxt->server_user, host);
1104 authctxt->server_user, host);
1113 authctxt->server_user, host);
1303 Authctxt *authctxt = (Authctxt *)ssh->authctxt;
1335 TAILQ_FOREACH(private_id, &authctxt->keys, next) {
1352 TAILQ_FOREACH(private_id, &authctxt->keys, next) {
1402 (r = sshbuf_put_cstring(b, authctxt->server_user)) != 0 ||
1403 (r = sshbuf_put_cstring(b, authctxt->service)) != 0 ||
1474 Authctxt *authctxt = (Authctxt *)ssh->authctxt;
1495 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 ||
1496 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 ||
1497 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 ||
1659 pubkey_prepare(struct ssh *ssh, Authctxt *authctxt)
1671 preferred = &authctxt->keys;
1757 authctxt->agent_fd = agent_fd;
1822 Authctxt *authctxt = (Authctxt *)ssh->authctxt;
1825 if (authctxt->agent_fd != -1) {
1826 ssh_close_authentication_socket(authctxt->agent_fd);
1827 authctxt->agent_fd = -1;
1829 for (id = TAILQ_FIRST(&authctxt->keys); id;
1830 id = TAILQ_FIRST(&authctxt->keys)) {
1831 TAILQ_REMOVE(&authctxt->keys, id, next);
1839 pubkey_reset(Authctxt *authctxt)
1843 TAILQ_FOREACH(id, &authctxt->keys, next)
1850 Authctxt *authctxt = (Authctxt *)ssh->authctxt;
1857 pubkey_prepare(ssh, authctxt);
1861 while ((id = TAILQ_FIRST(&authctxt->keys))) {
1865 TAILQ_REMOVE(&authctxt->keys, id, next);
1866 TAILQ_INSERT_TAIL(&authctxt->keys, id, next);
1900 Authctxt *authctxt = (Authctxt *)ssh->authctxt;
1903 if (authctxt->attempt_kbdint++ >= options.number_of_password_prompts)
1906 if (authctxt->attempt_kbdint > 1 && !authctxt->info_req_seen) {
1914 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 ||
1915 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 ||
1916 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 ||
1933 Authctxt *authctxt = ssh->authctxt;
1942 if (authctxt == NULL)
1945 authctxt->info_req_seen = 1;
1974 authctxt->server_user, options.host_key_alias ?
1975 options.host_key_alias : authctxt->host, prompt) == -1)
2120 Authctxt *authctxt = (Authctxt *)ssh->authctxt;
2128 if (authctxt->ktypes == NULL) {
2129 authctxt->oktypes = xstrdup(options.hostbased_accepted_algos);
2130 authctxt->ktypes = authctxt->oktypes;
2138 if (authctxt->active_ktype == NULL)
2139 authctxt->active_ktype = strsep(&authctxt->ktypes, ",");
2140 if (authctxt->active_ktype == NULL ||
2141 *authctxt->active_ktype == '\0')
2143 debug3_f("trying key type %s", authctxt->active_ktype);
2147 for (i = 0; i < authctxt->sensitive->nkeys; i++) {
2148 if (authctxt->sensitive->keys[i] == NULL ||
2149 authctxt->sensitive->keys[i]->type == KEY_UNSPEC)
2152 sshkey_ssh_name(authctxt->sensitive->keys[i]),
2153 authctxt->active_ktype))
2156 private = authctxt->sensitive->keys[i];
2157 authctxt->sensitive->keys[i] = NULL;
2164 authctxt->active_ktype = NULL;
2167 free(authctxt->oktypes);
2168 authctxt->oktypes = authctxt->ktypes = NULL;
2169 authctxt->active_ktype = NULL;
2180 sshkey_ssh_name(private), fp, authctxt->active_ktype);
2204 (r = sshbuf_put_cstring(b, authctxt->server_user)) != 0 ||
2205 (r = sshbuf_put_cstring(b, authctxt->service)) != 0 ||
2206 (r = sshbuf_put_cstring(b, authctxt->method->name)) != 0 ||
2207 (r = sshbuf_put_cstring(b, authctxt->active_ktype)) != 0 ||
2210 (r = sshbuf_put_cstring(b, authctxt->local_user)) != 0) {
2225 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 ||
2226 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 ||
2227 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 ||
2228 (r = sshpkt_put_cstring(ssh, authctxt->active_ktype)) != 0 ||
2231 (r = sshpkt_put_cstring(ssh, authctxt->local_user)) != 0 ||