ITS#9444 Pass original message when chain-return-error is set

This commit is contained in:
Ondřej Kuzník 2021-03-09 17:29:38 +00:00 committed by Quanah Gibson-Mount
parent 7bc9c29005
commit f78887390a

View File

@ -119,6 +119,7 @@ typedef struct ldap_chain_cb_t {
ldap_chain_status_t lb_status;
ldap_chain_t *lb_lc;
slap_operation_t lb_op_type;
char *lb_text;
int lb_depth;
} ldap_chain_cb_t;
@ -381,6 +382,11 @@ retry:;
break;
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 );
}
lb->lb_text = ber_strdup_x( rs->sr_text, op->o_tmpmemctx );
return rs->sr_err;
}
@ -1153,6 +1159,7 @@ cannot_chain:;
#endif /* LDAP_CONTROL_X_CHAINING_BEHAVIOR */
if ( LDAP_CHAIN_RETURN_ERR( lc ) ) {
sr_err = rs->sr_err = rc;
rs->sr_text = lb.lb_text;
rs->sr_type = sr_type;
} else {
@ -1186,6 +1193,13 @@ dont_chain:;
op->o_callback = sc;
op->o_ndn = ndn;
if ( rs->sr_text == lb.lb_text ) {
rs->sr_text = NULL;
}
if ( lb.lb_text ) {
ber_memfree_x( lb.lb_text, op->o_tmpmemctx );
}
return rc;
}