From b9e780e94aad0565f2849397240ada1481c68b58 Mon Sep 17 00:00:00 2001 From: Quanah Gibson-Mount Date: Tue, 12 Feb 2008 01:42:33 +0000 Subject: [PATCH] ITS#5362 --- CHANGES | 1 + servers/slapd/ctxcsn.c | 5 +++++ servers/slapd/syncrepl.c | 19 +++++++++++++++---- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 733b0bc57b..88d1080755 100644 --- a/CHANGES +++ b/CHANGES @@ -25,6 +25,7 @@ OpenLDAP 2.4.8 Engineering Fixed slapd segv with SASL/OTP (ITS#5259) Fixed slapd cn=config crash on delete (ITS#5343) Fixed slapd cn=config global acls (ITS#5352) + Fixed slapd truncated cookie (ITS#5362) Fixed slapd str2entry with no attrs (ITS#5308) Fixed slapd-bdb crash with modrdn (ITS#5358) Fixed slapd-bdb segv with bdb4.6 (ITS#5322) diff --git a/servers/slapd/ctxcsn.c b/servers/slapd/ctxcsn.c index 493e972ec8..a5958be6b3 100644 --- a/servers/slapd/ctxcsn.c +++ b/servers/slapd/ctxcsn.c @@ -99,6 +99,8 @@ slap_graduate_commit_csn( Operation *op ) if ( csne->ce_opid == op->o_opid && csne->ce_connid == op->o_connid ) { LDAP_TAILQ_REMOVE( op->o_bd->be_pending_csn_list, csne, ce_csn_link ); + Debug( LDAP_DEBUG_SYNC, "slap_graduate_commit_csn: removing %p %s\n", + csne->ce_csn.bv_val, csne->ce_csn.bv_val, 0 ); if ( op->o_csn.bv_val == csne->ce_csn.bv_val ) { BER_BVZERO( &op->o_csn ); } @@ -162,6 +164,9 @@ slap_queue_csn( pending = (struct slap_csn_entry *) ch_calloc( 1, sizeof( struct slap_csn_entry )); + + Debug( LDAP_DEBUG_SYNC, "slap_queue_csn: queing %p %s\n", csn->bv_val, csn->bv_val, 0 ); + ldap_pvt_thread_mutex_lock( op->o_bd->be_pcl_mutexp ); ber_dupbv( &pending->ce_csn, csn ); diff --git a/servers/slapd/syncrepl.c b/servers/slapd/syncrepl.c index 1f3f86a9ef..e5f732f446 100644 --- a/servers/slapd/syncrepl.c +++ b/servers/slapd/syncrepl.c @@ -811,6 +811,19 @@ do_syncrep2( if ( !BER_BVISNULL( &syncCookie.octet_str ) ) { slap_parse_sync_cookie( &syncCookie, NULL ); + if ( syncCookie.ctxcsn ) { + int i, sid = slap_parse_csn_sid( syncCookie.ctxcsn ); + for ( i =0; isi_cookieState->cs_num; i++ ) { + if ( si->si_cookieState->cs_sids[i] == sid && + ber_bvcmp( syncCookie.ctxcsn, &si->si_cookieState->cs_vals[i] ) <= 0 ) { + Debug( LDAP_DEBUG_SYNC, "do_syncrep2: %s CSN too old, ignoring %s\n", + si->si_ridtxt, syncCookie.ctxcsn->bv_val, 0 ); + ldap_controls_free( rctrls ); + rc = 0; + goto done; + } + } + } } } rc = 0; @@ -2708,7 +2721,6 @@ syncrepl_updateCookie( } ldap_pvt_thread_mutex_unlock( &si->si_cookieState->cs_mutex ); - slap_graduate_commit_csn( op ); op->o_bd = be; op->o_tmpfree( op->o_csn.bv_val, op->o_tmpmemctx ); BER_BVZERO( &op->o_csn ); @@ -2931,10 +2943,9 @@ dn_callback( } else if ( rc == 0 ) { Debug( LDAP_DEBUG_SYNC, "dn_callback : entries have identical CSN " - "%s ours %s, new %s\n", + "%s %s\n", rs->sr_entry->e_name.bv_val, - old->a_vals[0].bv_val, - new->a_vals[0].bv_val ); + old->a_vals[0].bv_val, 0 ); return LDAP_SUCCESS; } } -- 2.39.5