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 = sprintf( ca->cr_msg, "olcDatabase=%s",
128 ov->db.bd_info->bi_type );
129 bv.bv_val = ca->cr_msg;
131 ov->defer_db_open = 0;
133 /* We can only create this entry if the database is table-driven
135 if ( ov->db.bd_info->bi_cf_ocs )
136 config_build_entry( op, rs, cei, ca, &bv,
137 ov->db.bd_info->bi_cf_ocs,
138 &translucentocs[1] );
143 static slap_overinst translucent;
147 ** call syncrepl_add_glue() with the parent suffix;
151 static struct berval glue[] = { BER_BVC("top"), BER_BVC("glue"), BER_BVNULL };
153 void glue_parent(Operation *op) {
155 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
156 struct berval ndn = BER_BVNULL;
161 dnParent( &op->o_req_ndn, &pdn );
162 ber_dupbv_x( &ndn, &pdn, op->o_tmpmemctx );
164 Debug(LDAP_DEBUG_TRACE, "=> glue_parent: fabricating glue for <%s>\n", ndn.bv_val, 0, 0);
168 ber_dupbv(&e->e_name, &ndn);
169 ber_dupbv(&e->e_nname, &ndn);
171 a = attr_alloc( slap_schema.si_ad_objectClass );
173 a->a_vals = ch_malloc(sizeof(struct berval) * 3);
174 ber_dupbv(&a->a_vals[0], &glue[0]);
175 ber_dupbv(&a->a_vals[1], &glue[1]);
176 ber_dupbv(&a->a_vals[2], &glue[2]);
177 a->a_nvals = a->a_vals;
178 a->a_next = e->e_attrs;
181 a = attr_alloc( slap_schema.si_ad_structuralObjectClass );
183 a->a_vals = ch_malloc(sizeof(struct berval) * 2);
184 ber_dupbv(&a->a_vals[0], &glue[1]);
185 ber_dupbv(&a->a_vals[1], &glue[2]);
186 a->a_nvals = a->a_vals;
187 a->a_next = e->e_attrs;
194 nop.o_bd->bd_info = (BackendInfo *) on->on_info->oi_orig;
195 syncrepl_add_glue(&nop, e);
196 nop.o_bd->bd_info = (BackendInfo *) on;
198 op->o_tmpfree( ndn.bv_val, op->o_tmpmemctx );
208 BerVarray dup_bervarray(BerVarray b) {
211 for(len = 0; b[len].bv_val; len++);
212 nb = ch_malloc((len+1) * sizeof(BerValue));
213 for(i = 0; i < len; i++) ber_dupbv(&nb[i], &b[i]);
214 nb[len].bv_val = NULL;
221 ** free only the Attribute*, not the contents;
224 void free_attr_chain(Attribute *b) {
226 for(a=b; a; a=a->a_next) {
236 ** if not bound as root, send ACCESS error;
237 ** if glue, glue_parent();
242 static int translucent_add(Operation *op, SlapReply *rs) {
243 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
244 translucent_info *ov = on->on_bi.bi_private;
245 Debug(LDAP_DEBUG_TRACE, "==> translucent_add: %s\n",
246 op->o_req_dn.bv_val, 0, 0);
248 op->o_bd->bd_info = (BackendInfo *) on->on_info;
249 send_ldap_error(op, rs, LDAP_INSUFFICIENT_ACCESS,
250 "user modification of overlay database not permitted");
251 op->o_bd->bd_info = (BackendInfo *) on;
254 if(!ov->no_glue) glue_parent(op);
255 return(SLAP_CB_CONTINUE);
259 ** translucent_modrdn()
260 ** if not bound as root, send ACCESS error;
261 ** if !glue, glue_parent();
262 ** else return CONTINUE;
266 static int translucent_modrdn(Operation *op, SlapReply *rs) {
267 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
268 translucent_info *ov = on->on_bi.bi_private;
269 Debug(LDAP_DEBUG_TRACE, "==> translucent_modrdn: %s -> %s\n",
270 op->o_req_dn.bv_val, op->orr_newrdn.bv_val, 0);
272 op->o_bd->bd_info = (BackendInfo *) on->on_info;
273 send_ldap_error(op, rs, LDAP_INSUFFICIENT_ACCESS,
274 "user modification of overlay database not permitted");
275 op->o_bd->bd_info = (BackendInfo *) on;
278 if(!ov->no_glue) glue_parent(op);
279 return(SLAP_CB_CONTINUE);
283 ** translucent_delete()
284 ** if not bound as root, send ACCESS error;
285 ** else return CONTINUE;
289 static int translucent_delete(Operation *op, SlapReply *rs) {
290 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
291 Debug(LDAP_DEBUG_TRACE, "==> translucent_delete: %s\n",
292 op->o_req_dn.bv_val, 0, 0);
294 op->o_bd->bd_info = (BackendInfo *) on->on_info;
295 send_ldap_error(op, rs, LDAP_INSUFFICIENT_ACCESS,
296 "user modification of overlay database not permitted");
297 op->o_bd->bd_info = (BackendInfo *) on;
300 return(SLAP_CB_CONTINUE);
304 translucent_tag_cb( Operation *op, SlapReply *rs )
306 op->o_tag = LDAP_REQ_MODIFY;
307 op->orm_modlist = op->o_callback->sc_private;
308 rs->sr_tag = slap_req2res( op->o_tag );
310 return SLAP_CB_CONTINUE;
314 ** translucent_modify()
315 ** modify in local backend if exists in both;
316 ** otherwise, add to local backend;
317 ** fail if not defined in captive backend;
321 static int translucent_modify(Operation *op, SlapReply *rs) {
322 SlapReply nrs = { REP_RESULT };
325 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
326 translucent_info *ov = on->on_bi.bi_private;
327 Entry *e = NULL, *re = NULL;
329 Modifications *m, **mm;
330 int del, rc, erc = 0;
331 slap_callback cb = { 0 };
333 Debug(LDAP_DEBUG_TRACE, "==> translucent_modify: %s\n",
334 op->o_req_dn.bv_val, 0, 0);
336 if(ov->defer_db_open) {
337 send_ldap_error(op, rs, LDAP_UNAVAILABLE,
338 "remote DB not available");
342 ** fetch entry from the captive backend;
343 ** if it did not exist, fail;
344 ** release it, if captive backend supports this;
349 rc = ov->db.bd_info->bi_entry_get_rw(&nop, &nop.o_req_ndn, NULL, NULL, 0, &re);
350 if(rc != LDAP_SUCCESS || re == NULL ) {
351 send_ldap_error((&nop), rs, LDAP_NO_SUCH_OBJECT,
352 "attempt to modify nonexistent local record");
357 ** fetch entry from local backend;
359 ** foreach Modification:
360 ** if attr not present in local:
361 ** if Mod == LDAP_MOD_DELETE:
362 ** if remote attr not present, return NO_SUCH;
363 ** if remote attr present, drop this Mod;
364 ** else force this Mod to LDAP_MOD_ADD;
369 op->o_bd->bd_info = (BackendInfo *) on->on_info;
370 rc = be_entry_get_rw(op, &op->o_req_ndn, NULL, NULL, 0, &e);
371 op->o_bd->bd_info = (BackendInfo *) on;
373 if(e && rc == LDAP_SUCCESS) {
374 Debug(LDAP_DEBUG_TRACE, "=> translucent_modify: found local entry\n", 0, 0, 0);
375 for(mm = &op->orm_modlist; *mm; ) {
377 for(a = e->e_attrs; a; a = a->a_next)
378 if(a->a_desc == m->sml_desc) break;
381 continue; /* found local attr */
383 if(m->sml_op == LDAP_MOD_DELETE) {
384 for(a = re->e_attrs; a; a = a->a_next)
385 if(a->a_desc == m->sml_desc) break;
386 /* not found remote attr */
388 erc = LDAP_NO_SUCH_ATTRIBUTE;
392 erc = LDAP_CONSTRAINT_VIOLATION;
395 Debug(LDAP_DEBUG_TRACE,
396 "=> translucent_modify: silently dropping delete: %s\n",
397 m->sml_desc->ad_cname.bv_val, 0, 0);
400 slap_mods_free(m, 1);
403 m->sml_op = LDAP_MOD_ADD;
406 erc = SLAP_CB_CONTINUE;
409 if(ov->db.bd_info->bi_entry_release_rw)
410 ov->db.bd_info->bi_entry_release_rw(&nop, re, 0);
414 op->o_bd->bd_info = (BackendInfo *) on->on_info;
415 be_entry_release_r(op, e);
416 op->o_bd->bd_info = (BackendInfo *) on;
417 if(erc == SLAP_CB_CONTINUE) {
420 send_ldap_error(op, rs, erc,
421 "attempt to delete nonexistent attribute");
426 /* don't leak remote entry copy */
428 if(ov->db.bd_info->bi_entry_release_rw)
429 ov->db.bd_info->bi_entry_release_rw(&nop, re, 0);
434 ** foreach Modification:
435 ** if MOD_ADD or MOD_REPLACE, add Attribute;
436 ** if no Modifications were suitable:
437 ** if strict, throw CONSTRAINT_VIOLATION;
438 ** else, return early SUCCESS;
439 ** fabricate Entry with new Attribute chain;
440 ** glue_parent() for this Entry;
441 ** call bi_op_add() in local backend;
445 Debug(LDAP_DEBUG_TRACE, "=> translucent_modify: fabricating local add\n", 0, 0, 0);
447 for(del = 0, ax = NULL, m = op->orm_modlist; m; m = m->sml_next) {
449 if(((m->sml_op & LDAP_MOD_OP) != LDAP_MOD_ADD) &&
450 ((m->sml_op & LDAP_MOD_OP) != LDAP_MOD_REPLACE)) {
451 Debug(LDAP_DEBUG_ANY,
452 "=> translucent_modify: silently dropped modification(%d): %s\n",
453 m->sml_op, m->sml_desc->ad_cname.bv_val, 0);
454 if((m->sml_op & LDAP_MOD_OP) == LDAP_MOD_DELETE) del++;
457 atmp.a_desc = m->sml_desc;
458 atmp.a_vals = m->sml_values;
459 atmp.a_nvals = m->sml_nvalues ? m->sml_nvalues : atmp.a_vals;
460 atmp.a_numvals = m->sml_numvals;
462 a = attr_dup( &atmp );
467 if(del && ov->strict) {
469 send_ldap_error(op, rs, LDAP_CONSTRAINT_VIOLATION,
470 "attempt to delete attributes from local database");
476 send_ldap_error(op, rs, LDAP_CONSTRAINT_VIOLATION,
477 "modification contained other than ADD or REPLACE");
480 /* rs->sr_text = "no valid modification found"; */
481 rs->sr_err = LDAP_SUCCESS;
482 send_ldap_result(op, rs);
487 ber_dupbv( &e->e_name, &op->o_req_dn );
488 ber_dupbv( &e->e_nname, &op->o_req_ndn );
491 nop.o_tag = LDAP_REQ_ADD;
496 cb.sc_response = translucent_tag_cb;
497 cb.sc_private = op->orm_modlist;
498 cb.sc_next = nop.o_callback;
499 nop.o_callback = &cb;
500 rc = on->on_info->oi_orig->bi_op_add(&nop, &nrs);
501 if ( nop.ora_e == e )
507 static int translucent_compare(Operation *op, SlapReply *rs) {
509 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
510 translucent_info *ov = on->on_bi.bi_private;
511 AttributeAssertion *ava = op->orc_ava;
515 Debug(LDAP_DEBUG_TRACE, "==> translucent_compare: <%s> %s:%s\n",
516 op->o_req_dn.bv_val, ava->aa_desc->ad_cname.bv_val, ava->aa_value.bv_val);
519 ** if the local backend has an entry for this attribute:
520 ** CONTINUE and let it do the compare;
523 op->o_bd->bd_info = (BackendInfo *) on->on_info;
524 rc = be_entry_get_rw(op, &op->o_req_ndn, NULL, ava->aa_desc, 0, &e);
525 if(e && rc == LDAP_SUCCESS) {
526 be_entry_release_r(op, e);
527 op->o_bd->bd_info = (BackendInfo *) on;
528 return(SLAP_CB_CONTINUE);
530 op->o_bd->bd_info = (BackendInfo *) on;
532 if(ov->defer_db_open) {
533 send_ldap_error(op, rs, LDAP_UNAVAILABLE,
534 "remote DB not available");
538 ** call compare() in the captive backend;
539 ** return the result;
543 nop.o_callback = NULL;
544 rc = ov->db.bd_info->bi_op_compare(&nop, rs);
550 ** translucent_search_cb()
551 ** merge local data with the search result
555 static int translucent_search_cb(Operation *op, SlapReply *rs) {
557 Entry *e, *re = NULL;
558 Attribute *a, *ax, *an, *as = NULL;
559 Operation * original_op, local_op;
562 if(!op || !rs || rs->sr_type != REP_SEARCH || !rs->sr_entry)
563 return(SLAP_CB_CONTINUE);
565 Debug(LDAP_DEBUG_TRACE, "==> translucent_search_cb: %s\n",
566 rs->sr_entry->e_name.bv_val, 0, 0);
568 original_op = op->o_callback->sc_private;
569 on = (slap_overinst *) original_op->o_bd->bd_info;
570 local_op = *original_op;
572 local_op.o_bd->bd_info = (BackendInfo *) on->on_info->oi_orig;
573 rc = be_entry_get_rw(&local_op, &rs->sr_entry->e_nname, NULL, NULL, 0, &e);
574 local_op.o_bd->bd_info = (BackendInfo *) on;
577 ** if we got an entry from local backend:
578 ** make a copy of this search result;
579 ** foreach local attr:
580 ** foreach search result attr:
581 ** if match, result attr with local attr;
582 ** if new local, add to list;
583 ** append new local attrs to search result;
587 if(e && rc == LDAP_SUCCESS) {
588 re = entry_dup(rs->sr_entry);
589 for(ax = e->e_attrs; ax; ax = ax->a_next) {
591 if(is_at_operational(ax->a_desc->ad_type)) continue;
593 for(a = re->e_attrs; a; a = a->a_next) {
594 if(a->a_desc == ax->a_desc) {
595 if(a->a_vals != a->a_nvals)
596 ber_bvarray_free(a->a_nvals);
597 ber_bvarray_free(a->a_vals);
598 a->a_vals = dup_bervarray(ax->a_vals);
599 a->a_nvals = (ax->a_vals == ax->a_nvals) ?
600 a->a_vals : dup_bervarray(ax->a_nvals);
609 local_op.o_bd->bd_info = (BackendInfo *) on->on_info->oi_orig;
610 be_entry_release_r(&local_op, e);
611 local_op.o_bd->bd_info = (BackendInfo *) on;
613 /* literally append, so locals are always last */
616 for(ax = re->e_attrs; ax->a_next; ax = ax->a_next);
623 rs->sr_flags |= REP_ENTRY_MUSTBEFREED;
626 return(SLAP_CB_CONTINUE);
630 ** translucent_search()
631 ** search via captive backend;
632 ** override results with any local data;
636 static int translucent_search(Operation *op, SlapReply *rs) {
637 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
639 translucent_info *ov = on->on_bi.bi_private;
640 slap_callback cb = { NULL, NULL, NULL, NULL };
642 Debug(LDAP_DEBUG_TRACE, "==> translucent_search: <%s> %s\n",
643 op->o_req_dn.bv_val, op->ors_filterstr.bv_val, 0);
645 if(ov->defer_db_open) {
646 send_ldap_error(op, rs, LDAP_UNAVAILABLE,
647 "remote DB not available");
650 cb.sc_response = (slap_response *) translucent_search_cb;
652 cb.sc_next = nop.o_callback;
654 nop.o_callback = &cb;
656 return (ov->db.bd_info->bi_op_search(&nop, rs));
661 ** translucent_bind()
662 ** pass bind request to captive backend;
666 static int translucent_bind(Operation *op, SlapReply *rs) {
667 slap_overinst *on = (slap_overinst *) op->o_bd->bd_info;
669 translucent_info *ov = on->on_bi.bi_private;
671 Debug(LDAP_DEBUG_TRACE, "translucent_bind: <%s> method %d\n",
672 op->o_req_dn.bv_val, op->orb_method, 0);
674 if(ov->defer_db_open) {
675 send_ldap_error(op, rs, LDAP_UNAVAILABLE,
676 "remote DB not available");
680 return (ov->db.bd_info->bi_op_bind(&nop, rs));
684 ** translucent_connection_destroy()
685 ** pass disconnect notification to captive backend;
689 static int translucent_connection_destroy(BackendDB *be, Connection *conn) {
690 slap_overinst *on = (slap_overinst *) be->bd_info;
691 translucent_info *ov = on->on_bi.bi_private;
694 Debug(LDAP_DEBUG_TRACE, "translucent_connection_destroy\n", 0, 0, 0);
696 rc = ov->db.bd_info->bi_connection_destroy(&ov->db, conn);
702 ** translucent_db_config()
703 ** pass config directives to captive backend;
704 ** parse unrecognized directives ourselves;
708 static int translucent_db_config(
716 slap_overinst *on = (slap_overinst *) be->bd_info;
717 translucent_info *ov = on->on_bi.bi_private;
719 Debug(LDAP_DEBUG_TRACE, "==> translucent_db_config: %s\n",
720 argc ? argv[0] : "", 0, 0);
722 /* Something for the captive database? */
723 if ( ov->db.bd_info && ov->db.bd_info->bi_db_config )
724 return ov->db.bd_info->bi_db_config( &ov->db, fname, lineno,
726 return SLAP_CONF_UNKNOWN;
730 ** translucent_db_init()
731 ** initialize the captive backend;
735 static int translucent_db_init(BackendDB *be, ConfigReply *cr) {
736 slap_overinst *on = (slap_overinst *) be->bd_info;
737 translucent_info *ov;
739 Debug(LDAP_DEBUG_TRACE, "==> translucent_db_init\n", 0, 0, 0);
741 ov = ch_calloc(1, sizeof(translucent_info));
742 on->on_bi.bi_private = ov;
744 ov->db.be_private = NULL;
745 ov->db.be_pcl_mutexp = &ov->db.be_pcl_mutex;
746 ov->defer_db_open = 1;
748 if ( !backend_db_init( "ldap", &ov->db, -1, NULL )) {
749 Debug( LDAP_DEBUG_CONFIG, "translucent: unable to open captive back-ldap\n", 0, 0, 0);
752 SLAP_DBFLAGS(be) |= SLAP_DBFLAG_NO_SCHEMA_CHECK;
753 SLAP_DBFLAGS(be) |= SLAP_DBFLAG_NOLASTMOD;
759 ** translucent_db_open()
760 ** if the captive backend has an open() method, call it;
764 static int translucent_db_open(BackendDB *be, ConfigReply *cr) {
765 slap_overinst *on = (slap_overinst *) be->bd_info;
766 translucent_info *ov = on->on_bi.bi_private;
769 Debug(LDAP_DEBUG_TRACE, "==> translucent_db_open\n", 0, 0, 0);
771 /* need to inherit something from the original database... */
772 ov->db.be_def_limit = be->be_def_limit;
773 ov->db.be_limits = be->be_limits;
774 ov->db.be_acl = be->be_acl;
775 ov->db.be_dfltaccess = be->be_dfltaccess;
777 if ( ov->defer_db_open )
780 rc = backend_startup_one( &ov->db, NULL );
782 if(rc) Debug(LDAP_DEBUG_TRACE,
783 "translucent: bi_db_open() returned error %d\n", rc, 0, 0);
789 ** translucent_db_close()
790 ** if the captive backend has a close() method, call it;
791 ** free any config data;
796 translucent_db_close( BackendDB *be, ConfigReply *cr )
798 slap_overinst *on = (slap_overinst *) be->bd_info;
799 translucent_info *ov = on->on_bi.bi_private;
802 Debug(LDAP_DEBUG_TRACE, "==> translucent_db_close\n", 0, 0, 0);
804 if ( ov && ov->db.bd_info && ov->db.bd_info->bi_db_close ) {
805 rc = ov->db.bd_info->bi_db_close(&ov->db, NULL);
812 ** translucent_db_destroy()
813 ** if the captive backend has a db_destroy() method, call it
818 translucent_db_destroy( BackendDB *be, ConfigReply *cr )
820 slap_overinst *on = (slap_overinst *) be->bd_info;
821 translucent_info *ov = on->on_bi.bi_private;
824 Debug(LDAP_DEBUG_TRACE, "==> translucent_db_destroy\n", 0, 0, 0);
827 if ( ov->db.be_private != NULL ) {
828 backend_stopdown_one( &ov->db );
832 on->on_bi.bi_private = NULL;
839 ** translucent_initialize()
840 ** initialize the slap_overinst with our entry points;
844 int translucent_initialize() {
848 Debug(LDAP_DEBUG_TRACE, "==> translucent_initialize\n", 0, 0, 0);
850 translucent.on_bi.bi_type = "translucent";
851 translucent.on_bi.bi_db_init = translucent_db_init;
852 translucent.on_bi.bi_db_config = translucent_db_config;
853 translucent.on_bi.bi_db_open = translucent_db_open;
854 translucent.on_bi.bi_db_close = translucent_db_close;
855 translucent.on_bi.bi_db_destroy = translucent_db_destroy;
856 translucent.on_bi.bi_op_bind = translucent_bind;
857 translucent.on_bi.bi_op_add = translucent_add;
858 translucent.on_bi.bi_op_modify = translucent_modify;
859 translucent.on_bi.bi_op_modrdn = translucent_modrdn;
860 translucent.on_bi.bi_op_delete = translucent_delete;
861 translucent.on_bi.bi_op_search = translucent_search;
862 translucent.on_bi.bi_op_compare = translucent_compare;
863 translucent.on_bi.bi_connection_destroy = translucent_connection_destroy;
865 translucent.on_bi.bi_cf_ocs = translucentocs;
866 rc = config_register_schema ( translucentcfg, translucentocs );
869 return(overlay_register(&translucent));
872 #if SLAPD_OVER_TRANSLUCENT == SLAPD_MOD_DYNAMIC && defined(PIC)
873 int init_module(int argc, char *argv[]) {
874 return translucent_initialize();
878 #endif /* SLAPD_OVER_TRANSLUCENT */