2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-09-02 15:25:58 +00:00

Add support for logging stdin/stdout/stderr in the non-pty exec path.

If we are logging I/O but not terminal input/output (either because
no terminal is present or because that is what the plugin requested),
the non-pty exec path is now taken.
This commit is contained in:
Todd C. Miller
2022-09-27 13:46:55 -06:00
parent 803b4939be
commit 87b7209ebb
8 changed files with 292 additions and 37 deletions

View File

@@ -980,14 +980,10 @@ exec_pty(struct command_details *details, struct command_status *cstat)
debug_decl(exec_pty, SUDO_DEBUG_EXEC);
/*
* Allocate a pty.
* Allocate a pty if sudo is running in a terminal.
*/
if (!pty_setup(details, user_details.tty)) {
if (TAILQ_EMPTY(&io_plugins)) {
/* Not logging I/O and didn't allocate a pty. */
debug_return_bool(false);
}
}
if (!pty_setup(details, user_details.tty))
debug_return_bool(false);
/*
* We communicate with the monitor over a bi-directional pair of sockets.