From: Yu Watanabe Date: Fri, 7 Nov 2025 16:03:12 +0000 (+0900) Subject: core: assign TTY to PAM context when TTYPath= is specified X-Git-Tag: v259-rc1~132 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f0fdb69a8d83b543841e5ae1879241619959d881;p=thirdparty%2Fsystemd.git 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. --- 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; }