mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-03 15:55:40 +00:00
validate() now takes a flag that says whether or not to check the
command
This commit is contained in:
14
parse.c
14
parse.c
@@ -80,7 +80,8 @@ int parse_error = FALSE;
|
|||||||
* this routine is called from the sudo.c module and tries to validate
|
* this routine is called from the sudo.c module and tries to validate
|
||||||
* the user, host and command triplet.
|
* the user, host and command triplet.
|
||||||
*/
|
*/
|
||||||
int validate()
|
int validate(check_cmnd)
|
||||||
|
int check_cmnd;
|
||||||
{
|
{
|
||||||
FILE *sudoers_fp;
|
FILE *sudoers_fp;
|
||||||
int i, return_code;
|
int i, return_code;
|
||||||
@@ -118,14 +119,15 @@ int validate()
|
|||||||
return(VALIDATE_NO_USER);
|
return(VALIDATE_NO_USER);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if the cmnd is the pseudo-command "validate"
|
* Only check the actual command if the check_cmnd
|
||||||
* return VALIDATE_OK if the host matches, else
|
* flag is set. It is not set for the "validate"
|
||||||
* check host and command.
|
* and "list" pseudo-commands. Always check the
|
||||||
|
* host and user.
|
||||||
*/
|
*/
|
||||||
if (!strcmp(cmnd, "validate"))
|
if (check_cmnd == FALSE)
|
||||||
while (top) {
|
while (top) {
|
||||||
if (host_matches == TRUE)
|
if (host_matches == TRUE)
|
||||||
/* user may always do validate on allowed hosts */
|
/* user may always do validate or list on allowed hosts */
|
||||||
return(VALIDATE_OK);
|
return(VALIDATE_OK);
|
||||||
top--;
|
top--;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user