Joerg Hoh
2005-Oct-25 20:34 UTC
Bug#119597: adduser: do not call getpwent in a loop if possible
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@melix.com.mx>
Marc Haber
2005-Nov-02 21:33 UTC
[Adduser-devel] Bug#119597: Re: adduser: do not call getpwent in a loop if possible
On Tue, Oct 25, 2005 at 10:18:32PM +0200, Joerg Hoh wrote:> 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.Maybe we could have a configuration option for that, defaulting to the version that is better for "files" NSS.> But we still need to consider that adduser isn''t the right tool if you > use LDAP (see #294579).Even on an LDAP-based system, new packages being installed will use adduser to create their package/daemon accounts. I think that this is the normal case where adduser will be used on an LDAP-based system. Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don''t trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 621 72739835