in sudoers, 'command ""' now means command with no args
This commit is contained in:
22
parse.c
22
parse.c
@@ -182,7 +182,7 @@ int validate(check_cmnd)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* If path doesn't end in /, return TRUE iff cmnd & path name the same inode;
|
* If path doesn't end in /, return TRUE iff cmnd & path name the same inode;
|
||||||
* otherwise, return TRUE if cmnd names one of the inodes in path
|
* otherwise, return TRUE if cmnd names one of the inodes in path.
|
||||||
*/
|
*/
|
||||||
int command_matches(cmnd, user_args, path, sudoers_args)
|
int command_matches(cmnd, user_args, path, sudoers_args)
|
||||||
char *cmnd;
|
char *cmnd;
|
||||||
@@ -227,6 +227,9 @@ int command_matches(cmnd, user_args, path, sudoers_args)
|
|||||||
return(TRUE);
|
return(TRUE);
|
||||||
else if (user_args && sudoers_args)
|
else if (user_args && sudoers_args)
|
||||||
return(compare_args(user_args, sudoers_args));
|
return(compare_args(user_args, sudoers_args));
|
||||||
|
else if (!user_args && sudoers_args && sudoers_args[0][0] == '\0' &&
|
||||||
|
sudoers_args[1] == NULL)
|
||||||
|
return(TRUE);
|
||||||
else
|
else
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
} else {
|
} else {
|
||||||
@@ -252,15 +255,16 @@ int command_matches(cmnd, user_args, path, sudoers_args)
|
|||||||
* (in sudoers or command) or if the args match;
|
* (in sudoers or command) or if the args match;
|
||||||
* else return false.
|
* else return false.
|
||||||
*/
|
*/
|
||||||
if (cmnd_st.st_dev == pst.st_dev && cmnd_st.st_ino == pst.st_ino) {
|
if (cmnd_st.st_dev != pst.st_dev || cmnd_st.st_ino != pst.st_ino)
|
||||||
if (!sudoers_args) {
|
|
||||||
return(TRUE);
|
|
||||||
} else if (user_args && sudoers_args) {
|
|
||||||
return(compare_args(user_args, sudoers_args));
|
|
||||||
} else {
|
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
if (!sudoers_args)
|
||||||
} else
|
return(TRUE);
|
||||||
|
else if (user_args && sudoers_args)
|
||||||
|
return(compare_args(user_args, sudoers_args));
|
||||||
|
else if (!user_args && sudoers_args && sudoers_args[0][0] == '\0' &&
|
||||||
|
sudoers_args[1] == NULL)
|
||||||
|
return(TRUE);
|
||||||
|
else
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user