Add a command line option to specify the command timeout, as long

as sudoers does not specify a shorter time limit.
This commit is contained in:
Todd C. Miller
2017-02-16 09:58:18 -07:00
parent 9b0622b58f
commit c86a6a23ad
14 changed files with 162 additions and 48 deletions

View File

@@ -476,10 +476,17 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
goto bad;
}
/* If user specified a timeout make sure sudoers allows it. */
if (!def_user_command_timeouts && user_timeout > 0) {
/* XXX - audit/log? */
sudo_warnx(U_("sorry, you are not allowed set a command timeout"));
goto bad;
}
/* If user specified env vars make sure sudoers allows it. */
if (ISSET(sudo_mode, MODE_RUN) && !def_setenv) {
if (ISSET(sudo_mode, MODE_PRESERVE_ENV)) {
/* XXX - audit? */
/* XXX - audit/log? */
sudo_warnx(U_("sorry, you are not allowed to preserve the environment"));
goto bad;
} else {