]> git.sur5r.net Git - openldap/commitdiff
ITS#7930 partial fix
authorhyc <hyc@openldap.org>
Sat, 6 Sep 2014 08:14:46 +0000 (09:14 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Mon, 8 Sep 2014 16:34:01 +0000 (11:34 -0500)
Only restore op->o_req_dn if no one else changed it on us.

servers/slapd/back-ldap/chain.c

index 0545568e6080b506ef260219dc30960adf7bd6f2..bd7cb7c552bad0b220d54f297fef2dc35331c49d 100644 (file)
@@ -624,6 +624,11 @@ cleanup:;
                }
 
 further_cleanup:;
+               if ( op->o_req_dn.bv_val == pdn.bv_val ) {
+                       op->o_req_dn = odn;
+                       op->o_req_ndn = ondn;
+               }
+
                if ( free_dn ) {
                        op->o_tmpfree( pdn.bv_val, op->o_tmpmemctx );
                        op->o_tmpfree( ndn.bv_val, op->o_tmpmemctx );
@@ -649,9 +654,6 @@ further_cleanup:;
                rc = rs2.sr_err;
        }
 
-       op->o_req_dn = odn;
-       op->o_req_ndn = ondn;
-
 #ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
        (void)chaining_control_remove( op, &ctrls );
 #endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
@@ -895,14 +897,16 @@ cleanup:;
                }
                
 further_cleanup:;
+               if ( op->o_req_dn.bv_val == pdn.bv_val ) {
+                       op->o_req_dn = odn;
+                       op->o_req_ndn = ondn;
+               }
+
                if ( free_dn ) {
                        op->o_tmpfree( pdn.bv_val, op->o_tmpmemctx );
                        op->o_tmpfree( ndn.bv_val, op->o_tmpmemctx );
                }
 
-               op->o_req_dn = odn;
-               op->o_req_ndn = ondn;
-
                if ( tmp_oq_search.rs_filter != NULL ) {
                        filter_free_x( op, tmp_oq_search.rs_filter, 1 );
                }
@@ -925,8 +929,6 @@ further_cleanup:;
        (void)chaining_control_remove( op, &ctrls );
 #endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
 
-       op->o_req_dn = odn;
-       op->o_req_ndn = ondn;
        rs->sr_type = REP_SEARCHREF;
        rs->sr_entry = save_entry;
        rs->sr_flags = save_flags;