From 4dc974c5da00fd70570e7acf9d29ddcece0dd11b Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Sat, 12 Sep 2020 21:38:20 +0100 Subject: [PATCH] ITS#9345 syncrepl: call check_syncprov on freshly started consumer --- servers/slapd/syncrepl.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 3040858adf..ba37f1e581 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -851,22 +851,19 @@ do_syncrep1( } ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex ); } + } - ch_free( si->si_syncCookie.octet_str.bv_val ); - slap_compose_sync_cookie( NULL, &si->si_syncCookie.octet_str, - si->si_syncCookie.ctxcsn, si->si_syncCookie.rid, - si->si_syncCookie.sid ); - } else { - /* 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 ); - } + 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 ); + } si->si_refreshDone = 0; Debug( LDAP_DEBUG_SYNC, "do_syncrep1: %s starting refresh (sending cookie=%s)\n", -- 2.47.2