2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-08-31 14:25:15 +00:00

Fix handling of timeout values in sudoers.

When passing the timeout back to the front end, ignore the
user-specified timeout if it is not set (initialized to 0).
Otherwise, sudo would choose a zero user-specified timeout over
the sudoers-specified timeout (non-zero).
This commit is contained in:
Todd C. Miller
2018-10-18 08:08:44 -06:00
parent 675fc34c3d
commit 63afa569f7

View File

@@ -676,9 +676,9 @@ sudoers_policy_exec_setup(char *argv[], char *envp[], mode_t cmnd_umask,
goto oom;
}
if (def_command_timeout > 0 || user_timeout > 0) {
int timeout = def_command_timeout;
if (timeout <= 0 || user_timeout < timeout)
timeout = user_timeout;
int timeout = user_timeout;
if (timeout == 0 || def_command_timeout < timeout)
timeout = def_command_timeout;
if (asprintf(&command_info[info_len++], "timeout=%u", timeout) == -1)
goto oom;
}