Just for fun I was testing the perl backend for openldap.
I starting setting up an LDAP using the SampleLdap.pm perl library in the source code.
My goal is to setup a consumer LDAP in synch with other LDAP (bdb backend) for keeping the mod add del etc. using the syncrepl mechanism.
I want to wrap every modification in the Master LDAP and triggering some perl script.
I'm very new to this approach and the first problem I'm facing is how to keep the last db state after a slapd crash or shutdown.
Using SamplLdap.pm init it's just a subroutine returning 0, so after the first sync if I shutdown the slapd next time I will need a full resync.
Do you know some other clever examples? I mean keeping the state of the LDAP and triggering, for example recording on files, the modifications on LDAP.
I tried to add in the subroutine some operation on FILES (using standard open FILE....;print FILE "operation"; close (FILE)) it seems do not work.
Many thanks to all!
If all you want to do is trigger based on add/del/mod, May I suggest you take a look at the auditlog overlay? It will let you store changes in LDIF format to a file, which you could later parse very easily with something like Perl.
--andy
Thank you andy for the suggestions!
This approach can be considered an offline one...I was looking for an online approach ( a sort of interception of add mod del and then an action related to that).
Furthermore, I would want to dig into this new backend to understand the potentiality.
However I am still stuck on how to mantain the state of ldap avoiding full sync in case of shutting down and crash.
And if someone have a good example of a working perl backend (SampleLdap it's just a skeleton).
Thank you again!
On Thu, Apr 8, 2010 at 6:33 PM, Andy Cobaugh phalenor@gmail.com wrote:
If all you want to do is trigger based on add/del/mod, May I suggest you take a look at the auditlog overlay? It will let you store changes in LDIF format to a file, which you could later parse very easily with something like Perl.
--andy
On Thursday, 8 April 2010 16:40:52 Andrea Cirulli wrote:
Just for fun I was testing the perl backend for openldap.
I starting setting up an LDAP using the SampleLdap.pm perl library in the source code.
My goal is to setup a consumer LDAP in synch with other LDAP (bdb backend) for keeping the mod add del etc. using the syncrepl mechanism.
Another option may be to have a standalone perl LDAP syncrepl consumer, such as is possible with Net::LDAPapi.
I needed to intercept changes and effect them in a different system during a long-ish migration (a few months), and used this approach.
Regards, Buchan
openldap-software@openldap.org