Rename script_setup() to pty_setup() and call from script_execve()
directly.
This commit is contained in:
@@ -138,8 +138,8 @@ static int safe_close(int fd);
|
||||
|
||||
extern struct user_details user_details; /* XXX */
|
||||
|
||||
void
|
||||
script_setup(uid_t uid)
|
||||
static void
|
||||
pty_setup(uid_t uid)
|
||||
{
|
||||
script_fds[SFD_USERTTY] = open(_PATH_TTY, O_RDWR|O_NOCTTY, 0);
|
||||
if (script_fds[SFD_USERTTY] != -1) {
|
||||
@@ -500,6 +500,10 @@ script_execve(struct command_details *details, char *argv[], char *envp[],
|
||||
cstat->type = CMD_INVALID;
|
||||
|
||||
log_io = !tq_empty(&io_plugins);
|
||||
if (log_io) {
|
||||
sudo_debug(8, "allocate pty for I/O logging");
|
||||
pty_setup(details->euid);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SELINUX
|
||||
rbac_enabled = is_selinux_enabled() > 0 && details->selinux_role != NULL;
|
||||
|
@@ -789,15 +789,9 @@ run_command(struct command_details *details, char *argv[], char *envp[])
|
||||
cstat.val = 0;
|
||||
|
||||
/*
|
||||
* XXX - missing closefrom(), may not be possible in new scheme
|
||||
* also no background support
|
||||
* XXX - no background support
|
||||
*/
|
||||
|
||||
/* If there are I/O plugins, allocate a pty and exec */
|
||||
if (!tq_empty(&io_plugins)) {
|
||||
sudo_debug(8, "setup I/O logging");
|
||||
script_setup(details->euid);
|
||||
}
|
||||
script_execve(details, argv, envp, &cstat);
|
||||
|
||||
switch (cstat.type) {
|
||||
|
@@ -160,7 +160,6 @@ void zero_bytes(volatile void *, size_t);
|
||||
/* script.c */
|
||||
int script_execve(struct command_details *details, char *argv[], char *envp[],
|
||||
struct command_status *cstat);
|
||||
void script_setup(uid_t);
|
||||
|
||||
/* term.c */
|
||||
int term_cbreak(int);
|
||||
|
Reference in New Issue
Block a user