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

Re: How can I lock a record using php-ldap?



On Jan 21 at 6:40pm, Jim C wrote:

> A					B
> 					1. Retrieves uidNumber (say 501)
> 1. Retrieves uidNumber (say 501)	2. Increments it (now 502).
> 2. Increments it (now 502).		3. Sends it back to the server	
> 3. Sends it back to the server.	
> 
> A3 overwites B3's results and we have not only lost an update but we now 
> have two users with the same uidNumber.		

/sigh!

Take the following ldif file and run it against your server.  If the
second changetype: modify (the one marked "A3") set works, send a report
to openldap-its.


-----8<---------8<--------8<-------8<------8<-------8<------
dn: cn=Maximum UID Number,dc=example,dc=com
changetype: add
objectclass: top
objectclass: posixAccount
cn: Maximum UID Number
uid: junk
uidNumber: 501
gidNumber: 0
homeDirectory: /tmp

# Here's your "B3"
dn: cn=Maximum UID Number,dc=example,dc=com
changetype: modify
delete: uidNumber
uidNumber: 501
-
add: uidNumber
uidNumber: 502
-

# Here's your "A3"
dn: cn=Maximum UID Number,dc=example,dc=com
changetype: modify
delete: uidNumber
uidNumber: 501
-
add: uidNumber
uidNumber: 502
-

------8<-------8<--------8<-------

I predict that the second modify will fail.

-- 
Frank Swasey                    | http://www.uvm.edu/~fcs
Systems Programmer              | Always remember: You are UNIQUE,
University of Vermont           |    just like everyone else.
                    === God Bless Us All ===