Is it possible for an overlay to detect the type of the underlying backend? In the case the answer is affermative and the backend is a bdb is it possible to programmatically force the bdb to save an entry created at runtime?
Thanks in advance, Luca Regini
luca regini wrote:
Is it possible for an overlay to detect the type of the underlying backend?
Yes: inspect
((slap_overinst*)op->o_bd->bd_info)->on_info->oi_orig->bi_type
it's a string containing the name of the original backend type.
In the case the answer is affermative and the backend is a bdb is it possible to programmatically force the bdb to save an entry created at runtime?
Yes: cook an Operation structure with data appropriate for a LDAP_REQ_ADD, set
BackendDB db = *op->o_bd; Operation op2 = *op; SlapReply rs2;
op2.o_bd = &db; db.bd_info = ((slap_overinst*)op->o_bd->bd_info)->on_info->oi_orig
and call
op2.o_bd->be_add( &op2, &rs2 );
There's plenty of examples in overlays released with OpenLDAP software.
p.
Ing. Pierangelo Masarati OpenLDAP Core Team
SysNet s.r.l. via Dossi, 8 - 27100 Pavia - ITALIA http://www.sys-net.it --------------------------------------- Office: +39 02 23998309 Mobile: +39 333 4963172 Email: pierangelo.masarati@sys-net.it ---------------------------------------