From: Daan De Meyer Date: Thu, 16 Oct 2025 06:42:03 +0000 (+0200) Subject: core: Don't use TTYPath= for PAM unless StandardInput=tty X-Git-Tag: v258.2~77 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a70f9c7c68eb0da135f51aaa7b1da5153715b712;p=thirdparty%2Fsystemd.git core: Don't use TTYPath= for PAM unless StandardInput=tty Fixes #39334 (cherry picked from commit f875a8026ec2dfa6026da3ee216782e9f7c04a43) --- 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) {