[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: Greatest value
weston@itdonline.net wrote:
>
> ldap_search( uid=* ) //find all entries
> new_uidnumber = count(results) + 1 // add 1 to the total
> while ( ldap_search( uidnumber=new_uidnumber ) )
> //loop and increment until the new number does
> //not match an existing entry
> new_uidnumber++
> //Use new number, confident it is unique....
>
> Now, this is probably really dumb code,
It has several problems:
1. Do not consider to use it with 10000+ entries
2. Reusing uid numbers not possible
3. Concurrency problems
I thought about this problem, too, but I had no real good answer.
Here are my work-arounds:
Assuming you're not reusing old uid numbers you could 1. do a more
efficient search for finding the highest uid number (interval
search) or 2. store the UID numbers in an extra list of your
maintenance application. You have also to solve the concurrency
problem in your user maintenance application.
Or you might just want to maintain an old /etc/passwd on one system
and create the user DB from that...
Ciao, Michael.