Move exec code to call into I/O log plugin to exec_iolog.c.

This will be shared with exec_nopty.c in the future to log
stdin/stdout/stderr without running the command in a pty.
Both exec_pty.c and exec_nopty.c now use the same closure.
This commit is contained in:
Todd C. Miller
2022-09-27 13:35:45 -06:00
parent 3ca9220e50
commit 803b4939be
9 changed files with 827 additions and 765 deletions

View File

@@ -531,3 +531,34 @@ terminate_command(pid_t pid, bool use_pgrp)
debug_return;
}
/*
* Free the dynamically-allocated contents of the exec closure.
*/
void
free_exec_closure(struct exec_closure *ec)
{
debug_decl(free_exec_closure, SUDO_DEBUG_EXEC);
/* Free any remaining intercept resources. */
intercept_cleanup();
sudo_ev_base_free(ec->evbase);
sudo_ev_free(ec->backchannel_event);
sudo_ev_free(ec->fwdchannel_event);
sudo_ev_free(ec->sigint_event);
sudo_ev_free(ec->sigquit_event);
sudo_ev_free(ec->sigtstp_event);
sudo_ev_free(ec->sigterm_event);
sudo_ev_free(ec->sighup_event);
sudo_ev_free(ec->sigalrm_event);
sudo_ev_free(ec->sigpipe_event);
sudo_ev_free(ec->sigusr1_event);
sudo_ev_free(ec->sigusr2_event);
sudo_ev_free(ec->sigchld_event);
sudo_ev_free(ec->sigcont_event);
sudo_ev_free(ec->siginfo_event);
sudo_ev_free(ec->sigwinch_event);
debug_return;
}