rc = ldap_result( msc->msc_ld, msgid, LDAP_MSG_ALL, &tv, &res );
switch ( rc ) {
case 0:
-#if 0
- Debug( LDAP_DEBUG_ANY,
- "%s meta_back_bind_op_result[%d]: ldap_result=0 nretries=%d.\n",
- op->o_log_prefix, candidate, nretries );
-#endif
-
if ( nretries != META_RETRY_NEVER
|| ( timeout && slap_get_time() <= stoptime ) )
{
if ( dolock ) {
ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex );
}
-
- if ( META_BACK_ONERR_STOP( mi ) && ( sendok & LDAP_BACK_SENDERR ) ) {
- send_ldap_result( op, rs );
- }
}
if ( META_BACK_TGT_QUARANTINE( mt ) ) {
LDAPMessage *e );
typedef enum meta_search_candidate_t {
+ META_SEARCH_UNDEFINED = -2,
META_SEARCH_ERR = -1,
META_SEARCH_NOT_CANDIDATE,
META_SEARCH_CANDIDATE,
rc = meta_back_init_one_conn( op, rs, mc, candidate,
LDAP_BACK_CONN_ISPRIV( mc ), LDAP_BACK_DONTSEND, 0 );
- LDAP_BACK_CONN_BINDING_SET( msc );
+ if ( rc == LDAP_SUCCESS ) {
+ LDAP_BACK_CONN_BINDING_SET( msc );
+ }
+
ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex );
- goto retry;
+ if ( rc == LDAP_SUCCESS ) {
+ candidates[ candidate ].sr_msgid = META_MSGID_IGNORE;
+ goto retry;
+ }
}
if ( *mcp == NULL ) {
op->o_private = savepriv;
rc = -1;
goto finish;
+
+ default:
+ assert( 0 );
+ break;
}
}
}
for ( i = 0; i < mi->mi_ntargets; i++ ) {
+ meta_search_candidate_t retcode = META_SEARCH_UNDEFINED;
metasingleconn_t *msc = &mc->mc_conns[ i ];
LDAPMessage *res = NULL, *msg;
/* if target still needs bind, retry */
if ( candidates[ i ].sr_msgid == META_MSGID_NEED_BIND ) {
- meta_search_candidate_t retcode;
-
/* initiate dobind */
retcode = meta_search_dobind_init( op, rs, &mc, i, candidates );
candidates[ i ].sr_msgid = META_MSGID_IGNORE;
switch ( meta_back_search_start( op, rs, &dc, &mc, i, candidates ) )
{
- case META_SEARCH_CANDIDATE:
- /* get back into business... */
- continue;
-
/* means that failed but onerr == continue */
case META_SEARCH_NOT_CANDIDATE:
candidates[ i ].sr_msgid = META_MSGID_IGNORE;
+
+ assert( ncandidates > 0 );
--ncandidates;
candidates[ i ].sr_err = rs->sr_err;
op->o_private = savepriv;
goto finish;
}
- break;
+ /* fall thru */
+
+ case META_SEARCH_CANDIDATE:
+ /* get back into business... */
+ continue;
case META_SEARCH_BINDING:
case META_SEARCH_NEED_BIND:
+ case META_SEARCH_UNDEFINED:
assert( 0 );
default:
* the outer cycle finishes
*/
candidates[ i ].sr_msgid = META_MSGID_IGNORE;
+ assert( ncandidates > 0 );
--ncandidates;
} else if ( rc == LDAP_RES_BIND ) {
case META_SEARCH_NOT_CANDIDATE:
case META_SEARCH_ERR:
candidates[ i ].sr_msgid = META_MSGID_IGNORE;
+ assert( ncandidates > 0 );
--ncandidates;
candidates[ i ].sr_err = rs->sr_err;
res = NULL;
goto finish;
}
- break;
+ goto free_message;
default:
assert( 0 );
}
}
+free_message:;
ldap_msgfree( res );
res = NULL;
}