From: Todd C. Miller Date: Wed, 14 Jun 1995 08:41:54 +0000 (+0000) Subject: validate() now takes a flag that says whether or not to check the X-Git-Tag: SUDO_1_4_0~371 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b7660fc0777cdd932a2d4526db7445e798587235;p=sudo validate() now takes a flag that says whether or not to check the command --- diff --git a/parse.c b/parse.c index 52aa54e17..c9d716eab 100644 --- a/parse.c +++ b/parse.c @@ -80,7 +80,8 @@ int parse_error = FALSE; * this routine is called from the sudo.c module and tries to validate * the user, host and command triplet. */ -int validate() +int validate(check_cmnd) + int check_cmnd; { FILE *sudoers_fp; int i, return_code; @@ -118,14 +119,15 @@ int validate() return(VALIDATE_NO_USER); /* - * if the cmnd is the pseudo-command "validate" - * return VALIDATE_OK if the host matches, else - * check host and command. + * Only check the actual command if the check_cmnd + * flag is set. It is not set for the "validate" + * and "list" pseudo-commands. Always check the + * host and user. */ - if (!strcmp(cmnd, "validate")) + if (check_cmnd == FALSE) while (top) { 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); top--; }