If /dev/tty is not available and no I/O logging plugins are configured,

fall back on exec_nopty() even if the policy plugin requested a pty.
We never allocate a pty when sudo is not run from a terminal anyway.
This commit is contained in:
Todd C. Miller
2017-09-07 11:32:30 -06:00
parent 2c2476f07f
commit 84af812b8c
4 changed files with 33 additions and 27 deletions

View File

@@ -340,7 +340,7 @@ free_exec_closure_nopty(struct exec_closure_nopty *ec)
/*
* Execute a command and wait for it to finish.
*/
int
void
exec_nopty(struct command_details *details, struct command_status *cstat)
{
struct exec_closure_nopty ec = { 0 };
@@ -371,7 +371,7 @@ exec_nopty(struct command_details *details, struct command_status *cstat)
/* Check for early termination or suspend signals before we fork. */
if (sudo_terminated(cstat)) {
sigprocmask(SIG_SETMASK, &oset, NULL);
debug_return_int(0);
debug_return;
}
ec.cmnd_pid = sudo_debug_fork();
@@ -436,7 +436,7 @@ exec_nopty(struct command_details *details, struct command_status *cstat)
/* Free things up. */
free_exec_closure_nopty(&ec);
debug_return_int(cstat->type == CMD_ERRNO ? -1 : 0);
debug_return;
}
/*