From a70f9c7c68eb0da135f51aaa7b1da5153715b712 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Thu, 16 Oct 2025 08:42:03 +0200 Subject: [PATCH] core: Don't use TTYPath= for PAM unless StandardInput=tty Fixes #39334 (cherry picked from commit f875a8026ec2dfa6026da3ee216782e9f7c04a43) --- src/core/exec-invoke.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/core/exec-invoke.c b/src/core/exec-invoke.c index 7fbc2d6a797..7eb7e624da7 100644 --- a/src/core/exec-invoke.c +++ b/src/core/exec-invoke.c @@ -1230,6 +1230,11 @@ static int exec_context_get_tty_for_pam(const ExecContext *context, char **ret) return 1; } + if (!IN_SET(context->std_input, EXEC_INPUT_TTY, EXEC_INPUT_TTY_FAIL, EXEC_INPUT_TTY_FORCE)) { + *ret = NULL; + return 0; + } + /* Next, let's try to use the TTY specified in TTYPath=. */ const char *t = exec_context_tty_path(context); if (!t) { -- 2.47.3