]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9345 fix for cmdline cookie
authorHoward Chu <hyc@openldap.org>
Mon, 14 Sep 2020 22:21:14 +0000 (23:21 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 15 Sep 2020 15:00:57 +0000 (15:00 +0000)
Previous commit could cause cmdline cookie to be ignored

servers/slapd/syncrepl.c

index 65ab22fede8d15fa8804740abbdb9c8c14b128bf..44d83dcd83e37cec487c875c2942c1d96c98d5c7 100644 (file)
@@ -1069,15 +1069,17 @@ do_syncrep1(
                }
                }
 
-               /* ITS#6367: recreate the cookie so it has our SID, not our peer's */
-               ch_free( si->si_syncCookie.octet_str.bv_val );
-               BER_BVZERO( &si->si_syncCookie.octet_str );
-               /* Look for contextCSN from syncprov overlay. */
-               check_syncprov( op, si );
-               if ( BER_BVISNULL( &si->si_syncCookie.octet_str ))
-                       slap_compose_sync_cookie( NULL, &si->si_syncCookie.octet_str,
-                               si->si_syncCookie.ctxcsn, si->si_syncCookie.rid,
-                               si->si_syncCookie.sid, NULL );
+               if ( !cmdline_cookie_found ) {
+                       /* ITS#6367: recreate the cookie so it has our SID, not our peer's */
+                       ch_free( si->si_syncCookie.octet_str.bv_val );
+                       BER_BVZERO( &si->si_syncCookie.octet_str );
+                       /* Look for contextCSN from syncprov overlay. */
+                       check_syncprov( op, si );
+                       if ( BER_BVISNULL( &si->si_syncCookie.octet_str ))
+                               slap_compose_sync_cookie( NULL, &si->si_syncCookie.octet_str,
+                                       si->si_syncCookie.ctxcsn, si->si_syncCookie.rid,
+                                       si->si_syncCookie.sid, NULL );
+               }
        }
 
        Debug( LDAP_DEBUG_SYNC, "do_syncrep1: %s starting refresh (sending cookie=%s)\n",