Add cwd_optional to command details and enable it in the sudoers plugin.
If cwd_optional is set to true, a failure to set the cwd will be a warning, not an error, and the command will still run. Debian bug #598519
This commit is contained in:
@@ -678,6 +678,15 @@ command_info_to_details(char * const info[], struct command_details *details)
|
||||
SET_STRING("chroot=", chroot)
|
||||
SET_STRING("command=", command)
|
||||
SET_STRING("cwd=", cwd)
|
||||
if (strncmp("cwd_optional=", info[i], sizeof("cwd_optional=") - 1) == 0) {
|
||||
cp = info[i] + sizeof("cwd_optional=") - 1;
|
||||
details->cwd_optional = sudo_strtobool(cp);
|
||||
if (details->cwd_optional == -1) {
|
||||
errno = EINVAL;
|
||||
sudo_fatal("%s", info[i]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (strncmp("closefrom=", info[i], sizeof("closefrom=") - 1) == 0) {
|
||||
cp = info[i] + sizeof("closefrom=") - 1;
|
||||
details->closefrom = sudo_strtonum(cp, 0, INT_MAX, &errstr);
|
||||
|
Reference in New Issue
Block a user