From bb17e23f286592f67c156e62d4c598ab695846ae Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Thu, 9 Dec 2021 17:40:35 +0000 Subject: [PATCH] ITS#9707 syncrepl: don't set lastCookie if none present --- servers/slapd/syncrepl.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index c295f8bdfe..69d288efc9 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -1099,9 +1099,11 @@ do_syncrep1( Debug( LDAP_DEBUG_SYNC, "do_syncrep1: %s starting refresh (sending cookie=%s)\n", si->si_ridtxt, si->si_syncCookie.octet_str.bv_val ); - ldap_pvt_thread_mutex_lock( &si->si_monitor_mutex ); - ber_bvreplace( &si->si_lastCookieSent, &si->si_syncCookie.octet_str ); - ldap_pvt_thread_mutex_unlock( &si->si_monitor_mutex ); + if ( si->si_syncCookie.octet_str.bv_val ) { + ldap_pvt_thread_mutex_lock( &si->si_monitor_mutex ); + ber_bvreplace( &si->si_lastCookieSent, &si->si_syncCookie.octet_str ); + ldap_pvt_thread_mutex_unlock( &si->si_monitor_mutex ); + } rc = ldap_sync_search( si, op->o_tmpmemctx ); -- 2.47.3