mirror of
https://github.com/sudo-project/sudo.git
synced 2025-09-02 07:15:27 +00:00
can now deal with upcase HOST and USER names
This commit is contained in:
14
parse.yacc
14
parse.yacc
@@ -127,6 +127,8 @@ extern int usergr_matches __P((char *, char *));
|
||||
static int find_alias __P((char *, int));
|
||||
static int add_alias __P((char *, int));
|
||||
static int more_aliases __P((size_t));
|
||||
static void append_runas __P((struct sudo_match *, char *));
|
||||
static void append_cmnd __P((struct sudo_match *, char *));
|
||||
void yyerror __P((char *));
|
||||
|
||||
void yyerror(s)
|
||||
@@ -240,7 +242,8 @@ hostspec : ALL {
|
||||
(void) free($1);
|
||||
}
|
||||
| ALIAS {
|
||||
if (find_alias($1, HOST))
|
||||
/* could be an all-caps hostname */
|
||||
if (find_alias($1, HOST) || !strcasecmp(shost, $1))
|
||||
host_matches = TRUE;
|
||||
(void) free($1);
|
||||
}
|
||||
@@ -328,7 +331,11 @@ runasuser : NAME {
|
||||
(void) free($1);
|
||||
}
|
||||
| ALIAS {
|
||||
$$ = find_alias($1, USER);
|
||||
/* could be an all-caps username */
|
||||
if (find_alias($1, USER) || !strcmp($1, runas_user))
|
||||
$$ = TRUE;
|
||||
else
|
||||
$$ = FALSE;
|
||||
if (printmatches == TRUE && host_matches == TRUE
|
||||
&& user_matches == TRUE)
|
||||
append_runas(&matches[nummatches], $1);
|
||||
@@ -464,7 +471,8 @@ user : NAME {
|
||||
(void) free($1);
|
||||
}
|
||||
| ALIAS {
|
||||
if (find_alias($1, USER))
|
||||
/* could be an all-caps username */
|
||||
if (find_alias($1, USER) || !strcmp($1, user_name))
|
||||
user_matches = TRUE;
|
||||
(void) free($1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user