[Date Prev][Date Next]
Re: Antw: Re: create new user with same UID and GID
Ulrich Windl wrote:
Michael Ströder<firstname.lastname@example.org> schrieb am 21.02.2015 um 20:06 in
Bernd May wrote:
You could also create a dummy user account that stores the next usable
gid/uid pair (which you acquired once with the previous algorithm) and
then query that account each time you create a new user, increase its
gid and uid values and create your new user. This assumes some kind of
conflict free numbering scheme of your users by which you can infer the
next free number pair automatically.
The problem with id pool entries (kind of a sequence generator) is that ids
might be consumed without being really used. Therefore for numeric ids it's
better approach to search for all entries, use reverse server-side sorting
only query one result to get the highest id.
But that's somewhat "performance-heavy" I guess. What could help here would be
transactions (actually nested transactions). Consume a UID/GID and assign it to
a new entry in one transaction.
I don't see that nesting adds any benefit. But sure, you can use LDAP transactions here.
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/