Commit 0c8afb03 authored by Ondřej Kuzník's avatar Ondřej Kuzník Committed by Quanah Gibson-Mount
Browse files

ITS#9444 Manage sr_ref/sr_matched flags accordingly

send_ldap_response() clears them immediately even if we never attached
the data to be freed, so when we reinstate them, the flags are gone and
the next send_ldap_response() doesn't consider freeing them.
parent f7888739
......@@ -383,8 +383,8 @@ retry:;
default:
/* remember the text before it's freed in ldap_back_op_result */
if ( lb.lb_text ) {
ber_memfree_x( lb.lb_text, op->o_tmpmemctx );
if ( lb->lb_text ) {
ber_memfree_x( lb->lb_text, op->o_tmpmemctx );
}
lb->lb_text = ber_strdup_x( rs->sr_text, op->o_tmpmemctx );
return rs->sr_err;
......@@ -971,6 +971,7 @@ ldap_chain_response( Operation *op, SlapReply *rs )
const char *text = NULL;
const char *matched;
BerVarray ref;
slap_mask_t flags = 0;
struct berval ndn = op->o_ndn;
int sr_err = rs->sr_err;
......@@ -1034,6 +1035,9 @@ ldap_chain_response( Operation *op, SlapReply *rs )
ref = rs->sr_ref;
rs->sr_ref = NULL;
flags = rs->sr_flags & (REP_MATCHED_MUSTBEFREED | REP_REF_MUSTBEFREED);
rs->sr_flags &= ~flags;
/* we need this to know if back-ldap returned any result */
lb.lb_lc = lc;
sc2.sc_next = sc->sc_next;
......@@ -1169,6 +1173,7 @@ cannot_chain:;
rs->sr_text = text;
rs->sr_matched = matched;
rs->sr_ref = ref;
rs->sr_flags |= flags;
}
#ifdef LDAP_CONTROL_X_CHAINING_BEHAVIOR
break;
......@@ -1189,6 +1194,8 @@ dont_chain:;
rs->sr_text = text;
rs->sr_matched = matched;
rs->sr_ref = ref;
rs->sr_flags |= flags;
op->o_bd = bd;
op->o_callback = sc;
op->o_ndn = ndn;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment