[Date Prev][Date Next] [Chronological] [Thread] [Top]

RE: how to check uniqueness of uidNumber ?

You don't need locks, LDAP already provides atomic actions. There's more than
one approach to solve a generic problem, you just have to understand the
approach that LDAP supports.

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc
  Symas: Premier OpenSource Development and Support

> -----Original Message-----
> From: owner-openldap-software@OpenLDAP.org
> [mailto:owner-openldap-software@OpenLDAP.org]On Behalf Of Jim C

> I'm trying to write scripts for this right now.
> The algorithm I am using works like this:
> 1. Retrieve / sort uids for a given ou.
> 2. Grab the biggest one.
> 3. Add 1.
> 4. Create a new record with the new uid.
> 5. Add it to the ldap server.
> Problem is that on a multi-user system, this should be an
> atomic action
> with locking.  Otherwise someone else who is also adding users might
> beat you to the next number causeing two users with the same number.
> Of course you can fix this also by makeing uidNumber part of the dn.
> I just don't get why this is not the default however, and doing this
> probably breaks a number of things such as directory_administrator.
> Man, there just really ought to be more server-side tools / schema
> adjustments /standards for copeing with uids/rids.
> Sameh Attia wrote:
> > Leonid Mamtchenkov wrote:
> ...
> > the uidNumber attribute of the posixAccount objectClass is single
> > valued; i.e. u cannot add more than one attribute of
> uidNumber to a dn
> > that has a posixAccount. So the only solution I think to
> guarantee the
> > uniqueness of ur customers' uidNumber is on ur client side.
> > 1 - search for this uidNumber in ur tree
> > 2 - if found then do not add
> > 3 - if not found then add
> > I hope this helps
> >