[Pkg-shadow-devel] Bug#526749: passwd: Infinite loop when reaching 60000 users

Nicolas François nicolas.francois at centraliens.net
Sun May 3 14:43:55 UTC 2009


Hello,

On Sun, May 03, 2009 at 12:04:52PM +0200, beuc at beuc.net wrote:
> On Sun, May 03, 2009 at 11:55:05AM +0200, Nicolas François wrote:
> > 
> > What were the symptoms you experienced?
> 
> I don't have anything related to LDAP here.
> 
> I added users >> /etc/passwd through:
> #include <stdio.h>
> int main(void)
> {
>   for (int i = 1001; i < 60000; i++)
>     printf("t%d:x:%d:%d::/home/t%d:/bin/sh\n", i, i, i, i);
> }
> 
> 'useradd t60000' worked fine, a bit slow but under 2 seconds.
> 'useradd t60001' didn't finish within 30 seconds.

Thanks for the test case.

With 1:4.1.3.1-1, there are no problems.
0m0.570s to add the last user
0m0.178s to report afterward:
useradd: Can't get unique UID (no more available UIDs)
useradd: can't create user

With 1:4.1.1-6, I could confirm the problem:
0m0.371s to add the last user
9m53.508s to report afterward:
Can't get unique UID (no more available UIDs)
useradd: can't create user

So this was not related to LDAP, but getpwent() rewinds to the
first entry after it returned NULL.

As the process eventually finishes (even if 10m on a fast box is quite
long), I don't think it requires an update for Lenny.

Any other opinion?

Best Regards,
-- 
Nekral





More information about the Pkg-shadow-devel mailing list