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

Re: syncrepl style client library functions



lee_jensen@sento.com wrote:

Hello,

I am currently using syncrepl to replicate to a slave ldap server. I am
impressed with the refresh and persist functionality and would like to
write a client application that performs certain actions when ldap
updates are made. Ideally this client would not poll the server but
could use a refresh and persist style search to recieve notification
when updates are made from the master.

A couple questions,

1) Is this possible?


It should be.

2) Are there any known client libraries specifically for scripting
languages (PHP,Perl,Python) A c library is also acceptable but requires
more work.


I would suggest Net::LDAP as it allows you the flexibility to define your own controls based on their ASN.1 definitions.

2) If I can use this kind of functionality from a scripting language and
a library is available how can I implement functionality like syncrepl
such that if the script dies it can reconnect and get changes made since
the script died as well as persist in recieving future updates. Also if
the LDAP server dies can I keep the client alive and poll the server
till it comes back up. Are these native library calls or do they need to
be implemented in some other way. (I realize this is many questions in
one, sorry)


You have to make sure you save the cookie sent from the server frequently and in a secure place, so you can pass this to the server the next time to only get the delta updates.

If the LDAP server dies you should get back some sort of error like LDAP_SERVER_DOWN, and you will get a similar error if you attempt to reconnect while the server is down. So yes, you could poll trying to reconnect until you get LDAP_SUCCESS.

Thanks for your help,

Lee