]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core: Don't use TTYPath= for PAM unless StandardInput=tty
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 16 Oct 2025 06:42:03 +0000 (08:42 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 16 Oct 2025 11:46:19 +0000 (13:46 +0200)
Fixes #39334

src/core/exec-invoke.c

index e02d2ddee6969b1de9e4b82a13173648466968b8..06052ef57df51c174be549a7c539d7b019599e6c 100644 (file)
@@ -1226,6 +1226,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) {