]> git.sur5r.net Git - openldap/commitdiff
fix subtree rename integrity; curiously enough, tes023 only failed on 64 bit arch...
authorPierangelo Masarati <ando@openldap.org>
Wed, 22 Aug 2007 17:46:55 +0000 (17:46 +0000)
committerPierangelo Masarati <ando@openldap.org>
Wed, 22 Aug 2007 17:46:55 +0000 (17:46 +0000)
servers/slapd/overlays/refint.c

index 3f8d91123a0a972d5cc0ce07756239bad39abc93..4afc7204e17ac64a878cf3797c86e25a75d2ddd8 100644 (file)
@@ -414,12 +414,15 @@ refint_search_cb(
                                        if ( !BER_BVISEMPTY( &rq->newdn ) &&
                                                b[i].bv_len != rq->oldndn.bv_len )
                                        {
-                                               struct berval   newsub, newdn;
+                                               struct berval   newsub, newdn, olddn, oldndn;
 
                                                /* if not first, save first as well */
                                                if ( first != -1 ) {
-                                                       ber_bvarray_add_x( &na->old_vals, &a->a_vals[first], op->o_tmpmemctx );
-                                                       ber_bvarray_add_x( &na->old_nvals, &a->a_nvals[first], op->o_tmpmemctx );
+
+                                                       ber_dupbv_x( &olddn, &a->a_vals[first], op->o_tmpmemctx );
+                                                       ber_bvarray_add_x( &na->old_vals, &olddn, op->o_tmpmemctx );
+                                                       ber_dupbv_x( &oldndn, &a->a_nvals[first], op->o_tmpmemctx );
+                                                       ber_bvarray_add_x( &na->old_nvals, &oldndn, op->o_tmpmemctx );
 
                                                        newsub = a->a_vals[first];
                                                        newsub.bv_len -= rq->olddn.bv_len + 1;
@@ -438,8 +441,10 @@ refint_search_cb(
                                                        first = -1;
                                                }
 
-                                               ber_bvarray_add_x( &na->old_vals, &a->a_vals[i], op->o_tmpmemctx );
-                                               ber_bvarray_add_x( &na->old_nvals, &a->a_nvals[i], op->o_tmpmemctx );
+                                               ber_dupbv_x( &olddn, &a->a_vals[i], op->o_tmpmemctx );
+                                               ber_bvarray_add_x( &na->old_vals, &olddn, op->o_tmpmemctx );
+                                               ber_dupbv_x( &oldndn, &a->a_nvals[i], op->o_tmpmemctx );
+                                               ber_bvarray_add_x( &na->old_nvals, &oldndn, op->o_tmpmemctx );
 
                                                newsub = a->a_vals[i];
                                                newsub.bv_len -= rq->olddn.bv_len + 1;