diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2000-03-27 03:44:40 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2000-03-27 03:44:40 +0000 |
commit | 2973d269b6b765ebf9da010880d8df7b232c2bfe (patch) | |
tree | d906084a81de8e1143795dd439107c5fd984a071 /usr.bin/sudo/testsudoers.c | |
parent | 4108b06f79f213a1c3c81108f94c7ec4ee919043 (diff) |
sudo 1.6.3; see http://www.courtesan.com/sudo/current.html for a list
of changes.
Diffstat (limited to 'usr.bin/sudo/testsudoers.c')
-rw-r--r-- | usr.bin/sudo/testsudoers.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/usr.bin/sudo/testsudoers.c b/usr.bin/sudo/testsudoers.c index 0e32a2a542b..3e8110d0434 100644 --- a/usr.bin/sudo/testsudoers.c +++ b/usr.bin/sudo/testsudoers.c @@ -77,7 +77,7 @@ #endif /* HAVE_FNMATCH */ #ifndef lint -static const char rcsid[] = "$Sudo: testsudoers.c,v 1.68 2000/01/17 23:46:26 millert Exp $"; +static const char rcsid[] = "$Sudo: testsudoers.c,v 1.71 2000/03/23 04:38:22 millert Exp $"; #endif /* lint */ /* @@ -106,7 +106,7 @@ int has_meta(s) char *s; { - register char *t; + char *t; for (t = s; *t; t++) { if (*t == '\\' || *t == '?' || *t == '*' || *t == '[' || *t == ']') @@ -211,6 +211,25 @@ addr_matches(n) } int +hostname_matches(shost, lhost, pattern) + char *shost; + char *lhost; + char *pattern; +{ + if (has_meta(pattern)) { + if (strchr(pattern, '.')) + return(fnmatch(pattern, lhost, FNM_CASEFOLD)); + else + return(fnmatch(pattern, shost, FNM_CASEFOLD)); + } else { + if (strchr(pattern, '.')) + return(strcasecmp(lhost, pattern)); + else + return(strcasecmp(shost, pattern)); + } +} + +int usergr_matches(group, user) char *group; char *user; |