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

RE: compare uidNumber in LDAP



This is fine for a manual operation.  But I've written a web interface
in PHP that pulls the next available uidNumber (and other unique numbers
as well, like billing numbers) from an entry in the LDAP database.  This
is not so simple as I can find no way to test and set using php OR ldap.
Therefore I always risk a race condition where two users of the web page
may walk away with the same uid if they access the database for this
value pretty close to simultaneously.  Any known solutions to the
programmatic incrementing problem?

Mike

-----Original Message-----
From: owner-openldap-software@OpenLDAP.org
[mailto:owner-openldap-software@OpenLDAP.org] On Behalf Of Howard Chu
Sent: Thursday, October 24, 2002 6:38 PM
To: 'Jason Corley'; openldap-software@OpenLDAP.org
Subject: RE: compare uidNumber in LDAP

Yes, that sounds about right.

  -- 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: Jason Corley [mailto:Jason.Corley@togethersoft.com]
 
> So my understanding of your recommendation (or the attached 
> links) is to 
> create an entry like so:
> 
> 	dn: cn=maxUid,dc=example,dc=com
> 	objectClass: extensibleObject
> 	objectClass: top
> 	uidNumber: 500
> 
> And then do the following ldapmodify:
> 
> 	dn: cn=maxUid,dc=example,dc=com
> 	changetype: modify
> 	delete: uidNumber
> 	uidNumber: 500
> 	-
> 	add: uidNumber
> 	uidNumber: 501
> 
> Sorry if this is really basic, I'm just trying to make sure I 
> have a grasp on
> the solution.
> Jason
> 
> -----Original Message-----
> From: Howard Chu [mailto:hyc@highlandsun.com]
> Sent: Thursday, October 24, 2002 3:51 AM
> To: 'Derek Simkowiak'; 'Brian Leung'
> Cc: openldap-software@OpenLDAP.org
> Subject: RE: compare uidNumber in LDAP
> 
> 
> Best practice: search the archive.
> http://www.openldap.org/lists/openldap-software/200110/msg00548.html
> http://www.openldap.org/lists/openldap-software/200208/msg00358.html
> 
>   -- 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 
> Derek Simkowiak
> 
> > > My LDAP server's objects contain attribute uidNumber and i 
> > want to find
> > > out which is the maximum uidNumber.
> > 
> > 	I have this exact same problem!  Heh.  Let me guess: You want to
> > find the maximum uidNumber so that you can increment it by 
> > one and assign
> > that as the uidNumber for the next entry...?
> > 
> > > It is trouble that i use ldapsearch to find out which is 
> > maxmium so i
> > > find in cpan.perl.org.
> > 
> > 	I haven't tried to solve this problem yet.  I was 
> > hoping there was
> > some kind of auto-increment feature of LDAP that I haven't 
> found yet.
> > But if not, is the best thing to simply run a search?
> > 
> > 	Surely this is a common problem.  I imagine that the people who
> > came up with the posixAccount schema thought of a solution to 
> > this, or at
> > least, a "best practice".
> > 
> > 	What does everyone else do?
> > 
> > 
> > Thanks,
> > Derek
> > 
> > 
> > 
> > 
>