2
0
mirror of https://github.com/sudo-project/sudo.git synced 2025-09-02 15:25:58 +00:00

can now deal with upcase HOST and USER names

This commit is contained in:
Todd C. Miller
1996-08-15 19:47:58 +00:00
parent 085fbf8222
commit 0f643f7a47

View File

@@ -127,6 +127,8 @@ extern int usergr_matches __P((char *, char *));
static int find_alias __P((char *, int)); static int find_alias __P((char *, int));
static int add_alias __P((char *, int)); static int add_alias __P((char *, int));
static int more_aliases __P((size_t)); 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 __P((char *));
void yyerror(s) void yyerror(s)
@@ -240,7 +242,8 @@ hostspec : ALL {
(void) free($1); (void) free($1);
} }
| ALIAS { | ALIAS {
if (find_alias($1, HOST)) /* could be an all-caps hostname */
if (find_alias($1, HOST) || !strcasecmp(shost, $1))
host_matches = TRUE; host_matches = TRUE;
(void) free($1); (void) free($1);
} }
@@ -328,7 +331,11 @@ runasuser : NAME {
(void) free($1); (void) free($1);
} }
| ALIAS { | 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 if (printmatches == TRUE && host_matches == TRUE
&& user_matches == TRUE) && user_matches == TRUE)
append_runas(&matches[nummatches], $1); append_runas(&matches[nummatches], $1);
@@ -464,7 +471,8 @@ user : NAME {
(void) free($1); (void) free($1);
} }
| ALIAS { | ALIAS {
if (find_alias($1, USER)) /* could be an all-caps username */
if (find_alias($1, USER) || !strcmp($1, user_name))
user_matches = TRUE; user_matches = TRUE;
(void) free($1); (void) free($1);
} }