1 /* translucent.c - translucent proxy module */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2004-2007 The OpenLDAP Foundation.
6 * Portions Copyright 2005 Symas Corporation.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted only as authorized by the OpenLDAP
13 * A copy of this license is available in the file LICENSE in the
14 * top-level directory of the distribution or, alternatively, at
15 * <http://www.OpenLDAP.org/license.html>.
18 * This work was initially developed by Symas Corp. for inclusion in
19 * OpenLDAP Software. This work was sponsored by Hewlett-Packard.
24 #ifdef SLAPD_OVER_TRANSLUCENT
28 #include <ac/string.h>
29 #include <ac/socket.h>
37 typedef struct translucent_info {
38 BackendDB db; /* captive backend */
44 static ConfigLDAPadd translucent_ldadd;
45 static ConfigCfAdd translucent_cfadd;
47 static ConfigTable translucentcfg[] = {
48 { "translucent_strict", "on|off", 1, 2, 0,
49 ARG_ON_OFF|ARG_OFFSET,
50 (void *)offsetof(translucent_info, strict),
51 "( OLcfgOvAt:14.1 NAME 'olcTranslucentStrict' "
52 "DESC 'Reveal attribute deletion constraint violations' "
53 "SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
54 { "translucent_no_glue", "on|off", 1, 2, 0,
55 ARG_ON_OFF|ARG_OFFSET,
56 (void *)offsetof(translucent_info, no_glue),
57 "( OLcfgOvAt:14.2 NAME 'olcTranslucentNoGlue' "
58 "DESC 'Disable automatic glue records for ADD and MODRDN' "
59 "SYNTAX OMsBoolean SINGLE-VALUE )", NULL, NULL },
60 { NULL, NULL, 0, 0, 0, ARG_IGNORED }
63 static ConfigTable transdummy[] = {
64 { "", "", 0, 0, 0, ARG_IGNORED,
65 NULL, "( OLcfgGlAt:13 NAME 'olcDatabase' "
66 "DESC 'The backend type for a database instance' "
67 "SUP olcBackend SINGLE-VALUE X-ORDERED 'SIBLINGS' )", NULL, NULL },
68 { NULL, NULL, 0, 0, 0, ARG_IGNORED }
71 static ConfigOCs translucentocs[] = {
73 "NAME 'olcTranslucentConfig' "
74 "DESC 'Translucent configuration' "
75 "SUP olcOverlayConfig "
76 "MAY ( olcTranslucentStrict $ olcTranslucentNoGlue ) )",
77 Cft_Overlay, translucentcfg, NULL, translucent_cfadd },
79 "NAME 'olcTranslucentDatabase' "
80 "DESC 'Translucent target database configuration' "
81 "AUXILIARY )", Cft_Misc, transdummy, translucent_ldadd },
84 /* for translucent_init() */
87 translucent_ldadd_cleanup( ConfigArgs *ca )
89 slap_overinst *on = ca->private;
90 translucent_info *ov = on->on_bi.bi_private;
92 ov->defer_db_open = 0;
93 return backend_startup_one( ca->be, &ca->reply );
97 translucent_ldadd( CfEntryInfo *cei, Entry *e, ConfigArgs *ca )
100 translucent_info *ov;
102 Debug(LDAP_DEBUG_TRACE, "==> translucent_ldadd\n", 0, 0, 0);
104 if ( cei->ce_type != Cft_Overlay || !cei->ce_bi ||
105 cei->ce_bi->bi_cf_ocs != translucentocs )
106 return LDAP_CONSTRAINT_VIOLATION;
108 on = (slap_overinst *)cei->ce_bi;
109 ov = on->on_bi.bi_private;
112 ca->cleanup = translucent_ldadd_cleanup;
117 translucent_cfadd( Operation *op, SlapReply *rs, Entry *e, ConfigArgs *ca )
119 CfEntryInfo *cei = e->e_private;
120 slap_overinst *on = (slap_overinst *)cei->ce_bi;
121 translucent_info *ov = on->on_bi.bi_private;
124 Debug(LDAP_DEBUG_TRACE, "==> translucent_cfadd\n", 0, 0, 0);
126 /* FIXME: should not hardcode "olcDatabase" here */
127 bv.bv_len = snprintf( ca->cr_msg, sizeof( ca->cr_msg ),
128 "olcDatabase=%s", ov->db.bd_info->bi_type );
129 if ( bv.bv_len < 0 || bv.bv_len >= sizeof( ca->cr_msg ) ) {
132 bv.bv_val = ca->cr_msg;
134 ov->defer_db_open = 0;
136 /* We can only create this entry if the database is table-driven
138 if ( ov->db.bd_info->bi_cf_ocs )
139 config_build_entry( op, rs, cei, ca, &bv,
140 ov->db.bd_info->bi_cf_ocs,
141 &translucentocs[1] );
146 static slap_overinst translucent;
150 ** call syncrepl_add_glue() with the parent suffix;
154 static struct berval glue[] = { BER_BVC("top"), BER_BVC("glue"), BER_BVNULL };
156 void glue_parent(Operation *op) {
158 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
159 struct berval ndn = BER_BVNULL;
164 dnParent( &op->o_req_ndn, &pdn );
165 ber_dupbv_x( &ndn, &pdn, op->o_tmpmemctx );
167 Debug(LDAP_DEBUG_TRACE, "=> glue_parent: fabricating glue for <%s>\n", ndn.bv_val, 0, 0);
171 ber_dupbv(&e->e_name, &ndn);
172 ber_dupbv(&e->e_nname, &ndn);
174 a = attr_alloc( slap_schema.si_ad_objectClass );
176 a->a_vals = ch_malloc(sizeof(struct berval) * 3);
177 ber_dupbv(&a->a_vals[0], &glue[0]);
178 ber_dupbv(&a->a_vals[1], &glue[1]);
179 ber_dupbv(&a->a_vals[2], &glue[2]);
180 a->a_nvals = a->a_vals;
181 a->a_next = e->e_attrs;
184 a = attr_alloc( slap_schema.si_ad_structuralObjectClass );
186 a->a_vals = ch_malloc(sizeof(struct berval) * 2);
187 ber_dupbv(&a->a_vals[0], &glue[1]);
188 ber_dupbv(&a->a_vals[1], &glue[2]);
189 a->a_nvals = a->a_vals;
190 a->a_next = e->e_attrs;
197 nop.o_bd->bd_info = (BackendInfo *) on->on_info->oi_orig;
198 syncrepl_add_glue(&nop, e);
199 nop.o_bd->bd_info = (BackendInfo *) on;
201 op->o_tmpfree( ndn.bv_val, op->o_tmpmemctx );
211 BerVarray dup_bervarray(BerVarray b) {
214 for(len = 0; b[len].bv_val; len++);
215 nb = ch_malloc((len+1) * sizeof(BerValue));
216 for(i = 0; i < len; i++) ber_dupbv(&nb[i], &b[i]);
217 nb[len].bv_val = NULL;
224 ** free only the Attribute*, not the contents;
227 void free_attr_chain(Attribute *b) {
229 for(a=b; a; a=a->a_next) {
239 ** if not bound as root, send ACCESS error;
240 ** if glue, glue_parent();
245 static int translucent_add(Operation *op, SlapReply *rs) {
246 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
247 translucent_info *ov = on->on_bi.bi_private;
248 Debug(LDAP_DEBUG_TRACE, "==> translucent_add: %s\n",
249 op->o_req_dn.bv_val, 0, 0);
251 op->o_bd->bd_info = (BackendInfo *) on->on_info;
252 send_ldap_error(op, rs, LDAP_INSUFFICIENT_ACCESS,
253 "user modification of overlay database not permitted");
254 op->o_bd->bd_info = (BackendInfo *) on;
257 if(!ov->no_glue) glue_parent(op);
258 return(SLAP_CB_CONTINUE);
262 ** translucent_modrdn()
263 ** if not bound as root, send ACCESS error;
264 ** if !glue, glue_parent();
265 ** else return CONTINUE;
269 static int translucent_modrdn(Operation *op, SlapReply *rs) {
270 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
271 translucent_info *ov = on->on_bi.bi_private;
272 Debug(LDAP_DEBUG_TRACE, "==> translucent_modrdn: %s -> %s\n",
273 op->o_req_dn.bv_val, op->orr_newrdn.bv_val, 0);
275 op->o_bd->bd_info = (BackendInfo *) on->on_info;
276 send_ldap_error(op, rs, LDAP_INSUFFICIENT_ACCESS,
277 "user modification of overlay database not permitted");
278 op->o_bd->bd_info = (BackendInfo *) on;
281 if(!ov->no_glue) glue_parent(op);
282 return(SLAP_CB_CONTINUE);
286 ** translucent_delete()
287 ** if not bound as root, send ACCESS error;
288 ** else return CONTINUE;
292 static int translucent_delete(Operation *op, SlapReply *rs) {
293 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
294 Debug(LDAP_DEBUG_TRACE, "==> translucent_delete: %s\n",
295 op->o_req_dn.bv_val, 0, 0);
297 op->o_bd->bd_info = (BackendInfo *) on->on_info;
298 send_ldap_error(op, rs, LDAP_INSUFFICIENT_ACCESS,
299 "user modification of overlay database not permitted");
300 op->o_bd->bd_info = (BackendInfo *) on;
303 return(SLAP_CB_CONTINUE);
307 translucent_tag_cb( Operation *op, SlapReply *rs )
309 op->o_tag = LDAP_REQ_MODIFY;
310 op->orm_modlist = op->o_callback->sc_private;
311 rs->sr_tag = slap_req2res( op->o_tag );
313 return SLAP_CB_CONTINUE;
317 ** translucent_modify()
318 ** modify in local backend if exists in both;
319 ** otherwise, add to local backend;
320 ** fail if not defined in captive backend;
324 static int translucent_modify(Operation *op, SlapReply *rs) {
325 SlapReply nrs = { REP_RESULT };
328 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
329 translucent_info *ov = on->on_bi.bi_private;
330 Entry *e = NULL, *re = NULL;
332 Modifications *m, **mm;
333 int del, rc, erc = 0;
334 slap_callback cb = { 0 };
336 Debug(LDAP_DEBUG_TRACE, "==> translucent_modify: %s\n",
337 op->o_req_dn.bv_val, 0, 0);
339 if(ov->defer_db_open) {
340 send_ldap_error(op, rs, LDAP_UNAVAILABLE,
341 "remote DB not available");
345 ** fetch entry from the captive backend;
346 ** if it did not exist, fail;
347 ** release it, if captive backend supports this;
352 rc = ov->db.bd_info->bi_entry_get_rw(&nop, &nop.o_req_ndn, NULL, NULL, 0, &re);
353 if(rc != LDAP_SUCCESS || re == NULL ) {
354 send_ldap_error((&nop), rs, LDAP_NO_SUCH_OBJECT,
355 "attempt to modify nonexistent local record");
360 ** fetch entry from local backend;
362 ** foreach Modification:
363 ** if attr not present in local:
364 ** if Mod == LDAP_MOD_DELETE:
365 ** if remote attr not present, return NO_SUCH;
366 ** if remote attr present, drop this Mod;
367 ** else force this Mod to LDAP_MOD_ADD;
372 op->o_bd->bd_info = (BackendInfo *) on->on_info;
373 rc = be_entry_get_rw(op, &op->o_req_ndn, NULL, NULL, 0, &e);
374 op->o_bd->bd_info = (BackendInfo *) on;
376 if(e && rc == LDAP_SUCCESS) {
377 Debug(LDAP_DEBUG_TRACE, "=> translucent_modify: found local entry\n", 0, 0, 0);
378 for(mm = &op->orm_modlist; *mm; ) {
380 for(a = e->e_attrs; a; a = a->a_next)
381 if(a->a_desc == m->sml_desc) break;
384 continue; /* found local attr */
386 if(m->sml_op == LDAP_MOD_DELETE) {
387 for(a = re->e_attrs; a; a = a->a_next)
388 if(a->a_desc == m->sml_desc) break;
389 /* not found remote attr */
391 erc = LDAP_NO_SUCH_ATTRIBUTE;
395 erc = LDAP_CONSTRAINT_VIOLATION;
398 Debug(LDAP_DEBUG_TRACE,
399 "=> translucent_modify: silently dropping delete: %s\n",
400 m->sml_desc->ad_cname.bv_val, 0, 0);
403 slap_mods_free(m, 1);
406 m->sml_op = LDAP_MOD_ADD;
409 erc = SLAP_CB_CONTINUE;
412 if(ov->db.bd_info->bi_entry_release_rw)
413 ov->db.bd_info->bi_entry_release_rw(&nop, re, 0);
417 op->o_bd->bd_info = (BackendInfo *) on->on_info;
418 be_entry_release_r(op, e);
419 op->o_bd->bd_info = (BackendInfo *) on;
420 if(erc == SLAP_CB_CONTINUE) {
423 send_ldap_error(op, rs, erc,
424 "attempt to delete nonexistent attribute");
429 /* don't leak remote entry copy */
431 if(ov->db.bd_info->bi_entry_release_rw)
432 ov->db.bd_info->bi_entry_release_rw(&nop, re, 0);
437 ** foreach Modification:
438 ** if MOD_ADD or MOD_REPLACE, add Attribute;
439 ** if no Modifications were suitable:
440 ** if strict, throw CONSTRAINT_VIOLATION;
441 ** else, return early SUCCESS;
442 ** fabricate Entry with new Attribute chain;
443 ** glue_parent() for this Entry;
444 ** call bi_op_add() in local backend;
448 Debug(LDAP_DEBUG_TRACE, "=> translucent_modify: fabricating local add\n", 0, 0, 0);
450 for(del = 0, ax = NULL, m = op->orm_modlist; m; m = m->sml_next) {
452 if(((m->sml_op & LDAP_MOD_OP) != LDAP_MOD_ADD) &&
453 ((m->sml_op & LDAP_MOD_OP) != LDAP_MOD_REPLACE)) {
454 Debug(LDAP_DEBUG_ANY,
455 "=> translucent_modify: silently dropped modification(%d): %s\n",
456 m->sml_op, m->sml_desc->ad_cname.bv_val, 0);
457 if((m->sml_op & LDAP_MOD_OP) == LDAP_MOD_DELETE) del++;
460 atmp.a_desc = m->sml_desc;
461 atmp.a_vals = m->sml_values;
462 atmp.a_nvals = m->sml_nvalues ? m->sml_nvalues : atmp.a_vals;
463 atmp.a_numvals = m->sml_numvals;
465 a = attr_dup( &atmp );
470 if(del && ov->strict) {
472 send_ldap_error(op, rs, LDAP_CONSTRAINT_VIOLATION,
473 "attempt to delete attributes from local database");
479 send_ldap_error(op, rs, LDAP_CONSTRAINT_VIOLATION,
480 "modification contained other than ADD or REPLACE");
483 /* rs->sr_text = "no valid modification found"; */
484 rs->sr_err = LDAP_SUCCESS;
485 send_ldap_result(op, rs);
490 ber_dupbv( &e->e_name, &op->o_req_dn );
491 ber_dupbv( &e->e_nname, &op->o_req_ndn );
494 nop.o_tag = LDAP_REQ_ADD;
499 cb.sc_response = translucent_tag_cb;
500 cb.sc_private = op->orm_modlist;
501 cb.sc_next = nop.o_callback;
502 nop.o_callback = &cb;
503 rc = on->on_info->oi_orig->bi_op_add(&nop, &nrs);
504 if ( nop.ora_e == e )
510 static int translucent_compare(Operation *op, SlapReply *rs) {
512 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
513 translucent_info *ov = on->on_bi.bi_private;
514 AttributeAssertion *ava = op->orc_ava;
518 Debug(LDAP_DEBUG_TRACE, "==> translucent_compare: <%s> %s:%s\n",
519 op->o_req_dn.bv_val, ava->aa_desc->ad_cname.bv_val, ava->aa_value.bv_val);
522 ** if the local backend has an entry for this attribute:
523 ** CONTINUE and let it do the compare;
526 op->o_bd->bd_info = (BackendInfo *) on->on_info;
527 rc = be_entry_get_rw(op, &op->o_req_ndn, NULL, ava->aa_desc, 0, &e);
528 if(e && rc == LDAP_SUCCESS) {
529 be_entry_release_r(op, e);
530 op->o_bd->bd_info = (BackendInfo *) on;
531 return(SLAP_CB_CONTINUE);
533 op->o_bd->bd_info = (BackendInfo *) on;
535 if(ov->defer_db_open) {
536 send_ldap_error(op, rs, LDAP_UNAVAILABLE,
537 "remote DB not available");
541 ** call compare() in the captive backend;
542 ** return the result;
546 nop.o_callback = NULL;
547 rc = ov->db.bd_info->bi_op_compare(&nop, rs);
553 ** translucent_search_cb()
554 ** merge local data with the search result
558 static int translucent_search_cb(Operation *op, SlapReply *rs) {
560 Entry *e, *re = NULL;
561 Attribute *a, *ax, *an, *as = NULL;
562 Operation * original_op, local_op;
565 if(!op || !rs || rs->sr_type != REP_SEARCH || !rs->sr_entry)
566 return(SLAP_CB_CONTINUE);
568 Debug(LDAP_DEBUG_TRACE, "==> translucent_search_cb: %s\n",
569 rs->sr_entry->e_name.bv_val, 0, 0);
571 original_op = op->o_callback->sc_private;
572 on = (slap_overinst *) original_op->o_bd->bd_info;
573 local_op = *original_op;
575 local_op.o_bd->bd_info = (BackendInfo *) on->on_info->oi_orig;
576 rc = be_entry_get_rw(&local_op, &rs->sr_entry->e_nname, NULL, NULL, 0, &e);
577 local_op.o_bd->bd_info = (BackendInfo *) on;
580 ** if we got an entry from local backend:
581 ** make a copy of this search result;
582 ** foreach local attr:
583 ** foreach search result attr:
584 ** if match, result attr with local attr;
585 ** if new local, add to list;
586 ** append new local attrs to search result;
590 if(e && rc == LDAP_SUCCESS) {
591 re = entry_dup(rs->sr_entry);
592 for(ax = e->e_attrs; ax; ax = ax->a_next) {
594 if(is_at_operational(ax->a_desc->ad_type)) continue;
596 for(a = re->e_attrs; a; a = a->a_next) {
597 if(a->a_desc == ax->a_desc) {
598 if(a->a_vals != a->a_nvals)
599 ber_bvarray_free(a->a_nvals);
600 ber_bvarray_free(a->a_vals);
601 a->a_vals = dup_bervarray(ax->a_vals);
602 a->a_nvals = (ax->a_vals == ax->a_nvals) ?
603 a->a_vals : dup_bervarray(ax->a_nvals);
612 local_op.o_bd->bd_info = (BackendInfo *) on->on_info->oi_orig;
613 be_entry_release_r(&local_op, e);
614 local_op.o_bd->bd_info = (BackendInfo *) on;
616 /* literally append, so locals are always last */
619 for(ax = re->e_attrs; ax->a_next; ax = ax->a_next);
626 rs->sr_flags |= REP_ENTRY_MUSTBEFREED;
629 return(SLAP_CB_CONTINUE);
633 ** translucent_search()
634 ** search via captive backend;
635 ** override results with any local data;
639 static int translucent_search(Operation *op, SlapReply *rs) {
640 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
642 translucent_info *ov = on->on_bi.bi_private;
643 slap_callback cb = { NULL, NULL, NULL, NULL };
645 Debug(LDAP_DEBUG_TRACE, "==> translucent_search: <%s> %s\n",
646 op->o_req_dn.bv_val, op->ors_filterstr.bv_val, 0);
648 if(ov->defer_db_open) {
649 send_ldap_error(op, rs, LDAP_UNAVAILABLE,
650 "remote DB not available");
653 cb.sc_response = (slap_response *) translucent_search_cb;
655 cb.sc_next = nop.o_callback;
657 nop.o_callback = &cb;
659 return (ov->db.bd_info->bi_op_search(&nop, rs));
664 ** translucent_bind()
665 ** pass bind request to captive backend;
669 static int translucent_bind(Operation *op, SlapReply *rs) {
670 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
672 translucent_info *ov = on->on_bi.bi_private;
674 Debug(LDAP_DEBUG_TRACE, "translucent_bind: <%s> method %d\n",
675 op->o_req_dn.bv_val, op->orb_method, 0);
677 if(ov->defer_db_open) {
678 send_ldap_error(op, rs, LDAP_UNAVAILABLE,
679 "remote DB not available");
683 return (ov->db.bd_info->bi_op_bind(&nop, rs));
687 ** translucent_connection_destroy()
688 ** pass disconnect notification to captive backend;
692 static int translucent_connection_destroy(BackendDB *be, Connection *conn) {
693 slap_overinst *on = (slap_overinst *) be->bd_info;
694 translucent_info *ov = on->on_bi.bi_private;
697 Debug(LDAP_DEBUG_TRACE, "translucent_connection_destroy\n", 0, 0, 0);
699 rc = ov->db.bd_info->bi_connection_destroy(&ov->db, conn);
705 ** translucent_db_config()
706 ** pass config directives to captive backend;
707 ** parse unrecognized directives ourselves;
711 static int translucent_db_config(
719 slap_overinst *on = (slap_overinst *) be->bd_info;
720 translucent_info *ov = on->on_bi.bi_private;
722 Debug(LDAP_DEBUG_TRACE, "==> translucent_db_config: %s\n",
723 argc ? argv[0] : "", 0, 0);
725 /* Something for the captive database? */
726 if ( ov->db.bd_info && ov->db.bd_info->bi_db_config )
727 return ov->db.bd_info->bi_db_config( &ov->db, fname, lineno,
729 return SLAP_CONF_UNKNOWN;
733 ** translucent_db_init()
734 ** initialize the captive backend;
738 static int translucent_db_init(BackendDB *be, ConfigReply *cr) {
739 slap_overinst *on = (slap_overinst *) be->bd_info;
740 translucent_info *ov;
742 Debug(LDAP_DEBUG_TRACE, "==> translucent_db_init\n", 0, 0, 0);
744 ov = ch_calloc(1, sizeof(translucent_info));
745 on->on_bi.bi_private = ov;
747 ov->db.be_private = NULL;
748 ov->db.be_pcl_mutexp = &ov->db.be_pcl_mutex;
749 ov->defer_db_open = 1;
751 if ( !backend_db_init( "ldap", &ov->db, -1, NULL )) {
752 Debug( LDAP_DEBUG_CONFIG, "translucent: unable to open captive back-ldap\n", 0, 0, 0);
755 SLAP_DBFLAGS(be) |= SLAP_DBFLAG_NO_SCHEMA_CHECK;
756 SLAP_DBFLAGS(be) |= SLAP_DBFLAG_NOLASTMOD;
762 ** translucent_db_open()
763 ** if the captive backend has an open() method, call it;
767 static int translucent_db_open(BackendDB *be, ConfigReply *cr) {
768 slap_overinst *on = (slap_overinst *) be->bd_info;
769 translucent_info *ov = on->on_bi.bi_private;
772 Debug(LDAP_DEBUG_TRACE, "==> translucent_db_open\n", 0, 0, 0);
774 /* need to inherit something from the original database... */
775 ov->db.be_def_limit = be->be_def_limit;
776 ov->db.be_limits = be->be_limits;
777 ov->db.be_acl = be->be_acl;
778 ov->db.be_dfltaccess = be->be_dfltaccess;
780 if ( ov->defer_db_open )
783 rc = backend_startup_one( &ov->db, NULL );
785 if(rc) Debug(LDAP_DEBUG_TRACE,
786 "translucent: bi_db_open() returned error %d\n", rc, 0, 0);
792 ** translucent_db_close()
793 ** if the captive backend has a close() method, call it;
794 ** free any config data;
799 translucent_db_close( BackendDB *be, ConfigReply *cr )
801 slap_overinst *on = (slap_overinst *) be->bd_info;
802 translucent_info *ov = on->on_bi.bi_private;
805 Debug(LDAP_DEBUG_TRACE, "==> translucent_db_close\n", 0, 0, 0);
807 if ( ov && ov->db.bd_info && ov->db.bd_info->bi_db_close ) {
808 rc = ov->db.bd_info->bi_db_close(&ov->db, NULL);
815 ** translucent_db_destroy()
816 ** if the captive backend has a db_destroy() method, call it
821 translucent_db_destroy( BackendDB *be, ConfigReply *cr )
823 slap_overinst *on = (slap_overinst *) be->bd_info;
824 translucent_info *ov = on->on_bi.bi_private;
827 Debug(LDAP_DEBUG_TRACE, "==> translucent_db_destroy\n", 0, 0, 0);
830 if ( ov->db.be_private != NULL ) {
831 backend_stopdown_one( &ov->db );
835 on->on_bi.bi_private = NULL;
842 ** translucent_initialize()
843 ** initialize the slap_overinst with our entry points;
847 int translucent_initialize() {
851 Debug(LDAP_DEBUG_TRACE, "==> translucent_initialize\n", 0, 0, 0);
853 translucent.on_bi.bi_type = "translucent";
854 translucent.on_bi.bi_db_init = translucent_db_init;
855 translucent.on_bi.bi_db_config = translucent_db_config;
856 translucent.on_bi.bi_db_open = translucent_db_open;
857 translucent.on_bi.bi_db_close = translucent_db_close;
858 translucent.on_bi.bi_db_destroy = translucent_db_destroy;
859 translucent.on_bi.bi_op_bind = translucent_bind;
860 translucent.on_bi.bi_op_add = translucent_add;
861 translucent.on_bi.bi_op_modify = translucent_modify;
862 translucent.on_bi.bi_op_modrdn = translucent_modrdn;
863 translucent.on_bi.bi_op_delete = translucent_delete;
864 translucent.on_bi.bi_op_search = translucent_search;
865 translucent.on_bi.bi_op_compare = translucent_compare;
866 translucent.on_bi.bi_connection_destroy = translucent_connection_destroy;
868 translucent.on_bi.bi_cf_ocs = translucentocs;
869 rc = config_register_schema ( translucentcfg, translucentocs );
872 return(overlay_register(&translucent));
875 #if SLAPD_OVER_TRANSLUCENT == SLAPD_MOD_DYNAMIC && defined(PIC)
876 int init_module(int argc, char *argv[]) {
877 return translucent_initialize();
881 #endif /* SLAPD_OVER_TRANSLUCENT */