diff options
author | Bill Paul <wpaul@FreeBSD.org> | 1995-09-02 04:08:55 +0000 |
---|---|---|
committer | Bill Paul <wpaul@FreeBSD.org> | 1995-09-02 04:08:55 +0000 |
commit | d454389cc2c86709d8d97b3bf2119e5bacccf82e (patch) | |
tree | b4291fa214fdeb3695317da2efb57f708bde3493 /lib/libc/gen/getnetgrent.c | |
parent | b62f3dc4287fa5b2b85505fc8986b95fe3e17e28 (diff) | |
download | src-d454389cc2c86709d8d97b3bf2119e5bacccf82e.tar.gz src-d454389cc2c86709d8d97b3bf2119e5bacccf82e.zip |
getpwent.c: turn the code that checks the override caches into a
seperate function to avoid duplication. Also fix getpwent() a
small bit to properly handle the case where the magic NIS '+'
entry appears before the end of the password file.
getgrent.c: be a little more SunOS-ish. Make it look like the NIS
group map is 'inserted' at the the point(s) where the magic NIS '+'
entry/entries appear.
getgrent: fix a file descriptor leak: remember to close the netgroup
file after we determine that we're using NIS-only innetgr() lookups.
Notes
Notes:
svn path=/head/; revision=10521
Diffstat (limited to 'lib/libc/gen/getnetgrent.c')
-rw-r--r-- | lib/libc/gen/getnetgrent.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/libc/gen/getnetgrent.c b/lib/libc/gen/getnetgrent.c index 572a93a38825..3301b7664658 100644 --- a/lib/libc/gen/getnetgrent.c +++ b/lib/libc/gen/getnetgrent.c @@ -90,7 +90,7 @@ static char sccsid[] = "@(#)getnetgrent.c 8.1 (Berkeley) 6/4/93"; #include <sys/param.h> #include <sys/errno.h> static char *_netgr_yp_domain; -static int _use_only_yp; +int _use_only_yp; static int _netgr_yp_enabled; static int _yp_innetgr; #endif @@ -163,6 +163,8 @@ setnetgrent(group) strcmp(group, grouphead.grname)) { endnetgrent(); #ifdef YP + /* Presumed guilty until proven innocent. */ + _use_only_yp = 0; /* * IF /etc/netgroup doesn't exist or is empty, * use NIS exclusively. @@ -187,8 +189,11 @@ setnetgrent(group) * lookup and we're in NIS-only mode, short-circuit * parse_netgroup() and cut directly to the chase. */ - if (_use_only_yp && _yp_innetgr) + if (_use_only_yp && _yp_innetgr) { + /* dohw! */ + fclose(netf); return; + } #else if (netf = fopen(_PATH_NETGROUP, "r")) { #endif |