Date: Wed, 9 May 2001 16:40:05 -0700 (PDT) From: Dima Dorfman <dima@unixfreak.org> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/27230: Users after NIS lines in /etc/passwd Message-ID: <200105092340.f49Ne5x73370@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/27230; it has been noted by GNATS. From: Dima Dorfman <dima@unixfreak.org> To: quinot@inf.enst.fr Cc: FreeBSD-gnats-submit@freebsd.org, nectar@freebsd.org Subject: Re: bin/27230: Users after NIS lines in /etc/passwd Date: Wed, 09 May 2001 16:38:23 -0700 quinot@inf.enst.fr writes: > > >Number: 27230 > >Category: bin > >Synopsis: Users after NIS lines in /etc/passwd > > >Description: > Consider a /etc/master.passwd with the following structure: > root:... > user1:... > +:... > user2:... > > ie using NIS ('+' line) AND with a local user declared > after the '+' line. > > When both ypbind and rpcbind are running, user2 is seen correctly. > > When neither of them is running, running 'id user2' hangs for > 75 seconds in getpwnam(), then returns 'no such user'. > > When only rpcbind is running, it does not hang but returns > 'no such user' immediately. This is an artifact of the introduction of nsswitch. Basically, when the database-specific lookup routines return NS_UNAVAIL, the search is short-circuited. This is wrong because, as you show, there may be entries later on for which the routine won't return NS_UNAVAIL. The attached patch seems to fix this for me. Please try it and see if it works for you, too. If you're not confident with being able to rebuild libc and the appropriate programs correctly, you'll probably want to do a full make world. > There is a similar problem with /etc/groups, which had > the unfortunate on my system that the > chown root:wheel /dev/tty[pqrsPQRS]* > in /etc/rc took ages, because '+' was before 'wheel' in > my /etc/groups. This problem doesn't seem to affect groups. I can't reproduce it, and a quick look at the code supports this observation. Perhaps there were other causes for the delay you describe above. Dima Dorfman dima@unixfreak.org Index: getpwent.c =================================================================== RCS file: /st/src/FreeBSD/src/lib/libc/gen/getpwent.c,v retrieving revision 1.59 diff -u -r1.59 getpwent.c --- getpwent.c 2001/01/24 12:59:22 1.59 +++ getpwent.c 2001/05/09 23:27:55 @@ -910,7 +910,7 @@ r = __getpwcompat(_PW_KEYBYNAME, 0, user); if (r == NS_UNAVAIL) - return r; + break; if (r == NS_NOTFOUND) { /* * just because this user is bad @@ -924,7 +924,7 @@ r = __getpwcompat(_PW_KEYBYNAME, 0, user); if (r == NS_UNAVAIL) - return r; + break; if (r == NS_NOTFOUND) continue; break; To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200105092340.f49Ne5x73370>