]> git.sur5r.net Git - openldap/commitdiff
ITS#5362
authorQuanah Gibson-Mount <quanah@openldap.org>
Tue, 12 Feb 2008 01:42:33 +0000 (01:42 +0000)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 12 Feb 2008 01:42:33 +0000 (01:42 +0000)
CHANGES
servers/slapd/ctxcsn.c
servers/slapd/syncrepl.c

diff --git a/CHANGES b/CHANGES
index 733b0bc57b4af71960435f96b53d79982eae28cf..88d1080755b35b443572f4fdd150aab99572cee6 100644 (file)
--- 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)
index 493e972ec86a3736c3a640253041219bc2eba9be..a5958be6b3da38c32d4ebfc627adaa5ba855957a 100644 (file)
@@ -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 );
index 1f3f86a9ef6d5aa7a1f931bddcc868e5e949bc3e..e5f732f446a2e58ae47d5819b2ffa5074b67ca60 100644 (file)
@@ -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; i<si->si_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;
                                        }
                                }