From owner-cvs-lib Mon Apr 15 17:24:22 1996 Return-Path: owner-cvs-lib Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id RAA20044 for cvs-lib-outgoing; Mon, 15 Apr 1996 17:24:22 -0700 (PDT) Received: (from wpaul@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id RAA19897 Mon, 15 Apr 1996 17:24:02 -0700 (PDT) Date: Mon, 15 Apr 1996 17:24:02 -0700 (PDT) From: Bill Paul Message-Id: <199604160024.RAA19897@freefall.freebsd.org> To: CVS-committers, cvs-all, cvs-lib, cvs-include, cvs-usrsbin Subject: cvs commit: src/include pwd.h src/lib/libc/gen getpwent.c getnetgrent.c src/usr.sbin/pwd_mkdb pwd_mkdb.c Sender: owner-cvs-lib@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk wpaul 96/04/15 17:24:00 Modified: lib/libc/gen getpwent.c getnetgrent.c include pwd.h Log: NIS cleanups and fixes, the next generation. getnetgrent.c: - Catch one bogon that snuck by: in _listmatch(), check for '\0' rather than '\n'; strings returned from yp_match() are terminated with a nul, not a newline. getpwent.c: - Rip out all of the +inclusion/-exclusion stuff from before and replace it with something a little less grotty. The main problem with the old mechanism was that it wasted many cycles processing NIS entries even after it already knew they were to be exlcuded (or not included, depending on your pointof view). The highlights of these changes include: o Uses an in-memory hash database table to keep track of all the -@netgroup, -user, and -@group exclusions. o Tries harder to duplicate the behavior normally obtained when using NIS inclusions/exclusions on a flat /etc/passwd file (meaning things come out in much the same order). o Uses seperate methods for handling getpwent() and getpwnam()/getpwuid() operations instead of trying to do everything with one general function, which didn't work as well as I thought it would. o Uses both getnetgrent() and innetgr() to try to save time where possible. o Use only one special token in the local password database (_PW_KEYYPBYNUM) instead of seperate tokens to mark + and - entries (and stop using the counter tokens too). If this new token doesn't exist, the code will make due with the standard _PW_KEYBYNUM token in order to support older databases that won't have the new token in them. All this is an attempt to make this stuff work better in environments with large NIS passwd databases. Revision Changes Path 1.32 +264 -264 src/lib/libc/gen/getpwent.c 1.15 +1 -1 src/lib/libc/gen/getnetgrent.c 1.5 +1 -4 src/include/pwd.h Modified: usr.sbin/pwd_mkdb pwd_mkdb.c Log: NIS cleanups and fixes, the next generation, continued. pwd_mkdb.c: - Don't save the PLUSCNT and MINUSCNT tokens: we don't need them anymore. - Count the + and - entires for NIS together instead of counting + and - entries seperately. Index all special NIS entries using new _PW_KEYYPBYNUM token. pwd.h: - Remove the PLUSBYNUM, MINUSBYNUM, PLUSCNT and MINUSCNT tokens and replace then with a single _PW_KEYYPBYNUM token. Revision Changes Path 1.10 +11 -56 src/usr.sbin/pwd_mkdb/pwd_mkdb.c