From 689811476f8764c06f5076094a9290251b413aea Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ond=C5=99ej=20Kuzn=C3=ADk?= Date: Mon, 11 Oct 2021 14:17:15 +0100 Subject: [PATCH] ITS#9282 Do not resuscitate entries we already deleted --- servers/slapd/syncrepl.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 68e2e66236..1077b9ff6c 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -4111,6 +4111,25 @@ syncrepl_entry( } } retry_add:; + if ( !BER_BVISNULL( &op->o_csn ) ) { + /* Check we're not covered by current contextCSN */ + int i, sid = slap_parse_csn_sid( &op->o_csn ); + ldap_pvt_thread_mutex_lock( &si->si_cookieState->cs_mutex ); + for ( i=0; + i < si->si_cookieState->cs_num && + sid <= si->si_cookieState->cs_sids[i]; + i++ ) { + if ( si->si_cookieState->cs_sids[i] == sid && + ber_bvcmp( &op->o_csn, &si->si_cookieState->cs_vals[i] ) <= 0 ) { + Debug( LDAP_DEBUG_SYNC, "syncrepl_entry: %s " + "entry '%s' csn=%s not new enough, ignored\n", + si->si_ridtxt, entry->e_name.bv_val, op->o_csn.bv_val ); + ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex ); + goto done; + } + } + ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex ); + } if ( BER_BVISNULL( &dni.dn ) ) { SlapReply rs_add = {REP_RESULT}; -- 2.47.3