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;
180 int ret = SLAP_CB_CONTINUE;
182 if ( rs->sr_type == REP_SEARCH ) {
183 Debug(LDAP_DEBUG_TRACE, "present %s\n", rs->sr_entry->e_name.bv_val, 0, 0);
184 ret = slap_build_syncUUID_set( op, &pc->uuids, rs->sr_entry );
188 if ( pc->num == SLAP_SYNCUUID_SET_SIZE ) {
189 rs->sr_rspoid = LDAP_SYNC_INFO;
190 ret = slap_send_syncinfo( op, rs, LDAP_TAG_SYNC_ID_SET, NULL,
192 ber_bvarray_free_x( pc->uuids, op->o_tmpmemctx );
199 } else if ( rs->sr_type == REP_RESULT ) {
202 rs->sr_rspoid = LDAP_SYNC_INFO;
203 ret = slap_send_syncinfo( op, rs, LDAP_TAG_SYNC_ID_SET, NULL,
205 ber_bvarray_free_x( pc->uuids, op->o_tmpmemctx );
215 syncprov_findcsn( Operation *op, int mode )
217 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
218 syncprov_info_t *si = on->on_bi.bi_private;
220 slap_callback cb = {0};
222 SlapReply frs = { REP_RESULT };
223 char buf[LDAP_LUTIL_CSNSTR_BUFSIZE + STRLENOF("(entryCSN<=)")];
224 char cbuf[LDAP_LUTIL_CSNSTR_BUFSIZE];
227 AttributeAssertion eq;
230 fpres_cookie pcookie;
233 if ( op->o_sync_state.ctxcsn->bv_len >= LDAP_LUTIL_CSNSTR_BUFSIZE ) {
241 if ( mode == FIND_CSN ) {
242 if ( !si->si_gotcsn ) {
243 /* If we don't know the current ctxcsn, find it */
244 ldap_pvt_thread_mutex_lock( &si->si_csn_mutex );
247 if ( !si->si_gotcsn ) {
248 cf.f_choice = LDAP_FILTER_GE;
249 fop.ors_attrsonly = 0;
250 fop.ors_attrs = csn_anlist;
251 fop.ors_slimit = SLAP_NO_LIMIT;
252 cb.sc_private = &fcookie;
253 fcookie.maxcsn.bv_val = cbuf;
254 fcookie.maxcsn.bv_len = 0;
255 fcookie.gotmatch = 0;
256 fbuf.bv_len = sprintf( buf, "(entryCSN>=%s)", op->o_sync_state.ctxcsn->bv_val );
259 ldap_pvt_thread_mutex_unlock( &si->si_csn_mutex );
262 cf.f_choice = LDAP_FILTER_LE;
263 fop.ors_attrsonly = 1;
264 fop.ors_attrs = slap_anlist_no_attrs;
266 cb.sc_private = NULL;
267 fbuf.bv_len = sprintf( buf, "(entryCSN=%s)", op->o_sync_state.ctxcsn->bv_val );
269 cb.sc_response = findcsn_cb;
271 } else if ( mode == FIND_PRESENT ) {
272 cf.f_choice = LDAP_FILTER_LE;
273 fop.ors_attrsonly = 0;
274 fop.ors_attrs = uuid_anlist;
275 fop.ors_slimit = SLAP_NO_LIMIT;
276 cb.sc_private = &pcookie;
277 cb.sc_response = findpres_cb;
279 pcookie.uuids = NULL;
280 fbuf.bv_len = sprintf( buf, "(entryCSN<=%s)", op->o_sync_state.ctxcsn->bv_val );
283 cf.f_av_desc = slap_schema.si_ad_entryCSN;
284 cf.f_av_value = *op->o_sync_state.ctxcsn;
287 fop.o_callback = &cb;
288 fop.ors_tlimit = SLAP_NO_LIMIT;
289 fop.ors_filter = &cf;
290 fop.ors_filterstr = fbuf;
292 fop.o_bd->bd_info = on->on_info->oi_orig;
293 rc = fop.o_bd->be_search( &fop, &frs );
294 fop.o_bd->bd_info = on;
296 if ( mode == FIND_CSN ) {
297 if ( !si->si_gotcsn ) {
298 ber_dupbv( &si->si_ctxcsn, &fcookie.maxcsn );
300 ldap_pvt_thread_mutex_unlock( &si->si_csn_mutex );
301 if ( fcookie.gotmatch ) return LDAP_SUCCESS;
304 if ( cb.sc_private ) return LDAP_SUCCESS;
306 } else if ( mode == FIND_PRESENT ) {
310 /* If matching CSN was not found, invalidate the context. */
311 return LDAP_NO_SUCH_OBJECT;
315 syncprov_matchops( Operation *op, opcookie *opc, int saveit )
317 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
318 syncprov_info_t *si = on->on_bi.bi_private;
326 fc.fdn = &op->o_req_ndn;
327 rc = be_entry_get_rw( op, fc.fdn, NULL, NULL, 0, &e );
331 a = attr_find( e->e_attrs, slap_schema.si_ad_entryUUID );
333 ber_dupbv_x( &opc->suuid, &a->a_vals[0], op->o_tmpmemctx );
336 ldap_pvt_thread_mutex_lock( &si->si_ops_mutex );
337 for (ss = si->si_ops; ss; ss=ss->s_next)
346 rc = syncprov_findbase( op, ss, &fc );
347 if ( rc != LDAP_SUCCESS ) continue;
349 /* If we're sending results now, look for this op in old matches */
352 for ( sm=opc->smatches, old=(syncmatches *)&opc->smatches; sm;
353 old=sm, sm=sm->sm_next ) {
354 if ( sm->sm_op == ss ) {
356 old->sm_next = sm->sm_next;
357 op->o_tmpfree( sm, op->o_tmpmemctx );
363 /* check if current o_req_dn is in scope and matches filter */
364 if ( fc.fsuffix && test_filter( op, e, ss->s_op->ors_filter ) ==
365 LDAP_COMPARE_TRUE ) {
367 sm = op->o_tmpalloc( sizeof(syncmatches), op->o_tmpmemctx );
368 sm->sm_next = opc->smatches;
372 /* if found send UPDATE else send ADD */
377 } else if ( !saveit && found ) {
381 ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex );
382 be_entry_release_r( op, e );
386 syncprov_op_cleanup( Operation *op, SlapReply *rs )
388 slap_callback *cb = op->o_callback;
389 opcookie *opc = (opcookie *)(cb+1);
390 syncmatches *sm, *snext;
392 for (sm = opc->smatches; sm; sm=snext) {
394 op->o_tmpfree( sm, op->o_tmpmemctx );
396 op->o_callback = cb->sc_next;
397 op->o_tmpfree(cb, op->o_tmpmemctx);
401 syncprov_op_response( Operation *op, SlapReply *rs )
403 slap_callback *cb = op->o_callback;
404 opcookie *opc = (opcookie *)(cb+1);
405 slap_overinst *on = opc->son;
406 syncprov_info_t *si = on->on_bi.bi_private;
409 if ( rs->sr_err == LDAP_SUCCESS )
411 struct berval maxcsn;
412 void *memctx = op->o_tmpmemctx;
414 ldap_pvt_thread_mutex_lock( &si->si_csn_mutex );
415 op->o_tmpmemctx = NULL;
416 slap_get_commit_csn( op, &maxcsn );
417 op->o_tmpmemctx = memctx;
418 if ( maxcsn.bv_val ) {
419 free( si->si_ctxcsn.bv_val );
420 si->si_ctxcsn = maxcsn;
423 ldap_pvt_thread_mutex_unlock( &si->si_csn_mutex );
428 case LDAP_REQ_MODIFY:
429 case LDAP_REQ_MODRDN:
430 case LDAP_REQ_EXTENDED:
431 syncprov_matchops( op, opc, 0 );
433 case LDAP_REQ_DELETE:
434 /* for each match in opc->smatches:
437 for ( sm = opc->smatches; sm; sm=sm->sm_next ) {
444 return SLAP_CB_CONTINUE;
449 syncprov_op_compare( Operation *op, SlapReply *rs )
451 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
452 syncprov_info_t *si = on->on_bi.bi_private;
453 int rc = SLAP_CB_CONTINUE;
455 if ( dn_match( &op->o_req_ndn, &si->si_e->e_nname ) )
459 ldap_pvt_thread_mutex_lock( &si->si_e_mutex );
461 if ( get_assert( op ) &&
462 ( test_filter( op, si->si_e, get_assertion( op ) ) != LDAP_COMPARE_TRUE ) )
464 rs->sr_err = LDAP_ASSERTION_FAILED;
468 rs->sr_err = access_allowed( op, si->si_e, op->oq_compare.rs_ava->aa_desc,
469 &op->oq_compare.rs_ava->aa_value, ACL_COMPARE, NULL );
470 if ( ! rs->sr_err ) {
471 rs->sr_err = LDAP_INSUFFICIENT_ACCESS;
475 rs->sr_err = LDAP_NO_SUCH_ATTRIBUTE;
477 for ( a = attr_find( si->si_e->e_attrs, op->oq_compare.rs_ava->aa_desc );
479 a = attr_find( a->a_next, op->oq_compare.rs_ava->aa_desc ) )
481 rs->sr_err = LDAP_COMPARE_FALSE;
483 if ( value_find_ex( op->oq_compare.rs_ava->aa_desc,
484 SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH |
485 SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
486 a->a_nvals, &op->oq_compare.rs_ava->aa_value, op->o_tmpmemctx ) == 0 )
488 rs->sr_err = LDAP_COMPARE_TRUE;
495 ldap_pvt_thread_mutex_unlock( &si->si_e_mutex );
497 send_ldap_result( op, rs );
499 if( rs->sr_err == LDAP_COMPARE_FALSE || rs->sr_err == LDAP_COMPARE_TRUE ) {
500 rs->sr_err = LDAP_SUCCESS;
505 return SLAP_CB_CONTINUE;
510 syncprov_op_mod( Operation *op, SlapReply *rs )
512 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
513 syncprov_info_t *si = on->on_bi.bi_private;
515 slap_callback *cb = op->o_tmpcalloc(1, sizeof(slap_callback)+sizeof(opcookie), op->o_tmpmemctx);
516 opcookie *opc = (opcookie *)(cb+1);
518 cb->sc_response = syncprov_op_response;
519 cb->sc_cleanup = syncprov_op_cleanup;
520 cb->sc_private = opc;
521 cb->sc_next = op->o_callback;
524 if ( si->si_ops && op->o_tag != LDAP_REQ_ADD )
525 syncprov_matchops( op, opc, 1 );
527 return SLAP_CB_CONTINUE;
531 syncprov_op_extended( Operation *op, SlapReply *rs )
533 if ( exop_is_write( op ))
534 return syncprov_op_mod( op, rs );
536 return SLAP_CB_CONTINUE;
540 syncprov_search_cleanup( Operation *op, SlapReply *rs )
542 if ( rs->sr_ctrls ) {
543 free( rs->sr_ctrls[0] );
544 op->o_tmpfree( rs->sr_ctrls, op->o_tmpmemctx );
550 syncprov_search_response( Operation *op, SlapReply *rs )
552 slap_callback *cb = op->o_callback;
553 slap_overinst *on = cb->sc_private;
554 syncprov_info_t *si = on->on_bi.bi_private;
556 if ( rs->sr_type == REP_SEARCH ) {
558 if ( op->o_sync_state.ctxcsn ) {
559 Attribute *a = attr_find( rs->sr_entry->e_attrs,
560 slap_schema.si_ad_entryCSN );
561 /* Don't send the ctx entry twice */
562 if ( bvmatch( &a->a_nvals[0], op->o_sync_state.ctxcsn ))
565 rs->sr_ctrls = op->o_tmpalloc( sizeof(LDAPControl *)*2,
567 rs->sr_ctrls[1] = NULL;
568 rs->sr_err = slap_build_sync_state_ctrl( op, rs, rs->sr_entry,
569 LDAP_SYNC_ADD, rs->sr_ctrls, 0, 0, NULL );
570 } else if (rs->sr_type == REP_RESULT ) {
571 struct berval cookie;
572 rs->sr_ctrls = op->o_tmpalloc( sizeof(LDAPControl *)*2,
574 rs->sr_ctrls[1] = NULL;
575 slap_compose_sync_cookie( op, &cookie,
576 &op->ors_filter->f_and->f_ava->aa_value,
577 op->o_sync_state.sid, op->o_sync_state.rid );
578 rs->sr_err = slap_build_sync_done_ctrl( op, rs, rs->sr_ctrls,
579 0, 1, &cookie, LDAP_SYNC_REFRESH_PRESENTS );
582 return SLAP_CB_CONTINUE;
586 syncprov_op_search( Operation *op, SlapReply *rs )
588 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
589 syncprov_info_t *si = (syncprov_info_t *)on->on_bi.bi_private;
594 if ( !op->o_sync_mode ) return SLAP_CB_CONTINUE;
596 if ( op->ors_deref & LDAP_DEREF_SEARCHING ) {
597 send_ldap_error( op, rs, LDAP_PROTOCOL_ERROR, "illegal value for derefAliases" );
601 /* If we have a cookie, handle the PRESENT lookups
603 if ( op->o_sync_state.ctxcsn ) {
604 /* Is the CSN in a valid format? */
605 if ( op->o_sync_state.ctxcsn->bv_len >= LDAP_LUTIL_CSNSTR_BUFSIZE ) {
606 send_ldap_error( op, rs, LDAP_OTHER, "invalid sync cookie" );
609 /* Is the CSN still present in the database? */
610 if ( syncprov_findcsn( op, FIND_CSN ) != LDAP_SUCCESS ) {
611 /* No, so a reload is required */
612 #if 0 /* the consumer doesn't seem to send this hint */
613 if ( op->o_sync_rhint == 0 ) {
614 send_ldap_error( op, rs, LDAP_SYNC_REFRESH_REQUIRED, "sync cookie is stale" );
619 /* Does it match the current ctxCSN? */
620 if ( bvmatch( op->o_sync_state.ctxcsn, &si->si_ctxcsn )) {
621 LDAPControl *ctrls[2];
625 slap_build_sync_done_ctrl( op, rs, ctrls, 0, 0,
626 NULL, LDAP_SYNC_REFRESH_DELETES );
627 rs->sr_err = LDAP_SUCCESS;
628 send_ldap_result( op, rs );
632 /* OK, let's send all the Present UUIDs */
633 if ( syncprov_findcsn( op, FIND_PRESENT ) != LDAP_SUCCESS ) {
634 send_ldap_result( op, rs );
640 if ( !gotstate && !si->si_gotcsn ) {
641 struct berval bv = BER_BVC("1"), *old;
643 old = op->o_sync_state.ctxcsn;
644 op->o_sync_state.ctxcsn = &bv;
645 syncprov_findcsn( op, FIND_CSN );
646 op->o_sync_state.ctxcsn = old;
649 /* Append CSN range to search filter */
650 op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
652 fand = op->o_tmpalloc( sizeof(Filter), op->o_tmpmemctx );
653 fand->f_choice = LDAP_FILTER_AND;
655 fava = op->o_tmpalloc( sizeof(Filter), op->o_tmpmemctx );
656 fava->f_choice = LDAP_FILTER_LE;
657 fava->f_ava = op->o_tmpalloc( sizeof(AttributeAssertion), op->o_tmpmemctx );
658 fava->f_ava->aa_desc = slap_schema.si_ad_entryCSN;
659 ber_dupbv_x( &fava->f_ava->aa_value, &si->si_ctxcsn, op->o_tmpmemctx );
662 fava->f_next = op->o_tmpalloc( sizeof(Filter), op->o_tmpmemctx );
664 fava->f_choice = LDAP_FILTER_GE;
665 fava->f_ava = op->o_tmpalloc( sizeof(AttributeAssertion), op->o_tmpmemctx );
666 fava->f_ava->aa_desc = slap_schema.si_ad_entryCSN;
667 ber_dupbv_x( &fava->f_ava->aa_value, op->o_sync_state.ctxcsn, op->o_tmpmemctx );
669 fava->f_next = op->ors_filter;
670 op->ors_filter = fand;
671 filter2bv_x( op, op->ors_filter, &op->ors_filterstr );
673 /* Let our callback add needed info to returned entries */
674 cb = op->o_tmpcalloc(1, sizeof(slap_callback)+sizeof(opcookie), op->o_tmpmemctx);
675 cb->sc_response = syncprov_search_response;
676 cb->sc_cleanup = syncprov_search_cleanup;
678 cb->sc_next = op->o_callback;
681 return SLAP_CB_CONTINUE;
686 syncprov_response( Operation *op, SlapReply *rs )
688 slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
689 syncprov_info_t *si = (syncprov_info_t *)on->on_bi.bi_private;
691 if ( rs->sr_err == LDAP_SUCCESS ) {
692 if ( op->o_tag == LDAP_REQ_SEARCH ) {
693 /* handle transition from refresh to persist */
694 if ( op->o_sync_mode == SLAP_SYNC_REFRESH_AND_PERSIST ) {
697 /* If we're checkpointing */
698 } else if ( si->si_chkops || si->si_chktime )) {
701 switch ( op->o_tag ) {
702 case LDAP_REQ_EXTENDED:
705 /* if not PASSWD_MODIFY, break */
706 for ( i=0; write_exop[i]; i++ )
708 if ( !ber_bvcmp( write_exop[i], &op->oq_extended.rs_reqoid ))
718 case LDAP_REQ_MODIFY:
719 case LDAP_REQ_MODRDN:
720 case LDAP_REQ_DELETE:
721 ldap_pvt_thread_mutex_lock( &si->si_chk_mutex );
725 if ( si->si_numops >= si->si_chkops )
731 if ( si->si_chktime )
733 if ( op->o_time - si->si_chklast >= si->si_chktime )
736 si->si_chklast = op->o_time;
739 ldap_pvt_thread_mutex_unlock( &si->si_chk_mutex );
742 /* write cn=ldapsync to underlying db */
748 /* Release this DN */
749 if ( op->o_tag == LDAP_REQ_MODIFY ) {
750 ldap_pvt_thread_mutex_lock( &si->si_mod_mutex );
751 avl_delete( &si->si_mods, &op->o_req_ndn, dn_avl_cmp );
752 ldap_pvt_thread_mutex_unlock( &si->si_mod_mutex );
754 return SLAP_CB_CONTINUE;
767 slap_overinst *on = (slap_overinst *)be->bd_info;
768 syncprov_info_t *si = (syncprov_info_t *)on->on_bi.bi_private;
771 if ( strcasecmp( argv[ 0 ], "syncprov-checkpoint" ) == 0 ) {
773 fprintf( stderr, "%s: line %d: wrong number of arguments in "
774 "\"syncprov-checkpoint <ops> <minutes>\"\n", fname, lineno );
777 si->si_chkops = atoi( argv[1] );
778 si->si_chktime = atoi( argv[2] ) * 60;
781 return SLAP_CONF_UNKNOWN;
785 return SLAP_CONF_UNKNOWN;
793 slap_overinst *on = (slap_overinst *)be->bd_info;
796 si = ch_calloc(1, sizeof(syncprov_info_t));
797 on->on_bi.bi_private = si;
798 ldap_pvt_thread_mutex_init( &si->si_csn_mutex );
799 ldap_pvt_thread_mutex_init( &si->si_ops_mutex );
801 csn_anlist[0].an_desc = slap_schema.si_ad_entryCSN;
802 csn_anlist[0].an_name = slap_schema.si_ad_entryCSN->ad_cname;
804 uuid_anlist[0].an_desc = slap_schema.si_ad_entryUUID;
805 uuid_anlist[0].an_name = slap_schema.si_ad_entryUUID->ad_cname;
815 slap_overinst *on = (slap_overinst *)be->bd_info;
816 syncprov_info_t *si = (syncprov_info_t *)on->on_bi.bi_private;
819 ldap_pvt_thread_mutex_destroy( &si->si_ops_mutex );
820 ldap_pvt_thread_mutex_destroy( &si->si_csn_mutex );
827 /* This overlay is set up for dynamic loading via moduleload. For static
828 * configuration, you'll need to arrange for the slap_overinst to be
829 * initialized and registered by some other function inside slapd.
832 static slap_overinst syncprov;
837 syncprov.on_bi.bi_type = "syncprov";
838 syncprov.on_bi.bi_db_init = syncprov_db_init;
839 syncprov.on_bi.bi_db_config = syncprov_db_config;
840 syncprov.on_bi.bi_db_destroy = syncprov_db_destroy;
842 syncprov.on_bi.bi_op_add = syncprov_op_mod;
844 syncprov.on_bi.bi_op_compare = syncprov_op_compare;
846 syncprov.on_bi.bi_op_delete = syncprov_op_mod;
847 syncprov.on_bi.bi_op_modify = syncprov_op_mod;
848 syncprov.on_bi.bi_op_modrdn = syncprov_op_mod;
849 syncprov.on_bi.bi_op_search = syncprov_op_search;
850 syncprov.on_bi.bi_extended = syncprov_op_extended;
853 syncprov.on_response = syncprov_response;
856 return overlay_register( &syncprov );
859 #if SLAPD_OVER_SYNCPROV == SLAPD_MOD_DYNAMIC
861 init_module( int argc, char *argv[] )
863 return syncprov_init();
865 #endif /* SLAPD_OVER_SYNCPROV == SLAPD_MOD_DYNAMIC */
867 #endif /* defined(SLAPD_OVER_SYNCPROV) */