From eb3e92481bfbc655164e5c66aa3499a4315ac6ea Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Fri, 13 Mar 2009 06:44:49 +0000 Subject: [PATCH] More for #6020 --- servers/slapd/overlays/syncprov.c | 33 +++++++++++++++++++------------ 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index 9b1d068c64..574f4e3251 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -1183,18 +1183,22 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit ) if ( ss->s_op->o_abandon ) continue; - /* Don't send ops back to the originator */ - if ( opc->ssid > 0 && opc->ssid == ss->s_sid ) { - Debug( LDAP_DEBUG_SYNC, "syncprov_matchops: skipping original sid %03x\n", - opc->ssid, 0, 0 ); - continue; - } + /* First time thru, check for possible skips */ + if ( saveit || op->o_tag == LDAP_REQ_ADD ) { - /* Don't send ops back to the messenger */ - if ( scook && scook->sid > 0 && scook->sid == ss->s_sid ) { - Debug( LDAP_DEBUG_SYNC, "syncprov_matchops: skipping relayed sid %03x\n", - scook->sid, 0, 0 ); - continue; + /* Don't send ops back to the originator */ + if ( opc->ssid > 0 && opc->ssid == ss->s_sid ) { + Debug( LDAP_DEBUG_SYNC, "syncprov_matchops: skipping original sid %03x\n", + opc->ssid, 0, 0 ); + continue; + } + + /* Don't send ops back to the messenger */ + if ( scook && scook->sid > 0 && scook->sid == ss->s_sid ) { + Debug( LDAP_DEBUG_SYNC, "syncprov_matchops: skipping relayed sid %03x\n", + scook->sid, 0, 0 ); + continue; + } } /* validate base */ @@ -1244,11 +1248,14 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit ) oh.oh_connid = ss->s_op->o_connid; op2.o_hdr = &oh; op2.o_extra = op->o_extra; + rc = test_filter( &op2, e, ss->s_op->ors_filter ); } + Debug( LDAP_DEBUG_SYNC, "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 */ - if ( fc.fscope && test_filter( &op2, e, ss->s_op->ors_filter ) == - LDAP_COMPARE_TRUE ) { + if ( fc.fscope && rc == LDAP_COMPARE_TRUE ) { if ( saveit ) { sm = op->o_tmpalloc( sizeof(syncmatches), op->o_tmpmemctx ); sm->sm_next = opc->smatches; -- 2.39.5