From d968458ee4c6425ceb5bfa9126d9cd8efa2dbf3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Trevisan=20=28Trevi=C3=B1o=29?= Date: Wed, 18 Nov 2026 22:24:53 +0000 Subject: [PATCH 8/9] auth-pam: Allow keyboard-interactive provisioning Treat a successful PAM conversation as a candidate for promotion even if the login did not have a passwd entry at the initial lookup. --- auth-pam.c | 5 +++-- auth2-chall.c | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/auth-pam.c b/auth-pam.c index 29607e041..f3ebd987d 100644 --- a/auth-pam.c +++ b/auth-pam.c @@ -904,7 +904,8 @@ sshpam_query(void *ctx, char **name, char **info, /* FALLTHROUGH */ case PAM_SUCCESS: if (type == PAM_SUCCESS) { - if (!sshpam_authctxt->valid || + if ((!sshpam_authctxt->valid && + !sshpam_authctxt->deferred) || (sshpam_authctxt->pw->pw_uid == 0 && options.permit_root_login != PERMIT_YES)) fatal("Internal error: PAM auth " @@ -981,7 +982,7 @@ sshpam_respond(void *ctx, u_int num, char **resp) } if ((buffer = sshbuf_new()) == NULL) fatal_f("sshbuf_new failed"); - if (sshpam_authctxt->valid && + if ((sshpam_authctxt->valid || sshpam_authctxt->deferred) && (sshpam_authctxt->pw->pw_uid != 0 || options.permit_root_login == PERMIT_YES)) { if ((r = sshbuf_put_cstring(buffer, *resp)) != 0) diff --git a/auth2-chall.c b/auth2-chall.c index 1a4d26438..7778f60cc 100644 --- a/auth2-chall.c +++ b/auth2-chall.c @@ -347,7 +347,8 @@ input_userauth_info_response(int type, uint32_t seq, struct ssh *ssh) switch (res) { case 0: /* Success! */ - authenticated = authctxt->valid ? 1 : 0; + authenticated = authctxt->valid || (authctxt->deferred && + strcmp(kbdintctxt->device->name, "pam") == 0); break; case 1: /* Authentication needs further interaction */ -- 2.53.0