File Syncprov-might-lose-deletes-ITS-6555.dif of Package openldap2
From 6340e86c13fd3d88a5fba4bbc38826ea0ef9d442 Mon Sep 17 00:00:00 2001
From: quanah <quanah>
Date: Sun, 5 Apr 2009 01:29:47 +0000
Subject: Syncprov might lose deletes (ITS#6555)
During the refresh phase the sync filter needs to be adjusted (skipping
the "(entrycsn>=cookie)" part that was inserted) when checking whether a
change needs to be replicated, otherwise we lose DELETES that happen during
the refresh phase.
bnc#606294
Required to backport ITS#6045 as well
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c
index 794169a..e75e4b3 100644
--- a/servers/slapd/overlays/syncprov.c
+++ b/servers/slapd/overlays/syncprov.c
@@ -1234,12 +1234,22 @@ syncprov_matchops( Operation *op, opcookie *opc, int saveit )
oh = *op->o_hdr;
oh.oh_conn = ss->s_op->o_conn;
oh.oh_connid = ss->s_op->o_connid;
+ op2.o_bd = op->o_bd->bd_self;
op2.o_hdr = &oh;
op2.o_extra = op->o_extra;
+ op2.o_callback = NULL;
+ ldap_pvt_thread_mutex_lock( &ss->s_mutex );
+ if (ss->s_flags & PS_FIX_FILTER) {
+ /* Skip the AND/GE clause that we stuck on in front. We
+ would lose deletes/mods that happen during the refresh
+ phase otherwise (ITS#6555) */
+ op2.ors_filter = ss->s_op->ors_filter->f_and->f_next;
+ }
+ ldap_pvt_thread_mutex_unlock( &ss->s_mutex );
}
/* 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 && test_filter( &op2, e, op2.ors_filter ) ==
LDAP_COMPARE_TRUE ) {
if ( saveit ) {
sm = op->o_tmpalloc( sizeof(syncmatches), op->o_tmpmemctx );
--
1.7.0.3