Bug 14811

Summary: getpwent is not enumerating all entries in the passwd file when `+' appears after `+@' (using NIS)
Product: Base System Reporter: kokg <kokg>
Component: miscAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 3.3-RELEASE   
Hardware: Any   
OS: Any   

Description kokg 1999-11-10 12:30:01 UTC
If you're using NIS, and there is a `+'-line in /etc/passwd after a
`+@'-line, getpwent doesn't enumerate all entries, i.e. it stops after
processing the `+@'-line. This is a problem with samba-2.1.0-prealpha
that tries to build a hash-table of all users using getpwent.

Fix: 

Except for creating a huge netgroup with all users, no solution known.
How-To-Repeat: Add a `+@<netgroup>' and a `+' line to the /etc/passwd file. You can then
use a simple program, for example:

#include <sys/types.h>
#include <pwd.h>

struct passwd *p;

int main() {
    setpwent();

    while (p = getpwent()) {
        printf("name: %s\n", p->pw_name);
    };
}

(Another weird thing: some entries are listed twice when I try this on
my machine).
Comment 1 dirk freebsd_committer freebsd_triage 2000-11-09 12:13:03 UTC
State Changed
From-To: open->feedback

Please check if this problem still exists. 

I'm using netgroups a lot and haven't encountered any problems 
recently (on 4.1-RELEASE).
Comment 2 dirk freebsd_committer freebsd_triage 2000-12-30 15:26:29 UTC
State Changed
From-To: feedback->closed

Feedback timeout.