I have inherited responsibility for a LDAP user management system
written in Python/Django:
In my rewrite come across a sticky problem: how do I reliably and
efficiently allocate unique uidNumber for new users and gidNumber of
The current solution, as used by my predecessor, is to list every user
or group in the system, sort or scan though the list looking for the
highest id, add 1, and use that.
Unfortunately, this seems to be lacking in efficiency (specially if
there are a lot of users) and relying on the hope that two users will
never be created at the same time. Race conditions could occur.
Only solution I can think of is to create a special server that
atomically allocates ids. Seems a lot of work for something so simple.
Any ideas for other solutions?
(not sure if this is on-topic or not for luv-main, so posting here
just to be safe)
Brian May <brian(a)microcomaustralia.com.au>