/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2003-2013 The OpenLDAP Foundation.
+ * Copyright 2003-2015 The OpenLDAP Foundation.
* Portions Copyright 2003 Howard Chu.
* All rights reserved.
*
* added by the chain overlay, so it's the only one we explicitly
* free */
if ( op->o_ctrls != oldctrls ) {
- assert( op->o_ctrls != NULL );
- assert( op->o_ctrls[ 0 ] != NULL );
+ if ( op->o_ctrls != NULL ) {
+ assert( op->o_ctrls[ 0 ] != NULL );
- free( op->o_ctrls );
+ free( op->o_ctrls );
- op->o_chaining = 0;
+ op->o_chaining = 0;
+ }
op->o_ctrls = oldctrls;
}
/* back-ldap tried to send result */
lb->lb_status = LDAP_CH_RES;
+ /* don't let other callbacks run, this isn't
+ * the real result for this op.
+ */
+ op->o_callback->sc_next = NULL;
}
return 0;
}
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 );
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 */
}
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 );
}
(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;
li = ca->be->be_private;
-
- li->li_uri = ch_strdup( at->a_vals[ 0 ].bv_val );
- value_add_one( &li->li_bvuri, &at->a_vals[ 0 ] );
- if ( avl_insert( &lc->lc_lai.lai_tree, (caddr_t)li,
- ldap_chain_uri_cmp, ldap_chain_uri_dup ) )
- {
- Debug( LDAP_DEBUG_ANY, "slapd-chain: "
- "database \"%s\" insert failed.\n",
- e->e_name.bv_val, 0, 0 );
- rc = LDAP_CONSTRAINT_VIOLATION;
- goto done;
+ if ( at ) {
+ li->li_uri = ch_strdup( at->a_vals[ 0 ].bv_val );
+ value_add_one( &li->li_bvuri, &at->a_vals[ 0 ] );
+ if ( avl_insert( &lc->lc_lai.lai_tree, (caddr_t)li,
+ ldap_chain_uri_cmp, ldap_chain_uri_dup ) )
+ {
+ Debug( LDAP_DEBUG_ANY, "slapd-chain: "
+ "database \"%s\" insert failed.\n",
+ e->e_name.bv_val, 0, 0 );
+ rc = LDAP_CONSTRAINT_VIOLATION;
+ goto done;
+ }
}
ca->ca_private = on;