]> git.sur5r.net Git - openldap/commitdiff
Syncrepl changes from HEAD
authorKurt Zeilenga <kurt@openldap.org>
Fri, 3 Sep 2004 20:14:17 +0000 (20:14 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Fri, 3 Sep 2004 20:14:17 +0000 (20:14 +0000)
servers/slapd/back-bdb/delete.c
servers/slapd/delete.c
servers/slapd/modrdn.c
servers/slapd/syncrepl.c

index 7843d632c7173650e7bcfb9774adcb36f0d3fef2..18b0c0b1b9a95e743f5705731f4bc00bc23ab74a 100644 (file)
@@ -585,9 +585,9 @@ retry:      /* transaction retry */
                                if( (void *) e->e_attrs != (void *) (e+1)) {
                                        attr_delete( &e->e_attrs, slap_schema.si_ad_entryCSN );
                                        attr_merge_normalize_one( e, slap_schema.si_ad_entryCSN,
-                                       &op->ord_csn, NULL );
+                                       &op->o_sync_csn, NULL );
                                } else {
-                                       a->a_vals[0] = op->ord_csn;
+                                       a->a_vals[0] = op->o_sync_csn;
                                }
                        } else {
                                /* Hm, the entryCSN ought to exist. ??? */
index 7db8a412e6980bc631b4694cdd47d010f65b41ee..8ecc3e4c601f3e8bbdefd3f1250bb50e81cc8cdf 100644 (file)
@@ -214,7 +214,9 @@ do_delete(
                        char csnbuf[ LDAP_LUTIL_CSNSTR_BUFSIZE ];
 
                        if ( !repl_user ) {
-                               slap_get_csn( op, csnbuf, sizeof(csnbuf), &op->ord_csn, 1 );
+                               struct berval csn = BER_BVNULL;
+                               char csnbuf[LDAP_LUTIL_CSNSTR_BUFSIZE];
+                               slap_get_csn( op, csnbuf, sizeof(csnbuf), &csn, 1 );
                        }
 
 #ifdef SLAPD_MULTIMASTER
index 9f184ada3cf73635270e206f8c6907619bd51494..3e76ad1e758e6883cffd1caacbea9c5f43505df9 100644 (file)
@@ -537,7 +537,7 @@ slap_modrdn2mods(
                                desc->ad_type->sat_syntax,
                                desc->ad_type->sat_equality,
                                &mod_tmp->sml_values[0],
-                               &mod_tmp->sml_nvalues[0], op->o_tmpmemctx );
+                               &mod_tmp->sml_nvalues[0], NULL );
                        mod_tmp->sml_nvalues[1].bv_val = NULL;
                } else {
                        mod_tmp->sml_nvalues = NULL;
index ed9d4c3d42710dc05d2915bb0603f1e12540f224..cc6496293a5a5b41084a1b638f48c24a8ac9ad30 100644 (file)
@@ -805,6 +805,9 @@ done:
        slap_sync_cookie_free( &syncCookie, 0 );
        slap_sync_cookie_free( &syncCookie_req, 0 );
 
+       avl_free( si->si_presentlist, avl_ber_bvfree );
+       si->si_presentlist = NULL;
+
        if ( res ) ldap_msgfree( res );
 
        if ( rc && si->si_ld ) {
@@ -1743,21 +1746,24 @@ syncrepl_updateCookie(
        *modtail = mod;
        modtail = &mod->sml_next;
 
-       if ( scbva[0].bv_val ) ch_free( scbva[0].bv_val );
-       ber_dupbv( &scbva[0], &si->si_syncCookie.octet_str[0] );
        mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ));
        mod->sml_op = LDAP_MOD_REPLACE;
-       mod->sml_desc = slap_schema.si_ad_syncreplCookie;
+       mod->sml_desc = slap_schema.si_ad_subtreeSpecification;
        mod->sml_type = mod->sml_desc->ad_cname;
-       mod->sml_values = scbva;
+       mod->sml_values = ssbva;
        *modtail = mod;
        modtail = &mod->sml_next;
 
+       /* Keep this last, so we can avoid touching the previous
+        * attributes unnecessarily.
+        */
+       if ( scbva[0].bv_val ) ch_free( scbva[0].bv_val );
+       ber_dupbv( &scbva[0], &si->si_syncCookie.octet_str[0] );
        mod = (Modifications *) ch_calloc( 1, sizeof( Modifications ));
        mod->sml_op = LDAP_MOD_REPLACE;
-       mod->sml_desc = slap_schema.si_ad_subtreeSpecification;
+       mod->sml_desc = slap_schema.si_ad_syncreplCookie;
        mod->sml_type = mod->sml_desc->ad_cname;
-       mod->sml_values = ssbva;
+       mod->sml_values = scbva;
        *modtail = mod;
        modtail = &mod->sml_next;
 
@@ -1822,7 +1828,8 @@ syncrepl_updateCookie(
        /* update persistent cookie */
 update_cookie_retry:
        op->o_tag = LDAP_REQ_MODIFY;
-       op->orm_modlist = modlist;
+       /* Just modify the cookie value, not the entire entry */
+       op->orm_modlist = mod;
        rc = be->be_modify( op, &rs_modify );
 
        if ( rs_modify.sr_err != LDAP_SUCCESS ) {