Replace has_meta() with a macro that calls strpbrk().

This commit is contained in:
Todd C. Miller
2007-08-30 20:15:48 +00:00
parent bb51d5210a
commit 1d69c0d63f

21
match.c
View File

@@ -94,9 +94,9 @@ __unused static const char rcsid[] = "$Sudo$";
#endif /* lint */
/*
* Prototypes
* Returns TRUE if string 's' contains meta characters.
*/
static int has_meta __P((char *));
#define has_meta(s) (strpbrk(s, "\\?*[]") != NULL)
/*
* Check for user described by pw in a list of members.
@@ -715,20 +715,3 @@ netgr_matches(netgr, lhost, shost, user)
return(FALSE);
}
/*
* Returns TRUE if "s" has shell meta characters in it,
* else returns FALSE.
*/
static int
has_meta(s)
char *s;
{
char *t;
for (t = s; *t; t++) {
if (*t == '\\' || *t == '?' || *t == '*' || *t == '[' || *t == ']')
return(TRUE);
}
return(FALSE);
}