Add CHROOT and CWD sudoers options.

Also matching runchroot and runcwd Defaults settings.
This commit is contained in:
Todd C. Miller
2020-09-01 06:26:00 -06:00
parent c4a579cf8a
commit 6bdfd010d2
35 changed files with 3189 additions and 2162 deletions

View File

@@ -239,6 +239,24 @@ apply_cmndspec(struct cmndspec *cs)
#endif /* HAVE_PRIV_SET */
if (cs->timeout > 0)
def_command_timeout = cs->timeout;
if (cs->runcwd != NULL) {
free(def_runcwd);
def_runcwd = strdup(cs->runcwd);
if (def_runcwd == NULL) {
sudo_warnx(U_("%s: %s"), __func__,
U_("unable to allocate memory"));
debug_return_bool(false);
}
}
if (cs->runchroot != NULL) {
free(def_runchroot);
def_runchroot = strdup(cs->runchroot);
if (def_runchroot == NULL) {
sudo_warnx(U_("%s: %s"), __func__,
U_("unable to allocate memory"));
debug_return_bool(false);
}
}
if (cs->tags.nopasswd != UNSPEC)
def_authenticate = !cs->tags.nopasswd;
if (cs->tags.noexec != UNSPEC)