diff options
author | wpaul <wpaul@FreeBSD.org> | 1998-02-12 19:29:05 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1998-02-12 19:29:05 +0000 |
commit | 52d2adbd3e66759fdae33c9d4b326e233ce25a91 (patch) | |
tree | 2e36126b8ec913553acd72d07ebfc4b1d77fab90 /lib/libc | |
parent | e51227b005dc82b787cd2028ed63ae4254b1a917 (diff) | |
download | FreeBSD-src-52d2adbd3e66759fdae33c9d4b326e233ce25a91.zip FreeBSD-src-52d2adbd3e66759fdae33c9d4b326e233ce25a91.tar.gz |
Fix _listmatch() again so that it works with group lists containing only
one group. Thanks to Dirk Froemberg for supplying a patch for this. I will
be closing out the PR and moving this to the 2.2.5 branch later: my login
sessions to freefall from Columbia are ridiculously spotty today.
PR: 5610
Submitted by: Dirk Froemberg <ibex@physik.TU-Berlin.DE>
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/getnetgrent.c | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c index cc04f2f..da6d44d 100644 --- a/lib/libc/gen/getnetgrent.c +++ b/lib/libc/gen/getnetgrent.c @@ -286,14 +286,21 @@ static int _listmatch(list, group, len) while(isspace(*ptr)) ptr++; - while (ptr < list + len) { - cptr = ptr; - while(*ptr != ',' && !isspace(*ptr)) - ptr++; - if (strncmp(cptr, group, glen) == 0 && glen == (ptr - cptr)) + if (strchr(list, ',') == NULL) { + if (strncmp(ptr, group, glen) == 0) { return(1); - while(*ptr == ',' || isspace(*ptr)) - ptr++; + } + } else { + while (ptr < list + len) { + cptr = ptr; + while(*ptr != ',' && !isspace(*ptr)) + ptr++; + if (strncmp(cptr, group, glen) == 0 && + glen == (ptr - cptr)) + return(1); + while(*ptr == ',' || isspace(*ptr)) + ptr++; + } } return(0); |