1 /* syncprov.c - syncrepl provider */
2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 2004 The OpenLDAP Foundation.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted only as authorized by the OpenLDAP
11 * A copy of this license is available in the file LICENSE in the
12 * top-level directory of the distribution or, alternatively, at
13 * <http://www.OpenLDAP.org/license.html>.
16 * This work was initially developed by Howard Chu for inclusion in
22 #define SLAPD_OVER_SYNCPROV SLAPD_MOD_DYNAMIC
24 #ifdef SLAPD_OVER_SYNCPROV
26 #include <ac/string.h>
30 /* Record of a persistent search */
31 typedef struct syncops {
32 struct syncops *s_next;
33 struct berval s_base; /* ndn of search base */
34 ID s_eid; /* entryID of search base */
35 Operation *s_op; /* search op */
36 int s_flags; /* search status */
39 #define PS_IS_REFRESHING 0x01
41 /* Record of which searches matched at premodify step */
42 typedef struct syncmatches {
43 struct syncmatches *sm_next;
47 typedef struct syncprov_info_t {
49 struct berval si_ctxcsn; /* ldapsync context */
50 int si_gotcsn; /* is our ctxcsn up to date? */
51 ldap_pvt_thread_mutex_t si_csn_mutex;
52 ldap_pvt_thread_mutex_t si_ops_mutex;
55 typedef struct opcookie {
57 syncmatches *smatches;
61 typedef struct findcookie {
68 static AttributeName csn_anlist[2];
69 static AttributeName uuid_anlist[2];
72 dn_avl_cmp( const void *c1, const void *c2 )
74 struct berval *bv1 = (struct berval *)c1;
75 struct berval *bv2 = (struct berval *)c2;
76 int rc = bv1->bv_len - bv2->bv_len;
79 return ber_bvcmp( bv1, bv2 );
83 findbase_cb( Operation *op, SlapReply *rs )
85 slap_callback *sc = op->o_callback;
87 if ( rs->sr_type == REP_SEARCH && rs->sr_err == LDAP_SUCCESS ) {
88 findcookie *fc = sc->sc_private;
89 if ( rs->sr_entry->e_id == fc->fss->s_eid &&
90 dn_match( &rs->sr_entry->e_nname, &fc->fss->s_base )) {
92 fc->fsuffix = dnIsSuffix( fc->fdn, &rs->sr_entry->e_nname );
99 syncprov_findbase( Operation *op, syncops *ss, findcookie *fc )
101 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
102 syncprov_info_t *si = on->on_bi.bi_private;
104 slap_callback cb = {0};
106 SlapReply frs = { REP_RESULT };
111 cb.sc_response = findbase_cb;
114 fop.o_callback = &cb;
115 fop.o_tag = LDAP_REQ_SEARCH;
116 fop.ors_scope = LDAP_SCOPE_BASE;
117 fop.ors_deref = ss->s_op->ors_deref;
119 fop.ors_tlimit = SLAP_NO_LIMIT;
120 fop.ors_attrs = slap_anlist_no_attrs;
121 fop.ors_attrsonly = 1;
122 fop.ors_filter = ss->s_op->ors_filter;
123 fop.ors_filterstr = ss->s_op->ors_filterstr;
125 fop.o_req_ndn = ss->s_op->o_req_ndn;
127 rc = fop.o_bd->be_search( &fop, &frs );
129 if ( fc->fbase ) return LDAP_SUCCESS;
131 /* If entryID has changed, then the base of this search has
132 * changed. Invalidate the psearch.
134 return LDAP_NO_SUCH_OBJECT;
138 #define FIND_PRESENT 2
140 typedef struct fcsn_cookie {
141 struct berval maxcsn;
146 findcsn_cb( Operation *op, SlapReply *rs )
148 slap_callback *sc = op->o_callback;
150 if ( rs->sr_type == REP_SEARCH && rs->sr_err == LDAP_SUCCESS ) {
151 if ( sc->sc_private ) {
153 fcsn_cookie *fc = sc->sc_private;
154 Attribute *a = attr_find(rs->sr_entry->e_attrs,
155 slap_schema.si_ad_entryCSN );
156 i = ber_bvcmp( &a->a_vals[0], op->o_sync_state.ctxcsn );
157 if ( i == 0 ) fc->gotmatch = 1;
158 i = ber_bvcmp( &a->a_vals[0], &fc->maxcsn );
160 fc->maxcsn.bv_len = a->a_vals[0].bv_len;
161 strcpy(fc->maxcsn.bv_val, a->a_vals[0].bv_val );
164 sc->sc_private = (void *)1;
170 typedef struct fpres_cookie {
176 findpres_cb( Operation *op, SlapReply *rs )
178 slap_callback *sc = op->o_callback;
179 fpres_cookie *pc = sc->sc_private;
182 if ( rs->sr_type == REP_SEARCH ) {
183 ret = slap_sync_build_syncUUID_set( op, &pc->uuids, rs->sr_entry );
186 if ( pc->num == SLAP_SYNCUUID_SET_SIZE ) {
187 ret = slap_send_syncinfo( op, rs, LDAP_TAG_SYNC_ID_SET, NULL,
189 ber_bvarray_free_x( pc->uuids, op->o_tmpmemctx );
196 } else if ( rs->sr_type == REP_RESULT ) {
199 ret = slap_send_syncinfo( op, rs, LDAP_TAG_SYNC_ID_SET, NULL,
201 ber_bvarray_free_x( pc->uuids, op->o_tmpmemctx );
211 syncprov_findcsn( Operation *op, int mode )
213 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
214 syncprov_info_t *si = on->on_bi.bi_private;
216 slap_callback cb = {0};
218 SlapReply frs = { REP_RESULT };
219 char buf[LDAP_LUTIL_CSNSTR_BUFSIZE + STRLENOF("(entryCSN<=)")];
220 char cbuf[LDAP_LUTIL_CSNSTR_BUFSIZE];
223 AttributeAssertion eq;
226 fpres_cookie pcookie;
229 if ( op->o_sync_state.ctxcsn->bv_len >= LDAP_LUTIL_CSNSTR_BUFSIZE ) {
237 if ( mode == FIND_CSN ) {
238 if ( !si->si_gotcsn ) {
239 /* If we don't know the current ctxcsn, find it */
240 ldap_pvt_thread_mutex_lock( &si->si_csn_mutex );
243 if ( !si->si_gotcsn ) {
244 cf.f_choice = LDAP_FILTER_GE;
245 fop.ors_attrsonly = 0;
246 fop.ors_attrs = csn_anlist;
247 fop.ors_slimit = SLAP_NO_LIMIT;
248 cb.sc_private = &fcookie;
249 fcookie.maxcsn.bv_val = cbuf;
250 fcookie.maxcsn.bv_len = 0;
251 fcookie.gotmatch = 0;
252 fbuf.bv_len = sprintf( buf, "(entryCSN>=%s)", op->o_sync_state.ctxcsn->bv_val );
255 ldap_pvt_thread_mutex_unlock( &si->si_csn_mutex );
258 cf.f_choice = LDAP_FILTER_EQUALITY;
259 fop.ors_attrsonly = 1;
260 fop.ors_attrs = slap_anlist_no_attrs;
262 cb.sc_private = NULL;
263 fbuf.bv_len = sprintf( buf, "(entryCSN=%s)", op->o_sync_state.ctxcsn->bv_val );
265 cb.sc_response = findcsn_cb;
267 } else if ( mode == FIND_PRESENT ) {
268 cf.f_choice = LDAP_FILTER_LE;
269 fop.ors_attrsonly = 0;
270 fop.ors_attrs = uuid_anlist;
271 fop.ors_slimit = SLAP_NO_LIMIT;
272 cb.sc_private = &fcookie;
273 cb.sc_response = findpres_cb;
275 pcookie.uuids = NULL;
276 fbuf.bv_len = sprintf( buf, "(entryCSN<=%s)", op->o_sync_state.ctxcsn->bv_val );
279 cf.f_av_desc = slap_schema.si_ad_entryCSN;
280 cf.f_av_value = *op->o_sync_state.ctxcsn;
283 fop.o_callback = &cb;
285 fop.ors_tlimit = SLAP_NO_LIMIT;
286 fop.ors_filter = &cf;
287 fop.ors_filterstr = fbuf;
289 fop.o_bd->bd_info = on->on_info->oi_orig;
290 rc = fop.o_bd->be_search( &fop, &frs );
292 if ( mode == FIND_CSN ) {
293 if ( !si->si_gotcsn ) {
294 ber_dupbv( &si->si_ctxcsn, &fcookie.maxcsn );
296 ldap_pvt_thread_mutex_unlock( &si->si_csn_mutex );
297 if ( fcookie.gotmatch ) return LDAP_SUCCESS;
300 if ( cb.sc_private ) return LDAP_SUCCESS;
302 } else if ( mode == FIND_PRESENT ) {
306 /* If matching CSN was not found, invalidate the context. */
307 return LDAP_NO_SUCH_OBJECT;
311 syncprov_matchops( Operation *op, opcookie *opc, int saveit )
313 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
314 syncprov_info_t *si = on->on_bi.bi_private;
322 fc.fdn = &op->o_req_ndn;
323 rc = be_entry_get_rw( op, fc.fdn, NULL, NULL, 0, &e );
327 a = attr_find( e->e_attrs, slap_schema.si_ad_entryUUID );
329 ber_dupbv_x( &opc->suuid, &a->a_vals[0], op->o_tmpmemctx );
332 ldap_pvt_thread_mutex_lock( &si->si_ops_mutex );
333 for (ss = si->si_ops; ss; ss=ss->s_next)
342 rc = syncprov_findbase( op, ss, &fc );
343 if ( rc != LDAP_SUCCESS ) continue;
345 /* If we're sending results now, look for this op in old matches */
348 for ( sm=opc->smatches, old=(syncmatches *)&opc->smatches; sm;
349 old=sm, sm=sm->sm_next ) {
350 if ( sm->sm_op == ss ) {
352 old->sm_next = sm->sm_next;
353 op->o_tmpfree( sm, op->o_tmpmemctx );
359 /* check if current o_req_dn is in scope and matches filter */
360 if ( fc.fsuffix && test_filter( op, e, ss->s_op->ors_filter ) ==
361 LDAP_COMPARE_TRUE ) {
363 sm = op->o_tmpalloc( sizeof(syncmatches), op->o_tmpmemctx );
364 sm->sm_next = opc->smatches;
368 /* if found send UPDATE else send ADD */
373 } else if ( !saveit && found ) {
377 ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex );
378 be_entry_release_r( op, e );
382 syncprov_op_response( Operation *op, SlapReply *rs )
384 slap_callback *cb = op->o_callback;
385 opcookie *opc = (opcookie *)(cb+1);
386 slap_overinst *on = opc->son;
387 syncprov_info_t *si = on->on_bi.bi_private;
388 syncmatches *sm, *snext;
390 if ( rs->sr_err == LDAP_SUCCESS )
392 struct berval maxcsn;
393 void *memctx = op->o_tmpmemctx;
395 ldap_pvt_thread_mutex_lock( &si->si_csn_mutex );
396 op->o_tmpmemctx = NULL;
397 slap_get_commit_csn( op, &maxcsn );
398 op->o_tmpmemctx = memctx;
399 if ( maxcsn.bv_val ) {
400 free( si->si_ctxcsn.bv_val );
401 si->si_ctxcsn = maxcsn;
404 ldap_pvt_thread_mutex_unlock( &si->si_csn_mutex );
408 case LDAP_REQ_MODIFY:
409 case LDAP_REQ_MODRDN:
410 case LDAP_REQ_EXTENDED:
411 syncprov_matchops( op, opc, 0 );
413 case LDAP_REQ_DELETE:
414 /* for each match in opc->smatches:
417 for ( sm = opc->smatches; sm; sm=sm->sm_next ) {
423 for (sm = opc->smatches; sm; sm=snext) {
425 op->o_tmpfree( sm, op->o_tmpmemctx );
427 op->o_callback = cb->sc_next;
428 op->o_tmpfree(cb, op->o_tmpmemctx);
429 return SLAP_CB_CONTINUE;
434 syncprov_op_compare( Operation *op, SlapReply *rs )
436 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
437 syncprov_info_t *si = on->on_bi.bi_private;
438 int rc = SLAP_CB_CONTINUE;
440 if ( dn_match( &op->o_req_ndn, &si->si_e->e_nname ) )
444 ldap_pvt_thread_mutex_lock( &si->si_e_mutex );
446 if ( get_assert( op ) &&
447 ( test_filter( op, si->si_e, get_assertion( op ) ) != LDAP_COMPARE_TRUE ) )
449 rs->sr_err = LDAP_ASSERTION_FAILED;
453 rs->sr_err = access_allowed( op, si->si_e, op->oq_compare.rs_ava->aa_desc,
454 &op->oq_compare.rs_ava->aa_value, ACL_COMPARE, NULL );
455 if ( ! rs->sr_err ) {
456 rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
460 rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
462 for ( a = attr_find( si->si_e->e_attrs, op->oq_compare.rs_ava->aa_desc );
464 a = attr_find( a->a_next, op->oq_compare.rs_ava->aa_desc ) )
466 rs->sr_err = LDAP_COMPARE_FALSE;
468 if ( value_find_ex( op->oq_compare.rs_ava->aa_desc,
469 SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
470 SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
471 a->a_nvals, &op->oq_compare.rs_ava->aa_value, op->o_tmpmemctx ) == 0 )
473 rs->sr_err = LDAP_COMPARE_TRUE;
480 ldap_pvt_thread_mutex_unlock( &si->si_e_mutex );
482 send_ldap_result( op, rs );
484 if( rs->sr_err == LDAP_COMPARE_FALSE || rs->sr_err == LDAP_COMPARE_TRUE ) {
485 rs->sr_err = LDAP_SUCCESS;
490 return SLAP_CB_CONTINUE;
495 syncprov_op_mod( Operation *op, SlapReply *rs )
497 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
498 syncprov_info_t *si = on->on_bi.bi_private;
502 slap_callback *cb = op->o_tmpcalloc(1, sizeof(slap_callback)+sizeof(opcookie), op->o_tmpmemctx);
503 opcookie *opc = (opcookie *)(cb+1);
505 cb->sc_response = syncprov_op_response;
506 cb->sc_private = opc;
507 cb->sc_next = op->o_callback;
510 if ( op->o_tag != LDAP_REQ_ADD )
511 syncprov_matchops( op, opc, 1 );
514 return SLAP_CB_CONTINUE;
518 syncprov_op_extended( Operation *op, SlapReply *rs )
520 if ( exop_is_write( op ))
521 return syncprov_op_mod( op, rs );
523 return SLAP_CB_CONTINUE;
527 syncprov_search_cleanup( Operation *op, SlapReply *rs )
529 if ( rs->sr_ctrls ) {
530 free( rs->sr_ctrls[0] );
531 op->o_tmpfree( rs->sr_ctrls, op->o_tmpmemctx );
537 syncprov_search_response( Operation *op, SlapReply *rs )
539 slap_callback *cb = op->o_callback;
540 slap_overinst *on = cb->sc_private;
541 syncprov_info_t *si = on->on_bi.bi_private;
543 if ( rs->sr_type == REP_SEARCH ) {
545 if ( op->o_sync_state.ctxcsn ) {
546 Attribute *a = attr_find( rs->sr_entry->e_attrs,
547 slap_schema.si_ad_entryCSN );
548 /* Don't send the ctx entry twice */
549 if ( bvmatch( &a->a_nvals[0], op->o_sync_state.ctxcsn ))
552 rs->sr_ctrls = op->o_tmpalloc( sizeof(LDAPControl *)*2,
554 rs->sr_ctrls[1] = NULL;
555 rs->sr_err = slap_build_sync_state_ctrl( op, rs, rs->sr_entry,
556 LDAP_SYNC_ADD, rs->sr_ctrls, 0, 0, NULL );
557 } else if (rs->sr_type == REP_RESULT ) {
558 struct berval cookie;
559 rs->sr_ctrls = op->o_tmpalloc( sizeof(LDAPControl *)*2,
561 rs->sr_ctrls[1] = NULL;
562 slap_compose_sync_cookie( op, &cookie,
563 &op->ors_filter->f_and->f_ava->aa_value,
564 op->o_sync_state.sid, op->o_sync_state.rid );
565 rs->sr_err = slap_build_sync_done_ctrl( op, rs, rs->sr_ctrls,
566 0, 1, &cookie, LDAP_SYNC_REFRESH_PRESENTS );
569 return SLAP_CB_CONTINUE;
573 syncprov_op_search( Operation *op, SlapReply *rs )
575 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
576 syncprov_info_t *si = (syncprov_info_t *)on->on_bi.bi_private;
581 if ( !op->o_sync_mode ) return SLAP_CB_CONTINUE;
583 if ( op->ors_deref & LDAP_DEREF_SEARCHING ) {
584 send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR, "illegal value for derefAliases" );
588 /* If we have a cookie, handle the PRESENT lookups
590 if ( op->o_sync_state.ctxcsn ) {
591 /* Is the CSN in a valid format? */
592 if ( op->o_sync_state.ctxcsn->bv_len >= LDAP_LUTIL_CSNSTR_BUFSIZE ) {
593 send_ldap_error( op, rs, LDAP_OTHER, "invalid sync cookie" );
596 /* Is the CSN still present in the database? */
597 if ( syncprov_findcsn( op, FIND_CSN ) != LDAP_SUCCESS ) {
598 /* No, so a reload is required */
599 if ( op->o_sync_rhint == 0 ) {
600 send_ldap_error( op, rs, LDAP_SYNC_REFRESH_REQUIRED, "sync cookie is stale" );
604 /* Does it match the current ctxCSN? */
605 if ( bvmatch( op->o_sync_state.ctxcsn, &si->si_ctxcsn )) {
606 struct berval cookie;
607 LDAPControl *ctrls[2];
611 slap_compose_sync_cookie( op, &cookie, op->o_sync_state.ctxcsn,
612 op->o_sync_state.sid, op->o_sync_state.rid );
613 slap_build_sync_done_ctrl( op, rs, ctrls, 0, 1,
614 &cookie, LDAP_SYNC_REFRESH_DELETES );
615 rs->sr_err = LDAP_SUCCESS;
616 send_ldap_result( op, rs );
617 free( cookie.bv_val );
621 /* OK, let's send all the Present UUIDs */
622 if ( syncprov_findcsn( op, FIND_PRESENT ) != LDAP_SUCCESS ) {
623 send_ldap_result( op, rs );
629 if ( !gotstate && !si->si_gotcsn ) {
630 struct berval bv = BER_BVC("1"), *old;
632 old = op->o_sync_state.ctxcsn;
633 op->o_sync_state.ctxcsn = &bv;
634 syncprov_findcsn( op, FIND_CSN );
635 op->o_sync_state.ctxcsn = old;
638 /* Append CSN range to search filter */
639 op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
641 fand = op->o_tmpalloc( sizeof(Filter), op->o_tmpmemctx );
642 fand->f_choice = LDAP_FILTER_AND;
644 fava = op->o_tmpalloc( sizeof(Filter), op->o_tmpmemctx );
645 fava->f_choice = LDAP_FILTER_LE;
646 fava->f_ava = op->o_tmpalloc( sizeof(AttributeAssertion), op->o_tmpmemctx );
647 fava->f_ava->aa_desc = slap_schema.si_ad_entryCSN;
648 ber_dupbv_x( &fava->f_ava->aa_value, &si->si_ctxcsn, op->o_tmpmemctx );
651 fava->f_next = op->o_tmpalloc( sizeof(Filter), op->o_tmpmemctx );
653 fava->f_choice = LDAP_FILTER_GE;
654 fava->f_ava = op->o_tmpalloc( sizeof(AttributeAssertion), op->o_tmpmemctx );
655 fava->f_ava->aa_desc = slap_schema.si_ad_entryCSN;
656 ber_dupbv_x( &fava->f_ava->aa_value, op->o_sync_state.ctxcsn, op->o_tmpmemctx );
658 fava->f_next = op->ors_filter;
659 op->ors_filter = fand;
660 filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
662 /* Let our callback add needed info to returned entries */
663 cb = op->o_tmpcalloc(1, sizeof(slap_callback)+sizeof(opcookie), op->o_tmpmemctx);
664 cb->sc_response = syncprov_search_response;
665 cb->sc_cleanup = syncprov_search_cleanup;
667 cb->sc_next = op->o_callback;
670 return SLAP_CB_CONTINUE;
675 syncprov_response( Operation *op, SlapReply *rs )
677 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
678 syncprov_info_t *si = (syncprov_info_t *)on->on_bi.bi_private;
680 if ( rs->sr_err == LDAP_SUCCESS ) {
681 if ( op->o_tag == LDAP_REQ_SEARCH ) {
682 /* handle transition from refresh to persist */
683 if ( op->o_sync_mode == SLAP_SYNC_REFRESH_AND_PERSIST ) {
686 /* If we're checkpointing */
687 } else if ( si->si_chkops || si->si_chktime )) {
690 switch ( op->o_tag ) {
691 case LDAP_REQ_EXTENDED:
694 /* if not PASSWD_MODIFY, break */
695 for ( i=0; write_exop[i]; i++ )
697 if ( !ber_bvcmp( write_exop[i], &op->oq_extended.rs_reqoid ))
707 case LDAP_REQ_MODIFY:
708 case LDAP_REQ_MODRDN:
709 case LDAP_REQ_DELETE:
710 ldap_pvt_thread_mutex_lock( &si->si_chk_mutex );
714 if ( si->si_numops >= si->si_chkops )
720 if ( si->si_chktime )
722 if ( op->o_time - si->si_chklast >= si->si_chktime )
725 si->si_chklast = op->o_time;
728 ldap_pvt_thread_mutex_unlock( &si->si_chk_mutex );
731 /* write cn=ldapsync to underlying db */
737 /* Release this DN */
738 if ( op->o_tag == LDAP_REQ_MODIFY ) {
739 ldap_pvt_thread_mutex_lock( &si->si_mod_mutex );
740 avl_delete( &si->si_mods, &op->o_req_ndn, dn_avl_cmp );
741 ldap_pvt_thread_mutex_unlock( &si->si_mod_mutex );
743 return SLAP_CB_CONTINUE;
756 slap_overinst *on = (slap_overinst *)be->bd_info;
757 syncprov_info_t *si = (syncprov_info_t *)on->on_bi.bi_private;
760 if ( strcasecmp( argv[ 0 ], "syncprov-checkpoint" ) == 0 ) {
762 fprintf( stderr, "%s: line %d: wrong number of arguments in "
763 "\"syncprov-checkpoint <ops> <minutes>\"\n", fname, lineno );
766 si->si_chkops = atoi( argv[1] );
767 si->si_chktime = atoi( argv[2] ) * 60;
770 return SLAP_CONF_UNKNOWN;
774 return SLAP_CONF_UNKNOWN;
782 slap_overinst *on = (slap_overinst *)be->bd_info;
785 si = ch_calloc(1, sizeof(syncprov_info_t));
786 on->on_bi.bi_private = si;
787 ldap_pvt_thread_mutex_init( &si->si_csn_mutex );
788 ldap_pvt_thread_mutex_init( &si->si_ops_mutex );
790 csn_anlist[0].an_desc = slap_schema.si_ad_entryCSN;
791 csn_anlist[0].an_name = slap_schema.si_ad_entryCSN->ad_cname;
793 uuid_anlist[0].an_desc = slap_schema.si_ad_entryUUID;
794 uuid_anlist[0].an_name = slap_schema.si_ad_entryUUID->ad_cname;
804 slap_overinst *on = (slap_overinst *)be->bd_info;
805 syncprov_info_t *si = (syncprov_info_t *)on->on_bi.bi_private;
808 ldap_pvt_thread_mutex_destroy( &si->si_ops_mutex );
809 ldap_pvt_thread_mutex_destroy( &si->si_csn_mutex );
816 /* This overlay is set up for dynamic loading via moduleload. For static
817 * configuration, you'll need to arrange for the slap_overinst to be
818 * initialized and registered by some other function inside slapd.
821 static slap_overinst syncprov;
826 syncprov.on_bi.bi_type = "syncprov";
827 syncprov.on_bi.bi_db_init = syncprov_db_init;
828 syncprov.on_bi.bi_db_config = syncprov_db_config;
829 syncprov.on_bi.bi_db_destroy = syncprov_db_destroy;
831 syncprov.on_bi.bi_op_add = syncprov_op_mod;
833 syncprov.on_bi.bi_op_compare = syncprov_op_compare;
835 syncprov.on_bi.bi_op_delete = syncprov_op_mod;
836 syncprov.on_bi.bi_op_modify = syncprov_op_mod;
837 syncprov.on_bi.bi_op_modrdn = syncprov_op_mod;
838 syncprov.on_bi.bi_op_search = syncprov_op_search;
839 syncprov.on_bi.bi_extended = syncprov_op_extended;
842 syncprov.on_response = syncprov_response;
845 return overlay_register( &syncprov );
848 #if SLAPD_OVER_SYNCPROV == SLAPD_MOD_DYNAMIC
850 init_module( int argc, char *argv[] )
852 return syncprov_init();
854 #endif /* SLAPD_OVER_SYNCPROV == SLAPD_MOD_DYNAMIC */
856 #endif /* defined(SLAPD_OVER_SYNCPROV) */