if ( rc != LDAP_SUCCESS ) {
rs->sr_err = rc;
}
+ rs->sr_err = slap_map_api2result( rs );
break;
}
}
rc = ldap_parse_result( msc->msc_ld, res, &rs->sr_err,
&matched, &text, &refs, &ctrls, 1 );
res = NULL;
- rs->sr_text = text;
- if ( rc != LDAP_SUCCESS ) {
+ if ( rc == LDAP_SUCCESS ) {
+ rs->sr_text = text;
+ } else {
rs->sr_err = rc;
}
+ rs->sr_err = slap_map_api2result( rs );
/* RFC 4511: referrals can only appear
* if result code is LDAP_REFERRAL */
NULL, NULL, NULL, NULL, 0 );
if ( rc != LDAP_SUCCESS ) {
candidates[ candidate ].sr_err = rc;
-
- } else {
- rc = slap_map_api2result( &candidates[ candidate ] );
}
+ rc = slap_map_api2result( &candidates[ candidate ] );
ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex );
LDAP_BACK_CONN_BINDING_CLEAR( msc );
int is_ok = 0;
void *savepriv;
SlapReply *candidates = NULL;
+ int do_taint = 0;
/*
* controls are set in ldap_back_dobind()
msg,
&candidates[ i ].sr_err,
(char **)&candidates[ i ].sr_matched,
- NULL /* (char **)&candidates[ i ].sr_text */ ,
+ (char **)&candidates[ i ].sr_text,
&references,
NULL /* &candidates[ i ].sr_ctrls (unused) */ ,
0 );
if ( rs->sr_err != LDAP_SUCCESS ) {
+ candidates[ i ].sr_err = rs->sr_err;
sres = slap_map_api2result( &candidates[ i ] );
candidates[ i ].sr_type = REP_RESULT;
ldap_msgfree( res );
if ( rs->sr_nentries == op->ors_slimit
|| META_BACK_ONERR_STOP( mi ) )
{
+ char *save_text = rs->sr_text;
savepriv = op->o_private;
op->o_private = (void *)i;
+ rs->sr_text = candidates[ i ].sr_text;
send_ldap_result( op, rs );
+ rs->sr_text = save_text;
op->o_private = savepriv;
ldap_msgfree( res );
res = NULL;
default:
candidates[ i ].sr_err = rs->sr_err;
if ( META_BACK_ONERR_STOP( mi ) ) {
+ char *save_text = rs->sr_text;
savepriv = op->o_private;
op->o_private = (void *)i;
+ rs->sr_text = candidates[ i ].sr_text;
send_ldap_result( op, rs );
+ rs->sr_text = save_text;
op->o_private = savepriv;
ldap_msgfree( res );
res = NULL;
&& op->o_time > mc->mc_conns[ i ].msc_time )
{
/* don't let anyone else use this expired connection */
- LDAP_BACK_CONN_TAINTED_SET( mc );
+ do_taint++;
}
}
if ( mc ) {
- meta_back_release_conn( mi, mc );
+ ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex );
+ if ( do_taint ) {
+ LDAP_BACK_CONN_TAINTED_SET( mc );
+ }
+ meta_back_release_conn_lock( mi, mc, 0 );
+ ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex );
}
return rs->sr_err;