From f0fdb69a8d83b543841e5ae1879241619959d881 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 8 Nov 2025 01:03:12 +0900 Subject: [PATCH] core: assign TTY to PAM context when TTYPath= is specified Fixes #38486 again, which was fixed by 1405d46bf998b5a4b6f572a14ac88890828a405d, but regressed again by f875a8026ec2dfa6026da3ee216782e9f7c04a43. This also make it use exec_input_is_terminal(). Follow-up for f875a8026ec2dfa6026da3ee216782e9f7c04a43. --- src/core/exec-invoke.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/core/exec-invoke.c b/src/core/exec-invoke.c index 592b593e997..ba610c217e9 100644 --- a/src/core/exec-invoke.c +++ b/src/core/exec-invoke.c @@ -1237,7 +1237,10 @@ 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)) { + /* Do not implicitly configure TTY unless TTYPath= or StandardInput=tty is specified. See issue + * #39334. Note, exec_context_tty_path() returns "/dev/console" when TTYPath= is unspecified, hence + * explicitly check context->tty_path here. */ + if (!context->tty_path && !exec_input_is_terminal(context->std_input)) { *ret = NULL; return 0; } -- 2.47.3