[python-ldap] syncrepl with refreshAndPersist not detecting deletes

Ben Cooksley bcooksley at kde.org
Thu May 31 03:25:57 CEST 2012


On Thu, May 31, 2012 at 3:56 AM, Michael Ströder <michael at stroeder.com> wrote:
> Ben Cooksley wrote:
>> With some help of the demo application, I now have a LDAP Syncrepl
>> client largely working. It detects additions, modifications and
>> deletions upon resuming perfectly, and additions and modifications
>> when persisting without problems too.
>
> I'd appreciate if you would contribute improvements to
> Demo/pyasn1/syncrepl.py if possible.

Hi Michael,

Please find the application I have written so far attached. It is
complete in terms of the LDAP functionality, as far as I have been
able to tell from my testing.

Key changes:
- Use of Shelve module instead of anydbm, to allow storage of all
attributes sent to us by the server.
- Proper closing of the data store to avoid corruption (particularly
relevant to anydbm on some systems)
- Handling of signals term and int.
- Handling of loss of connection to LDAP server, attempting to
reconnect every 5 seconds.
- Checks to ensure we don't try to delete a UUID we do not know about.
- Move of the configuration values such as the LDAP filter, bind dn
and password to seperate variables to ease configuration.
- Provides a 'hook' function to isolate the LDAP handling logic from
the application handling logic (such as database updating).

As I made some of these changes I did rename some variables however
(the big one being __db to __data) so it may be hard to diff them.
Otherwise, it makes use of the base of the existing syncrepl demo.

I will note, the account you run this under requires access to
entryUUID and entryCSN of all objects it is monitoring in order to
function properly, and your LDAP server must index those properties as
'pres, eq', otherwise things will not work properly from what I have
seen in my tests.

Thanks,
Ben
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sync.py
Type: text/x-python
Size: 4772 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20120531/b76846fe/attachment.py>


More information about the python-ldap mailing list