[Adduser-devel] Bug#119597: adduser: do not call getpwent in a loop if possible

Joerg Hoh joerg at joerghoh.de
Tue Oct 25 20:18:32 UTC 2005


Exchanging the

setgrent;
push @gids, $gid while defined($gid = (getgrent)[2]);
endgrent;

loop with something similar to this

my $id = $min;
while (defined(getpwuid($id))) $id++;
return $id;

has probably the already mentioned effect of slowing down when using
"files" NSS. But if the case is "slow vs fails because the LDAP server
doesn't even return all wanted values" slow code is acceptable.

But we still need to consider that adduser isn't the right tool if you
use LDAP (see #294579).

Joerg

-- 
Was denen einen ihr Watergate, ist den anderen ihr Firstgate.
- Thomas Bliessner, <slrnd1hklm.g53.nospam at melix.com.mx>




More information about the Adduser-devel mailing list