version 1.147.2.49, 2009/03/12 23:28:52
|
version 1.147.2.50, 2009/03/13 19:47:32
|
Line 1
|
Line 1
|
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.147.2.48 2009/03/05 20:23:15 quanah Exp $ */ |
/* $OpenLDAP: pkg/ldap/servers/slapd/overlays/syncprov.c,v 1.147.2.49 2009/03/12 23:28:52 quanah Exp $ */ |
/* syncprov.c - syncrepl provider */ |
/* syncprov.c - syncrepl provider */ |
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. |
/* This work is part of OpenLDAP Software <http://www.openldap.org/>. |
* |
* |
Line 147 typedef struct opcookie {
|
Line 147 typedef struct opcookie {
|
struct berval sndn; |
struct berval sndn; |
struct berval suuid; /* UUID of entry */ |
struct berval suuid; /* UUID of entry */ |
struct berval sctxcsn; |
struct berval sctxcsn; |
int sreference; /* Is the entry a reference? */ |
short osid; /* sid of op csn */ |
|
short rsid; /* sid of relay */ |
|
short sreference; /* Is the entry a reference? */ |
} opcookie; |
} opcookie; |
|
|
typedef struct fbase_cookie { |
typedef struct fbase_cookie { |
Line 790 syncprov_sendresp( Operation *op, opcook
|
Line 792 syncprov_sendresp( Operation *op, opcook
|
ctrls[1] = NULL; |
ctrls[1] = NULL; |
csns[0] = opc->sctxcsn; |
csns[0] = opc->sctxcsn; |
BER_BVZERO( &csns[1] ); |
BER_BVZERO( &csns[1] ); |
slap_compose_sync_cookie( op, &cookie, csns, so->s_rid, so->s_sid ); |
slap_compose_sync_cookie( op, &cookie, csns, so->s_rid, slap_serverID ? slap_serverID : -1 ); |
|
|
Debug( LDAP_DEBUG_SYNC, "syncprov_sendresp: cookie=%s\n", cookie.bv_val, 0, 0 ); |
#ifdef LDAP_DEBUG |
|
if ( so->s_sid > 0 ) { |
|
Debug( LDAP_DEBUG_SYNC, "syncprov_sendresp: to=%03x, cookie=%s\n", |
|
so->s_sid, cookie.bv_val, 0 ); |
|
} else { |
|
Debug( LDAP_DEBUG_SYNC, "syncprov_sendresp: cookie=%s\n", |
|
cookie.bv_val, 0, 0 ); |
|
} |
|
#endif |
|
|
e_uuid.e_attrs = &a_uuid; |
e_uuid.e_attrs = &a_uuid; |
a_uuid.a_desc = slap_schema.si_ad_entryUUID; |
a_uuid.a_desc = slap_schema.si_ad_entryUUID; |
Line 1021 syncprov_qresp( opcookie *opc, syncops *
|
Line 1031 syncprov_qresp( opcookie *opc, syncops *
|
syncprov_info_t *si = opc->son->on_bi.bi_private; |
syncprov_info_t *si = opc->son->on_bi.bi_private; |
|
|
slap_compose_sync_cookie( NULL, &cookie, si->si_ctxcsn, |
slap_compose_sync_cookie( NULL, &cookie, si->si_ctxcsn, |
so->s_rid, so->s_sid); |
so->s_rid, slap_serverID ? slap_serverID : -1); |
} else if ( opc->sctxcsn.bv_len ) { |
|
/* Don't send changes back to their originator */ |
|
int sid = slap_parse_csn_sid( &opc->sctxcsn ); |
|
if ( sid >= 0 && sid == so->s_sid ) |
|
return LDAP_SUCCESS; |
|
} |
} |
|
|
srsize = sizeof(syncres) + opc->suuid.bv_len + 1 + |
srsize = sizeof(syncres) + opc->suuid.bv_len + 1 + |
Line 1217 syncprov_matchops( Operation *op, opcook
|
Line 1222 syncprov_matchops( Operation *op, opcook
|
if ( ss->s_op->o_abandon ) |
if ( ss->s_op->o_abandon ) |
continue; |
continue; |
|
|
|
/* First time thru, check for possible skips */ |
|
if ( saveit || op->o_tag == LDAP_REQ_ADD ) { |
|
|
|
/* Don't send ops back to the originator */ |
|
if ( opc->osid > 0 && opc->osid == ss->s_sid ) { |
|
Debug( LDAP_DEBUG_SYNC, "syncprov_matchops: skipping original sid %03x\n", |
|
opc->osid, 0, 0 ); |
|
continue; |
|
} |
|
|
|
/* Don't send ops back to the messenger */ |
|
if ( opc->rsid > 0 && opc->rsid == ss->s_sid ) { |
|
Debug( LDAP_DEBUG_SYNC, "syncprov_matchops: skipping relayed sid %03x\n", |
|
opc->rsid, 0, 0 ); |
|
continue; |
|
} |
|
} |
|
|
/* validate base */ |
/* validate base */ |
fc.fss = ss; |
fc.fss = ss; |
fc.fbase = 0; |
fc.fbase = 0; |
Line 1264 syncprov_matchops( Operation *op, opcook
|
Line 1287 syncprov_matchops( Operation *op, opcook
|
oh.oh_connid = ss->s_op->o_connid; |
oh.oh_connid = ss->s_op->o_connid; |
op2.o_hdr = &oh; |
op2.o_hdr = &oh; |
op2.o_extra = op->o_extra; |
op2.o_extra = op->o_extra; |
|
rc = test_filter( &op2, e, ss->s_op->ors_filter ); |
} |
} |
|
|
|
Debug( LDAP_DEBUG_TRACE, "syncprov_matchops: sid %03x fscope %d rc %d\n", |
|
ss->s_sid, fc.fscope, rc ); |
|
|
/* check if current o_req_dn is in scope and matches filter */ |
/* check if current o_req_dn is in scope and matches filter */ |
if ( fc.fscope && test_filter( &op2, e, ss->s_op->ors_filter ) == |
if ( fc.fscope && rc == LDAP_COMPARE_TRUE ) { |
LDAP_COMPARE_TRUE ) { |
|
if ( saveit ) { |
if ( saveit ) { |
sm = op->o_tmpalloc( sizeof(syncmatches), op->o_tmpmemctx ); |
sm = op->o_tmpalloc( sizeof(syncmatches), op->o_tmpmemctx ); |
sm->sm_next = opc->smatches; |
sm->sm_next = opc->smatches; |
Line 1624 syncprov_playlog( Operation *op, SlapRep
|
Line 1650 syncprov_playlog( Operation *op, SlapRep
|
|
|
if ( delcsn[0].bv_len ) { |
if ( delcsn[0].bv_len ) { |
slap_compose_sync_cookie( op, &cookie, delcsn, srs->sr_state.rid, |
slap_compose_sync_cookie( op, &cookie, delcsn, srs->sr_state.rid, |
srs->sr_state.sid ); |
slap_serverID ? slap_serverID : -1 ); |
|
|
Debug( LDAP_DEBUG_SYNC, "syncprov_playlog: cookie=%s\n", cookie.bv_val, 0, 0 ); |
Debug( LDAP_DEBUG_SYNC, "syncprov_playlog: cookie=%s\n", cookie.bv_val, 0, 0 ); |
} |
} |
Line 1867 syncprov_op_mod( Operation *op, SlapRepl
|
Line 1893 syncprov_op_mod( Operation *op, SlapRepl
|
cb->sc_next = op->o_callback; |
cb->sc_next = op->o_callback; |
op->o_callback = cb; |
op->o_callback = cb; |
|
|
|
opc->osid = -1; |
|
opc->rsid = -1; |
|
if ( op->o_csn.bv_val ) { |
|
opc->osid = slap_parse_csn_sid( &op->o_csn ); |
|
} |
|
if ( op->o_controls ) { |
|
struct sync_cookie *scook = |
|
op->o_controls[slap_cids.sc_LDAPsync]; |
|
if ( scook ) |
|
opc->rsid = scook->sid; |
|
} |
|
|
/* If there are active persistent searches, lock this operation. |
/* If there are active persistent searches, lock this operation. |
* See seqmod.c for the locking logic on its own. |
* See seqmod.c for the locking logic on its own. |
*/ |
*/ |
Line 1894 syncprov_op_mod( Operation *op, SlapRepl
|
Line 1932 syncprov_op_mod( Operation *op, SlapRepl
|
* Currently it's not an issue because there are |
* Currently it's not an issue because there are |
* no dynamic config deletes... |
* no dynamic config deletes... |
*/ |
*/ |
|
if ( slapd_shutdown ) |
|
return SLAPD_ABANDON; |
|
|
if ( !ldap_pvt_thread_pool_pausecheck( &connection_pool )) |
if ( !ldap_pvt_thread_pool_pausecheck( &connection_pool )) |
ldap_pvt_thread_yield(); |
ldap_pvt_thread_yield(); |
ldap_pvt_thread_mutex_lock( &mt->mt_mutex ); |
ldap_pvt_thread_mutex_lock( &mt->mt_mutex ); |
Line 2136 syncprov_search_response( Operation *op,
|
Line 2177 syncprov_search_response( Operation *op,
|
/* If we're in delta-sync mode, always send a cookie */ |
/* If we're in delta-sync mode, always send a cookie */ |
if ( si->si_nopres && si->si_usehint && a ) { |
if ( si->si_nopres && si->si_usehint && a ) { |
struct berval cookie; |
struct berval cookie; |
slap_compose_sync_cookie( op, &cookie, a->a_nvals, srs->sr_state.rid, srs->sr_state.sid ); |
slap_compose_sync_cookie( op, &cookie, a->a_nvals, srs->sr_state.rid, slap_serverID ? slap_serverID : -1 ); |
rs->sr_err = syncprov_state_ctrl( op, rs, rs->sr_entry, |
rs->sr_err = syncprov_state_ctrl( op, rs, rs->sr_entry, |
LDAP_SYNC_ADD, rs->sr_ctrls, 0, 1, &cookie ); |
LDAP_SYNC_ADD, rs->sr_ctrls, 0, 1, &cookie ); |
} else { |
} else { |
Line 2148 syncprov_search_response( Operation *op,
|
Line 2189 syncprov_search_response( Operation *op,
|
|
|
if ( ss->ss_flags & SS_CHANGED ) { |
if ( ss->ss_flags & SS_CHANGED ) { |
slap_compose_sync_cookie( op, &cookie, ss->ss_ctxcsn, |
slap_compose_sync_cookie( op, &cookie, ss->ss_ctxcsn, |
srs->sr_state.rid, srs->sr_state.sid ); |
srs->sr_state.rid, slap_serverID ? slap_serverID : -1 ); |
|
|
Debug( LDAP_DEBUG_SYNC, "syncprov_search_response: cookie=%s\n", cookie.bv_val, 0, 0 ); |
Debug( LDAP_DEBUG_SYNC, "syncprov_search_response: cookie=%s\n", cookie.bv_val, 0, 0 ); |
} |
} |