if ( *lcp == NULL ) {
*lcp = (ldapconn_t *)ch_calloc( 1, sizeof( ldapconn_t ) );
- (*lcp)->lc_flags= li->li_flags;
+ (*lcp)->lc_flags = li->li_flags;
}
(*lcp)->lc_ld = ld;
(*lcp)->lc_refcnt = 1;
Debug( LDAP_DEBUG_TRACE,
"=>ldap_back_getconn: %s.\n", buf, 0, 0 );
}
+
}
#ifdef HAVE_TLS
}
}
+ lc->lc_binding--;
ldap_back_freeconn( op, lc, dolock );
rs->sr_err = slap_map_api2result( rs );
return META_SEARCH_CANDIDATE;
}
- assert( msc->msc_ld != NULL );
-
ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex );
if ( LDAP_BACK_CONN_ISBOUND( msc ) || LDAP_BACK_CONN_ISANON( msc ) ) {
ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex );
}
retry:;
+ assert( msc->msc_ld != NULL );
+
rc = ldap_sasl_bind( msc->msc_ld, binddn, LDAP_SASL_SIMPLE, &cred,
NULL, NULL, &candidates[ candidate ].sr_msgid );
switch ( rc ) {
meta_search_candidate_t retcode = META_SEARCH_NOT_CANDIDATE;
int rc;
- rc = ldap_parse_result( msc->msc_ld, res,
+ assert( msc->msc_ld != NULL );
+
+ rc = ldap_parse_result( msc->msc_ld, res,
&candidates[ candidate ].sr_err,
NULL, NULL, NULL, NULL, 1 );
if ( rc == LDAP_SUCCESS ) {
/* should we check return values? */
if ( op->ors_deref != -1 ) {
- ldap_set_option( msc->msc_ld, LDAP_OPT_DEREF,
+ assert( msc->msc_ld != NULL );
+ (void)ldap_set_option( msc->msc_ld, LDAP_OPT_DEREF,
( void * )&op->ors_deref );
}
continue;
}
- if ( mc ) {
+ if ( mc && candidates[ i ].sr_msgid >= 0 ) {
ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex );
- if ( LDAP_BACK_CONN_BINDING( &mc->mc_conns[ i ] )
- && candidates[ i ].sr_msgid != META_MSGID_NEED_BIND )
- {
+ if ( LDAP_BACK_CONN_BINDING( &mc->mc_conns[ i ] ) ) {
LDAP_BACK_CONN_BINDING_CLEAR( &mc->mc_conns[ i ] );
}
ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex );