From 4b18c2be00b95d9559e749388216e30da8ba2c85 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= Date: Wed, 10 Nov 2021 12:22:07 +0000 Subject: [PATCH] ITS#5972 Consider all deletes for syncInfo messages A delete of an entry that didn't match filter would be skipped altogether and the cookie would never be sent to that consumer. --- servers/slapd/overlays/syncprov.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c index 73450aa792..7a5a637dc7 100644 --- a/servers/slapd/overlays/syncprov.c +++ b/servers/slapd/overlays/syncprov.c @@ -1296,7 +1296,9 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit ) fc.fdn = &newdn; freefdn = 1; } - if ( op->o_tag != LDAP_REQ_ADD ) { + if ( !saveit && op->o_tag == LDAP_REQ_DELETE ) { + /* Delete succeeded, there is no entry */ + } else if ( op->o_tag != LDAP_REQ_ADD ) { if ( !SLAP_ISOVERLAY( op->o_bd )) { db = *op->o_bd; op->o_bd = &db; @@ -1412,7 +1414,7 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit ) } rc = LDAP_COMPARE_FALSE; - if ( !is_entry_glue( e ) && fc.fscope ) { + if ( e && !is_entry_glue( e ) && fc.fscope ) { ldap_pvt_thread_mutex_lock( &ss->s_mutex ); op2 = *ss->s_op; oh = *op->o_hdr; @@ -2569,26 +2571,7 @@ added: have_psearches = ( si->si_ops != NULL ); ldap_pvt_thread_mutex_unlock( &si->si_ops_mutex ); if ( have_psearches ) { - switch(op->o_tag) { - case LDAP_REQ_ADD: - case LDAP_REQ_MODIFY: - case LDAP_REQ_MODRDN: - case LDAP_REQ_EXTENDED: - syncprov_matchops( op, opc, 0 ); - break; - case LDAP_REQ_DELETE: - /* for each match in opc->smatches: - * send DELETE msg - */ - for ( sm = opc->smatches; sm; sm=sm->sm_next ) { - if ( sm->sm_op->s_op->o_abandon ) - continue; - syncprov_qresp( opc, sm->sm_op, LDAP_SYNC_DELETE ); - } - if ( opc->ssres.s_info ) - free_resinfo( &opc->ssres ); - break; - } + syncprov_matchops( op, opc, 0 ); } /* Add any log records */ -- 2.47.3