Now that we can determine the terminal even when file descriptors
are redirected we can check user_ttypath rather than opening /dev/tty when enforcing requiretty.
This commit is contained in:
@@ -324,14 +324,10 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Bail if a tty is required and we don't have one. */
|
/* Bail if a tty is required and we don't have one. */
|
||||||
if (def_requiretty) {
|
if (def_requiretty && user_ttypath == NULL) {
|
||||||
int fd = open(_PATH_TTY, O_RDWR|O_NOCTTY);
|
audit_failure(NewArgv, N_("no tty"));
|
||||||
if (fd == -1) {
|
warningx(_("sorry, you must have a tty to run sudo"));
|
||||||
audit_failure(NewArgv, N_("no tty"));
|
goto bad;
|
||||||
warningx(_("sorry, you must have a tty to run sudo"));
|
|
||||||
goto bad;
|
|
||||||
} else
|
|
||||||
(void) close(fd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user