]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9707 syncrepl: don't set lastCookie if none present
authorHoward Chu <hyc@openldap.org>
Thu, 9 Dec 2021 17:40:35 +0000 (17:40 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 13 Dec 2021 17:12:42 +0000 (17:12 +0000)
servers/slapd/syncrepl.c

index 8bc65658810b54d12da18e9c60a3a4826d13f231..bbb2c3572fa19e88b593a26a30cf793d0ba585d0 100644 (file)
@@ -1086,9 +1086,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 );