Lines Matching refs:authctxt
94 static Authmethod *authmethod_lookup(Authctxt *, const char *);
95 static char *authmethods_get(Authctxt *authctxt);
166 * loop until authctxt->success == TRUE
169 do_authentication2(Authctxt *authctxt)
173 dispatch_run(DISPATCH_BLOCK, &authctxt->success, authctxt);
180 Authctxt *authctxt = ctxt;
186 if (authctxt == NULL)
187 fatal("input_service_request: no authctxt");
190 if (!authctxt->success) {
216 Authctxt *authctxt = ctxt;
221 if (authctxt == NULL)
222 fatal("input_userauth_request: no authctxt");
228 debug("attempt %d failures %d", authctxt->attempt, authctxt->failures);
233 if (authctxt->attempt++ == 0) {
235 authctxt->pw = PRIVSEP(getpwnamallow(user));
236 authctxt->user = xstrdup(user);
237 if (authctxt->pw && strcmp(service, "ssh-connection")==0) {
238 authctxt->valid = 1;
239 debug2("%s: setting up authctxt for %s",
243 authctxt->pw = fakepw();
250 PRIVSEP(start_pam(authctxt));
253 authctxt->valid ? "authenticating " : "invalid ", user);
254 setproctitle("%s%s", authctxt->valid ? user : "unknown",
256 authctxt->service = xstrdup(service);
257 authctxt->style = style ? xstrdup(style) : NULL;
261 if (auth2_setup_methods_lists(authctxt) != 0)
263 } else if (strcmp(user, authctxt->user) != 0 ||
264 strcmp(service, authctxt->service) != 0) {
267 authctxt->user, authctxt->service, user, service);
270 auth2_challenge_stop(authctxt);
278 authctxt->postponed = 0;
279 authctxt->server_caused_failure = 0;
282 m = authmethod_lookup(authctxt, method);
283 if (m != NULL && authctxt->failures < options.max_authtries) {
285 authenticated = m->userauth(authctxt);
287 userauth_finish(authctxt, authenticated, method, NULL);
296 userauth_finish(Authctxt *authctxt, int authenticated, const char *method,
303 if (!authctxt->valid && authenticated)
305 authctxt->user);
306 if (authenticated && authctxt->postponed)
310 if (authenticated && authctxt->pw->pw_uid == 0 &&
319 if (!auth2_update_methods_lists(authctxt, method, submethod)) {
326 auth_log(authctxt, authenticated, partial, method, submethod);
328 if (authctxt->postponed)
341 "configuration", authctxt->user);
347 if (authenticated && cray_access_denied(authctxt->user)) {
349 fatal("Access denied for user %s.", authctxt->user);
360 authctxt->success = 1;
361 ssh_packet_set_log_preamble(ssh, "user %s", authctxt->user);
365 if (!partial && !authctxt->server_caused_failure &&
366 (authctxt->attempt > 1 || strcmp(method, "none") != 0))
367 authctxt->failures++;
368 if (authctxt->failures >= options.max_authtries) {
372 auth_maxtries_exceeded(authctxt);
374 methods = authmethods_get(authctxt);
392 auth2_method_allowed(Authctxt *authctxt, const char *method,
398 * NB. authctxt->num_auth_methods might be zero as a result of
403 for (i = 0; i < authctxt->num_auth_methods; i++) {
404 if (list_starts_with(authctxt->auth_methods[i], method,
412 authmethods_get(Authctxt *authctxt)
425 if (!auth2_method_allowed(authctxt, authmethods[i]->name,
440 authmethod_lookup(Authctxt *authctxt, const char *name)
449 auth2_method_allowed(authctxt,
507 * leave authctxt->num_auth_methods == 0, even when multiple required auth
512 auth2_setup_methods_lists(Authctxt *authctxt)
519 authctxt->auth_methods = xcalloc(options.num_auth_methods,
520 sizeof(*authctxt->auth_methods));
521 authctxt->num_auth_methods = 0;
530 authctxt->num_auth_methods, options.auth_methods[i]);
531 authctxt->auth_methods[authctxt->num_auth_methods++] =
534 if (authctxt->num_auth_methods == 0) {
601 auth2_update_methods_lists(Authctxt *authctxt, const char *method,
607 for (i = 0; i < authctxt->num_auth_methods; i++) {
608 if (!remove_method(&(authctxt->auth_methods[i]), method,
612 if (*authctxt->auth_methods[i] == '\0') {
617 i, authctxt->auth_methods[i]);