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 */
|
extern struct user_details user_details; /* XXX */
|
||||||
|
|
||||||
void
|
static void
|
||||||
script_setup(uid_t uid)
|
pty_setup(uid_t uid)
|
||||||
{
|
{
|
||||||
script_fds[SFD_USERTTY] = open(_PATH_TTY, O_RDWR|O_NOCTTY, 0);
|
script_fds[SFD_USERTTY] = open(_PATH_TTY, O_RDWR|O_NOCTTY, 0);
|
||||||
if (script_fds[SFD_USERTTY] != -1) {
|
if (script_fds[SFD_USERTTY] != -1) {
|
||||||
@@ -500,6 +500,10 @@ script_execve(struct command_details *details, char *argv[], char *envp[],
|
|||||||
cstat->type = CMD_INVALID;
|
cstat->type = CMD_INVALID;
|
||||||
|
|
||||||
log_io = !tq_empty(&io_plugins);
|
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
|
#ifdef HAVE_SELINUX
|
||||||
rbac_enabled = is_selinux_enabled() > 0 && details->selinux_role != NULL;
|
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;
|
cstat.val = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX - missing closefrom(), may not be possible in new scheme
|
* XXX - no background support
|
||||||
* also 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);
|
script_execve(details, argv, envp, &cstat);
|
||||||
|
|
||||||
switch (cstat.type) {
|
switch (cstat.type) {
|
||||||
|
@@ -160,7 +160,6 @@ void zero_bytes(volatile void *, size_t);
|
|||||||
/* script.c */
|
/* script.c */
|
||||||
int script_execve(struct command_details *details, char *argv[], char *envp[],
|
int script_execve(struct command_details *details, char *argv[], char *envp[],
|
||||||
struct command_status *cstat);
|
struct command_status *cstat);
|
||||||
void script_setup(uid_t);
|
|
||||||
|
|
||||||
/* term.c */
|
/* term.c */
|
||||||
int term_cbreak(int);
|
int term_cbreak(int);
|
||||||
|
Reference in New Issue
Block a user