Home | History | Annotate | Download | only in openssh

Lines Matching refs:authctxt

244 typedef struct cauthctxt Authctxt;
284 int (*userauth)(Authctxt *authctxt);
285 void (*cleanup)(Authctxt *authctxt);
301 int userauth_none(Authctxt *);
302 int userauth_pubkey(Authctxt *);
303 int userauth_passwd(Authctxt *);
304 int userauth_kbdint(Authctxt *);
305 int userauth_hostbased(Authctxt *);
308 int userauth_gssapi(Authctxt *authctxt);
316 void userauth(Authctxt *, char *);
318 static int sign_and_send_pubkey(Authctxt *, Identity *);
319 static void pubkey_prepare(Authctxt *);
320 static void pubkey_cleanup(Authctxt *);
321 static void pubkey_reset(Authctxt *);
369 Authctxt authctxt;
378 memset(&authctxt, 0, sizeof(authctxt));
379 pubkey_prepare(&authctxt);
380 authctxt.server_user = server_user;
381 authctxt.local_user = local_user;
382 authctxt.host = host;
383 authctxt.service = "ssh-connection"; /* service name */
384 authctxt.success = 0;
385 authctxt.method = authmethod_lookup("none");
386 authctxt.authlist = NULL;
387 authctxt.methoddata = NULL;
388 authctxt.sensitive = sensitive;
389 authctxt.active_ktype = authctxt.oktypes = authctxt.ktypes = NULL;
390 authctxt.info_req_seen = 0;
391 authctxt.agent_fd = -1;
392 if (authctxt.method == NULL)
403 ssh_dispatch_run(ssh, DISPATCH_BLOCK, &authctxt.success, &authctxt); /* loop until success */
405 pubkey_cleanup(&authctxt);
408 if (!authctxt.success)
410 debug("Authentication succeeded (%s).", authctxt.method->name);
417 Authctxt *authctxt = ctxt;
436 userauth_none(authctxt);
455 userauth(Authctxt *authctxt, char *authlist)
457 if (authctxt->method != NULL && authctxt->method->cleanup != NULL)
458 authctxt->method->cleanup(authctxt);
460 free(authctxt->methoddata);
461 authctxt->methoddata = NULL;
463 authlist = authctxt->authlist;
465 free(authctxt->authlist);
466 authctxt->authlist = authlist;
472 authctxt->method = method;
479 if (method->userauth(authctxt) != 0) {
519 Authctxt *authctxt = ctxt;
521 if (authctxt == NULL)
523 free(authctxt->authlist);
524 authctxt->authlist = NULL;
525 if (authctxt->method != NULL && authctxt->method->cleanup != NULL)
526 authctxt->method->cleanup(authctxt);
527 free(authctxt->methoddata);
528 authctxt->methoddata = NULL;
529 authctxt->success = 1; /* break out */
536 Authctxt *authctxt = ctxt;
538 if (authctxt == NULL)
542 authctxt->method->name);
550 Authctxt *authctxt = ctxt;
554 if (authctxt == NULL)
564 pubkey_reset(authctxt);
568 userauth(authctxt, authlist);
576 Authctxt *authctxt = ctxt;
585 if (authctxt == NULL)
628 TAILQ_FOREACH_REVERSE(id, &authctxt->keys, idlist, next) {
630 sent = sign_and_send_pubkey(authctxt, id);
642 userauth(authctxt, NULL);
648 userauth_gssapi(Authctxt *authctxt)
667 &gss_supported->elements[mech], authctxt->host)) {
677 authctxt->methoddata=(void *)gssctxt;
680 packet_put_cstring(authctxt->server_user);
681 packet_put_cstring(authctxt->service);
682 packet_put_cstring(authctxt->method->name);
707 Authctxt *authctxt = ctxt;
708 Gssctxt *gssctxt = authctxt->methoddata;
735 ssh_gssapi_buildmic(&b, authctxt->server_user,
736 authctxt->service, "gssapi-with-mic");
762 Authctxt *authctxt = ctxt;
767 if (authctxt == NULL)
769 gssctxt = authctxt->methoddata;
779 userauth(authctxt, NULL);
793 userauth(authctxt, NULL);
803 Authctxt *authctxt = ctxt;
808 if (authctxt == NULL)
822 userauth(authctxt, NULL);
832 Authctxt *authctxt = ctxt;
839 if (authctxt == NULL)
841 gssctxt = authctxt->methoddata;
881 userauth_none(Authctxt *authctxt)
885 packet_put_cstring(authctxt->server_user);
886 packet_put_cstring(authctxt->service);
887 packet_put_cstring(authctxt->method->name);
893 userauth_passwd(Authctxt *authctxt)
899 authctxt->host;
908 authctxt->server_user, host);
911 packet_put_cstring(authctxt->server_user);
912 packet_put_cstring(authctxt->service);
913 packet_put_cstring(authctxt->method->name);
934 Authctxt *authctxt = ctxt;
941 if (authctxt == NULL)
944 host = options.host_key_alias ? options.host_key_alias : authctxt->host;
953 packet_put_cstring(authctxt->server_user);
954 packet_put_cstring(authctxt->service);
955 packet_put_cstring(authctxt->method->name);
959 authctxt->server_user, host);
968 authctxt->server_user, host);
976 authctxt->server_user, host);
1064 sign_and_send_pubkey(Authctxt *authctxt, Identity *id)
1095 buffer_put_cstring(&b, authctxt->server_user);
1099 authctxt->service);
1103 buffer_put_cstring(&b, authctxt->method->name);
1117 TAILQ_FOREACH(private_id, &authctxt->keys, next) {
1134 TAILQ_FOREACH(private_id, &authctxt->keys, next) {
1171 buffer_put_cstring(&b, authctxt->server_user);
1172 buffer_put_cstring(&b, authctxt->service);
1173 buffer_put_cstring(&b, authctxt->method->name);
1200 send_pubkey_test(Authctxt *authctxt, Identity *id)
1216 packet_put_cstring(authctxt->server_user);
1217 packet_put_cstring(authctxt->service);
1218 packet_put_cstring(authctxt->method->name);
1303 pubkey_prepare(Authctxt *authctxt)
1314 preferred = &authctxt->keys;
1388 authctxt->agent_fd = agent_fd;
1439 pubkey_cleanup(Authctxt *authctxt)
1443 if (authctxt->agent_fd != -1)
1444 ssh_close_authentication_socket(authctxt->agent_fd);
1445 for (id = TAILQ_FIRST(&authctxt->keys); id;
1446 id = TAILQ_FIRST(&authctxt->keys)) {
1447 TAILQ_REMOVE(&authctxt->keys, id, next);
1455 pubkey_reset(Authctxt *authctxt)
1459 TAILQ_FOREACH(id, &authctxt->keys, next)
1478 userauth_pubkey(Authctxt *authctxt)
1483 while ((id = TAILQ_FIRST(&authctxt->keys))) {
1487 TAILQ_REMOVE(&authctxt->keys, id, next);
1488 TAILQ_INSERT_TAIL(&authctxt->keys, id, next);
1498 sent = send_pubkey_test(authctxt, id);
1507 authctxt, id);
1524 userauth_kbdint(Authctxt *authctxt)
1531 if (attempt > 1 && !authctxt->info_req_seen) {
1539 packet_put_cstring(authctxt->server_user);
1540 packet_put_cstring(authctxt->service);
1541 packet_put_cstring(authctxt->method->name);
1557 Authctxt *authctxt = ctxt;
1564 if (authctxt == NULL)
1567 authctxt->info_req_seen = 1;
1725 userauth_hostbased(Authctxt *authctxt)
1736 if (authctxt->ktypes == NULL) {
1737 authctxt->oktypes = xstrdup(options.hostbased_key_types);
1738 authctxt->ktypes = authctxt->oktypes;
1746 if (authctxt->active_ktype == NULL)
1747 authctxt->active_ktype = strsep(&authctxt->ktypes, ",");
1748 if (authctxt->active_ktype == NULL ||
1749 *authctxt->active_ktype == '\0')
1752 authctxt->active_ktype);
1756 for (i = 0; i < authctxt->sensitive->nkeys; i++) {
1757 if (authctxt->sensitive->keys[i] == NULL ||
1758 authctxt->sensitive->keys[i]->type == KEY_RSA1 ||
1759 authctxt->sensitive->keys[i]->type == KEY_UNSPEC)
1762 sshkey_ssh_name(authctxt->sensitive->keys[i]),
1763 authctxt->active_ktype, 0) != 1)
1766 private = authctxt->sensitive->keys[i];
1767 authctxt->sensitive->keys[i] = NULL;
1774 authctxt->active_ktype = NULL;
1777 free(authctxt->oktypes);
1778 authctxt->oktypes = authctxt->ktypes = NULL;
1779 authctxt->active_ktype = NULL;
1803 authctxt->service;
1816 (r = sshbuf_put_cstring(b, authctxt->server_user)) != 0 ||
1818 (r = sshbuf_put_cstring(b, authctxt->method->name)) != 0 ||
1822 (r = sshbuf_put_cstring(b, authctxt->local_user)) != 0) {
1830 if (authctxt
1842 (r = sshpkt_put_cstring(ssh, authctxt->server_user)) != 0 ||
1843 (r = sshpkt_put_cstring(ssh, authctxt->service)) != 0 ||
1844 (r = sshpkt_put_cstring(ssh, authctxt->method->name)) != 0 ||
1848 (r = sshpkt_put_cstring(ssh, authctxt->local_user)) != 0 ||