]> 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)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 6 Nov 2025 21:26:42 +0000 (21:26 +0000)
Fixes #39334

(cherry picked from commit f875a8026ec2dfa6026da3ee216782e9f7c04a43)

src/core/exec-invoke.c

index 7fbc2d6a797436ebeb4c047036e25aa57abbfc8d..7eb7e624da79cbe7dd032104aba2b7462349c1fb 100644 (file)
@@ -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) {