core: Don't use TTYPath= for PAM unless StandardInput=tty

Fixes #39334
This commit is contained in:
Daan De Meyer
2025-10-16 08:42:03 +02:00
committed by Lennart Poettering
parent 6c80ab85f5
commit f875a8026e

View 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) {