From be5f314fe375e275fe8ad773fb20c21c244d0a83 Mon Sep 17 00:00:00 2001
From: Quanah Gibson-Mount <quanah@openldap.org>
Date: Wed, 9 Jul 2008 23:42:19 +0000
Subject: [PATCH] ITS#5564

---
 CHANGES                           | 1 +
 servers/slapd/overlays/syncprov.c | 9 +++++++++
 2 files changed, 10 insertions(+)

diff --git a/CHANGES b/CHANGES
index 18a8db8086..14411fddea 100644
--- a/CHANGES
+++ b/CHANGES
@@ -9,6 +9,7 @@ OpenLDAP 2.4.11 Engineering
 	Fixed slapo-pcache handling of negative search caches (ITS#5546)
 	Fixed slapo-ppolicy DNs with whitespaces (ITS#5552)
 	Fixed slapo-syncprov ACL evaluation (ITS#5548)
+	Fixed slapo-syncprov full reload (ITS#5564)
 	Build Environment
 		Fixed test048 to skip if threads is not available (ITS#5529)
 	Documentation
diff --git a/servers/slapd/overlays/syncprov.c b/servers/slapd/overlays/syncprov.c
index e6e2161e44..80fd2774c2 100644
--- a/servers/slapd/overlays/syncprov.c
+++ b/servers/slapd/overlays/syncprov.c
@@ -2323,6 +2323,15 @@ no_change:		if ( !(op->o_sync_mode & SLAP_SYNC_PERSIST) ) {
 				send_ldap_error( op, rs, LDAP_SYNC_REFRESH_REQUIRED, "sync cookie is stale" );
 				return rs->sr_err;
 			}
+			if ( srs->sr_state.ctxcsn ) {
+				ber_bvarray_free_x( srs->sr_state.ctxcsn, op->o_tmpmemctx );
+				srs->sr_state.ctxcsn = NULL;
+			}
+			if ( srs->sr_state.sids ) {
+				slap_sl_free( srs->sr_state.sids, op->o_tmpmemctx );
+				srs->sr_state.sids = NULL;
+			}
+			srs->sr_state.numcsns = 0;
 		} else {
 			gotstate = 1;
 			/* If changed and doing Present lookup, send Present UUIDs */
-- 
GitLab