/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 1999-2007 The OpenLDAP Foundation.
+ * Copyright 1999-2008 The OpenLDAP Foundation.
* Portions Copyright 2001-2003 Pierangelo Masarati.
* Portions Copyright 1999-2003 Howard Chu.
* All rights reserved.
* Debug stuff (got it from libavl)
*/
#if META_BACK_PRINT_CONNTREE > 0
+static void
+meta_back_print( metaconn_t *mc, char *avlstr )
+{
+ int i;
+
+ fputs( "targets=[", stderr );
+ for ( i = 0; i < mc->mc_info->mi_ntargets; i++ ) {
+ fputc( mc->mc_conns[ i ].msc_ld ? '*' : 'o', stderr);
+ }
+ fputc( ']', stderr );
+
+ fprintf( stderr, " mc=%p local=\"%s\" conn=%p refcnt=%d%s %s\n",
+ (void *)mc,
+ mc->mc_local_ndn.bv_val ? mc->mc_local_ndn.bv_val : "",
+ (void *)mc->mc_conn,
+ mc->mc_refcnt,
+ LDAP_BACK_CONN_TAINTED( mc ) ? " tainted" : "",
+ avlstr );
+}
+
static void
meta_back_ravl_print( Avlnode *root, int depth )
{
int i;
- metaconn_t *mc;
-
+
if ( root == 0 ) {
return;
}
for ( i = 0; i < depth; i++ ) {
fprintf( stderr, "-" );
}
+ fputc( ' ', stderr );
+
+ meta_back_print( (metaconn_t *)root->avl_data,
+ avl_bf2str( root->avl_bf ) );
- mc = (metaconn_t *)root->avl_data;
- fprintf( stderr, "mc=%p local=\"%s\" conn=%p %s refcnt=%d%s\n",
- (void *)mc,
- mc->mc_local_ndn.bv_val ? mc->mc_local_ndn.bv_val : "",
- (void *)mc->mc_conn,
- avl_bf2str( root->avl_bf ), mc->mc_refcnt,
- LDAP_BACK_CONN_TAINTED( mc ) ? " tainted" : "" );
-
meta_back_ravl_print( root->avl_left, depth + 1 );
}
LDAP_TAILQ_FOREACH( mc, &mi->mi_conn_priv[ c ].mic_priv, mc_q )
{
- fprintf( stderr, " [%d] mc=%p local=\"%s\" conn=%p refcnt=%d flags=0x%08x\n",
- i,
- (void *)mc,
- mc->mc_local_ndn.bv_val ? mc->mc_local_ndn.bv_val : "",
- (void *)mc->mc_conn, mc->mc_refcnt, mc->msc_mscflags );
+ fprintf( stderr, " [%d] ", i );
+ meta_back_print( mc, "" );
i++;
}
}
* don't return the connection */
if ( mt->mt_isquarantined ) {
slap_retry_info_t *ri = &mt->mt_quarantine;
- int dont_retry = 1;
+ int dont_retry = 0;
if ( mt->mt_quarantine.ri_interval ) {
ldap_pvt_thread_mutex_lock( &mt->mt_quarantine_mutex );
- if ( mt->mt_isquarantined == LDAP_BACK_FQ_YES ) {
+ dont_retry = ( mt->mt_isquarantined > LDAP_BACK_FQ_NO );
+ if ( dont_retry ) {
dont_retry = ( ri->ri_num[ ri->ri_idx ] == SLAP_RETRYNUM_TAIL
|| slap_get_time() < ri->ri_last + ri->ri_interval[ ri->ri_idx ] );
if ( !dont_retry ) {
Debug( LDAP_DEBUG_ANY, "%s %s.\n",
op->o_log_prefix, buf, 0 );
}
+
+ mt->mt_isquarantined = LDAP_BACK_FQ_RETRYING;
}
- mt->mt_isquarantined = LDAP_BACK_FQ_RETRYING;
}
ldap_pvt_thread_mutex_unlock( &mt->mt_quarantine_mutex );
}
op2.ors_slimit = 1;
op2.ors_tlimit = SLAP_NO_LIMIT;
- op2.ors_filter = slap_filter_objectClass_pres;
+ op2.ors_filter = (Filter *)slap_filter_objectClass_pres;
op2.ors_filterstr = *slap_filterstr_objectClass_pres;
op2.o_callback = &cb2;
data = (void *)mc;
ldap_pvt_thread_pool_setkey( op->o_threadctx,
&meta_back_candidates_dummy, data,
- meta_back_candidates_keyfree );
+ meta_back_candidates_keyfree,
+ NULL, NULL );
} else {
mi->mi_candidates = mc;
case LDAP_REQ_BIND:
/* if bound as rootdn, the backend must bind to all targets
- * with the administrative identity */
+ * with the administrative identity
+ * (unless pseoudoroot-bind-defer is TRUE) */
if ( op->orb_method == LDAP_AUTH_SIMPLE && be_isroot_pw( op ) ) {
op_type = META_OP_REQUIRE_ALL;
}
rs, mc, i, LDAP_BACK_CONN_ISPRIV( &mc_curr ),
LDAP_BACK_DONTSEND, !new_conn );
if ( candidates[ i ].sr_err == LDAP_SUCCESS ) {
+ if ( new_conn && ( sendok & LDAP_BACK_BINDING ) ) {
+ LDAP_BACK_CONN_BINDING_SET( &mc->mc_conns[ i ] );
+ }
META_CANDIDATE_SET( &candidates[ i ] );
ncandidates++;
return NULL;
}
+ if ( new_conn && ( sendok & LDAP_BACK_BINDING ) ) {
+ LDAP_BACK_CONN_BINDING_SET( &mc->mc_conns[ i ] );
+ }
+
candidates[ i ].sr_err = LDAP_SUCCESS;
META_CANDIDATE_SET( &candidates[ i ] );
ncandidates++;
}
#if META_BACK_PRINT_CONNTREE > 0
- meta_back_print_conntree( mi, ">>> meta_back_getconn" );
+ meta_back_print_conntree( mi, "<<< meta_back_getconn" );
#endif /* META_BACK_PRINT_CONNTREE */
ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex );