[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
How can I lock a record using php-ldap?
I need to be able to lock an attribute, series of entries or one record
and then perform several actions and then unlock the attribute. How can
this be done?
Not being able to do this would constitute a bug because it means that
there will always be problems with race conditions between scripts.
This is easily proveable.
Say you have two scripts, A and B that are trying to add a user.
What if:
We have a central location for storeing the uidNumber that is currently
the largest.
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.
ldapmodify is atomic but we cannot retrieve the number and modify it
simultaneously. While we are doing the increment there is always the
possibility that another script will beat us to the punch.