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:
@@ -564,7 +564,7 @@ sudoers_policy_exec_setup(char *argv[], char *envp[], mode_t cmnd_umask,
|
||||
debug_return_bool(true); /* nothing to do */
|
||||
|
||||
/* Increase the length of command_info as needed, it is *not* checked. */
|
||||
command_info = calloc(52, sizeof(char *));
|
||||
command_info = calloc(53, sizeof(char *));
|
||||
if (command_info == NULL)
|
||||
goto oom;
|
||||
|
||||
@@ -619,6 +619,8 @@ sudoers_policy_exec_setup(char *argv[], char *envp[], mode_t cmnd_umask,
|
||||
/* Set cwd to run user's homedir. */
|
||||
if ((command_info[info_len++] = sudo_new_key_val("cwd", runas_pw->pw_dir)) == NULL)
|
||||
goto oom;
|
||||
if ((command_info[info_len++] = strdup("cwd_optional=true")) == NULL)
|
||||
goto oom;
|
||||
}
|
||||
if ((command_info[info_len++] = sudo_new_key_val("runas_user", runas_pw->pw_name)) == NULL)
|
||||
goto oom;
|
||||
|
Reference in New Issue
Block a user