diff options
author | wpaul <wpaul@FreeBSD.org> | 1995-09-02 04:08:55 +0000 |
---|---|---|
committer | wpaul <wpaul@FreeBSD.org> | 1995-09-02 04:08:55 +0000 |
commit | 6e8a774b0bbbf0bee95cbe6a5e67124fd0a51292 (patch) | |
tree | b4291fa214fdeb3695317da2efb57f708bde3493 /lib/libc/gen/getnetgrent.c | |
parent | 7ec855ea34c4df9137a3a8bb27d4cc4fa428610b (diff) | |
download | FreeBSD-src-6e8a774b0bbbf0bee95cbe6a5e67124fd0a51292.zip FreeBSD-src-6e8a774b0bbbf0bee95cbe6a5e67124fd0a51292.tar.gz |
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.
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 572a93a..3301b76 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 |