Lines Matching defs:authctxt
239 typedef struct Authctxt Authctxt;
254 struct Authctxt {
274 int (*userauth)(Authctxt *authctxt);
275 void (*cleanup)(Authctxt *authctxt);
292 int userauth_none(Authctxt *);
293 int userauth_pubkey(Authctxt *);
294 int userauth_passwd(Authctxt *);
295 int userauth_kbdint(Authctxt *);
296 int userauth_hostbased(Authctxt *);
297 int userauth_jpake(Authctxt *);
299 void userauth_jpake_cleanup(Authctxt *);
302 int userauth_gssapi(Authctxt *authctxt);
310 void userauth(Authctxt *, char *);
312 static int sign_and_send_pubkey(Authctxt *, Identity *);
313 static void pubkey_prepare(Authctxt *);
314 static void pubkey_cleanup(Authctxt *);
368 Authctxt authctxt;
396 memset(&authctxt, 0, sizeof(authctxt));
397 pubkey_prepare(&authctxt);
398 authctxt.server_user = server_user;
399 authctxt.local_user = local_user;
400 authctxt.host = host;
401 authctxt.service = "ssh-connection"; /* service name */
402 authctxt.success = 0;
403 authctxt.method = authmethod_lookup("none");
404 authctxt.authlist = NULL;
405 authctxt.methoddata = NULL;
406 authctxt.sensitive = sensitive;
407 authctxt.info_req_seen = 0;
408 if (authctxt.method == NULL)
412 userauth_none(&authctxt);
418 dispatch_run(DISPATCH_BLOCK, &authctxt.success, &authctxt); /* loop until success */
420 pubkey_cleanup(&authctxt);
423 debug("Authentication succeeded (%s).", authctxt.method->name);
427 userauth(Authctxt *authctxt, char *authlist)
429 if (authctxt->method != NULL && authctxt->method->cleanup != NULL)
430 authctxt->method->cleanup(authctxt);
432 if (authctxt->methoddata) {
433 xfree(authctxt->methoddata);
434 authctxt->methoddata = NULL;
437 authlist = authctxt->authlist;
439 if (authctxt->authlist)
440 xfree(authctxt->authlist);
441 authctxt->authlist = authlist;
447 authctxt->method = method;
454 if (method->userauth(authctxt) != 0) {
498 Authctxt *authctxt = ctxt;
500 if (authctxt == NULL)
502 if (authctxt->authlist) {
503 xfree(authctxt->authlist);
504 authctxt->authlist = NULL;
506 if (authctxt->method != NULL && authctxt->method->cleanup != NULL)
507 authctxt->method->cleanup(authctxt);
508 if (authctxt->methoddata) {
509 xfree(authctxt->methoddata);
510 authctxt->methoddata = NULL;
512 authctxt->success = 1; /* break out */
518 Authctxt *authctxt = ctxt;
520 if (authctxt == NULL)
524 authctxt->method->name);
531 Authctxt *authctxt = ctxt;
535 if (authctxt == NULL)
546 userauth(authctxt, authlist);
553 Authctxt *authctxt = ctxt;
562 if (authctxt == NULL)
603 TAILQ_FOREACH_REVERSE(id, &authctxt->keys, idlist, next) {
605 sent = sign_and_send_pubkey(authctxt, id);
617 userauth(authctxt, NULL);
622 userauth_gssapi(Authctxt *authctxt)
641 &gss_supported->elements[mech], authctxt->host)) {
651 authctxt->methoddata=(void *)gssctxt;
654 packet_put_cstring(authctxt->server_user);
655 packet_put_cstring(authctxt->service);
656 packet_put_cstring(authctxt->method->name);
681 Authctxt *authctxt = ctxt;
682 Gssctxt *gssctxt = authctxt->methoddata;
709 ssh_gssapi_buildmic(&b, authctxt->server_user,
710 authctxt->service, "gssapi-with-mic");
736 Authctxt *authctxt = ctxt;
741 if (authctxt == NULL)
743 gssctxt = authctxt->methoddata;
753 userauth(authctxt, NULL);
767 userauth(authctxt, NULL);
776 Authctxt *authctxt = ctxt;
781 if (authctxt == NULL)
795 userauth(authctxt, NULL);
804 Authctxt *authctxt = ctxt;
811 if (authctxt == NULL)
813 gssctxt = authctxt->methoddata;
852 userauth_none(Authctxt *authctxt)
856 packet_put_cstring(authctxt->server_user);
857 packet_put_cstring(authctxt->service);
858 packet_put_cstring(authctxt->method->name);
864 userauth_passwd(Authctxt *authctxt)
870 authctxt->host;
879 authctxt->server_user, host);
882 packet_put_cstring(authctxt->server_user);
883 packet_put_cstring(authctxt->service);
884 packet_put_cstring(authctxt->method->name);
905 Authctxt *authctxt = ctxt;
909 authctxt->host;
913 if (authctxt == NULL)
924 packet_put_cstring(authctxt->server_user);
925 packet_put_cstring(authctxt->service);
926 packet_put_cstring(authctxt->method->name);
930 authctxt->server_user, host);
939 authctxt->server_user, host);
947 authctxt->server_user, host);
984 jpake_password_to_secret(Authctxt *authctxt, const char *crypt_scheme,
993 authctxt->server_user, authctxt->host);
997 logit("Disabling %s authentication", authctxt->method->name);
998 authctxt->method->enabled = NULL;
1030 Authctxt *authctxt = ctxt;
1031 struct jpake_ctx *pctx = authctxt->methoddata;
1056 pctx->s = jpake_password_to_secret(authctxt, crypt_scheme, salt);
1098 Authctxt *authctxt = ctxt;
1099 struct jpake_ctx *pctx = authctxt->methoddata;
1145 Authctxt *authctxt = ctxt;
1146 struct jpake_ctx *pctx = authctxt->methoddata;
1161 debug("%s: %s success", __func__, authctxt->method->name);
1167 userauth_jpake_cleanup(authctxt);
1197 sign_and_send_pubkey(Authctxt *authctxt, Identity *id)
1226 buffer_put_cstring(&b, authctxt->server_user);
1230 authctxt->service);
1234 buffer_put_cstring(&b, authctxt->method->name);
1256 buffer_put_cstring(&b, authctxt->server_user);
1257 buffer_put_cstring(&b, authctxt->service);
1258 buffer_put_cstring(&b, authctxt->method->name);
1285 send_pubkey_test(Authctxt *authctxt, Identity *id)
1301 packet_put_cstring(authctxt->server_user);
1302 packet_put_cstring(authctxt->service);
1303 packet_put_cstring(authctxt->method->name);
1360 pubkey_prepare(Authctxt *authctxt)
1371 preferred = &authctxt->keys;
1418 authctxt->agent = ac;
1431 pubkey_cleanup(Authctxt *authctxt)
1435 if (authctxt->agent != NULL)
1436 ssh_close_authentication_connection(authctxt->agent);
1437 for (id = TAILQ_FIRST(&authctxt->keys); id;
1438 id = TAILQ_FIRST(&authctxt->keys)) {
1439 TAILQ_REMOVE(&authctxt->keys, id, next);
1449 userauth_pubkey(Authctxt *authctxt)
1454 while ((id = TAILQ_FIRST(&authctxt->keys))) {
1458 TAILQ_REMOVE(&authctxt->keys, id, next);
1459 TAILQ_INSERT_TAIL(&authctxt->keys, id, next);
1468 sent = send_pubkey_test(authctxt, id);
1474 sent = sign_and_send_pubkey(authctxt, id);
1489 userauth_kbdint(Authctxt *authctxt)
1496 if (attempt > 1 && !authctxt->info_req_seen) {
1504 packet_put_cstring(authctxt->server_user);
1505 packet_put_cstring(authctxt->service);
1506 packet_put_cstring(authctxt->method->name);
1522 Authctxt *authctxt = ctxt;
1529 if (authctxt == NULL)
1532 authctxt->info_req_seen = 1;
1651 userauth_hostbased(Authctxt *authctxt)
1654 Sensitive *sensitive = authctxt->sensitive;
1693 authctxt->service;
1699 buffer_put_cstring(&b, authctxt->server_user);
1701 buffer_put_cstring(&b, authctxt->method->name);
1705 buffer_put_cstring(&b, authctxt->local_user);
1725 packet_put_cstring(authctxt->server_user);
1726 packet_put_cstring(authctxt->service);
1727 packet_put_cstring(authctxt->method->name);
1731 packet_put_cstring(authctxt->local_user);
1745 userauth_jpake(Authctxt *authctxt)
1757 if (authctxt->methoddata != NULL)
1758 fatal("%s: authctxt->methoddata already set (%p)",
1759 __func__, authctxt->methoddata);
1761 authctxt->methoddata = pctx = jpake_new();
1768 packet_put_cstring(authctxt->server_user);
1769 packet_put_cstring(authctxt->service);
1770 packet_put_cstring(authctxt->method->name);
1805 userauth_jpake_cleanup(Authctxt *authctxt)
1808 if (authctxt->methoddata != NULL) {
1809 jpake_free(authctxt->methoddata);
1810 authctxt->methoddata = NULL;