Make find_path() a little more generic by not checking def_foo
variables inside it. Instead, pass in ignore_dot as a function argument.
This commit is contained in:
@@ -738,6 +738,7 @@ static int
|
||||
set_cmnd(int sudo_mode)
|
||||
{
|
||||
int rval;
|
||||
char *path = user_path;
|
||||
|
||||
/* Set project if applicable. */
|
||||
set_project(runas_pw);
|
||||
@@ -752,13 +753,17 @@ set_cmnd(int sudo_mode)
|
||||
|
||||
if (sudo_mode & (MODE_RUN | MODE_EDIT | MODE_CHECK)) {
|
||||
if (ISSET(sudo_mode, MODE_RUN | MODE_CHECK)) {
|
||||
if (def_secure_path && !user_is_exempt())
|
||||
path = def_secure_path;
|
||||
set_perms(PERM_RUNAS);
|
||||
rval = find_path(NewArgv[0], &user_cmnd, user_stat, user_path);
|
||||
rval = find_path(NewArgv[0], &user_cmnd, user_stat, path,
|
||||
def_ignore_dot);
|
||||
restore_perms();
|
||||
if (rval != FOUND) {
|
||||
/* Failed as root, try as invoking user. */
|
||||
set_perms(PERM_USER);
|
||||
rval = find_path(NewArgv[0], &user_cmnd, user_stat, user_path);
|
||||
rval = find_path(NewArgv[0], &user_cmnd, user_stat, path,
|
||||
def_ignore_dot);
|
||||
restore_perms();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user