complete previous commit (protect binds)

This commit is contained in:
Pierangelo Masarati 2006-04-04 18:45:59 +00:00
parent 6d357288d6
commit e21f57cf05
2 changed files with 19 additions and 1 deletions

View file

@ -577,6 +577,7 @@ retry:;
mt, mc, candidate,
LDAP_BACK_CONN_ISPRIV( mc ),
LDAP_BACK_DONTSEND );
LDAP_BACK_CONN_BINDING_SET( msc );
} else {
/* can't do anything about it */
@ -614,6 +615,7 @@ retry:;
done:;
rs->sr_err = rc;
if ( rc != LDAP_SUCCESS && META_BACK_ONERR_STOP( mi ) ) {
LDAP_BACK_CONN_BINDING_CLEAR( msc );
meta_back_release_conn_lock( op, mc, 1, dolock );
*mcp = NULL;
@ -713,14 +715,23 @@ retry:;
goto send_err;
}
if ( rc == LDAP_UNAVAILABLE && do_retry ) {
do_retry = 0;
if ( meta_back_retry( op, rs, &mc, i, sendok ) ) {
goto retry;
}
ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex );
LDAP_BACK_CONN_BINDING_CLEAR( msc );
ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex );
return 0;
}
ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex );
LDAP_BACK_CONN_BINDING_CLEAR( msc );
ldap_pvt_thread_mutex_unlock( &mi->mi_conninfo.lai_mutex );
snprintf( buf, sizeof( buf ),
"meta_back_dobind[%d]: (%s) err=%d (%s).",
i, rootdn ? rootdn : "anonymous",

View file

@ -488,9 +488,10 @@ meta_back_retry(
{
metainfo_t *mi = ( metainfo_t * )op->o_bd->be_private;
metatarget_t *mt = &mi->mi_targets[ candidate ];
int rc = LDAP_UNAVAILABLE;
metaconn_t *mc = *mcp;
metasingleconn_t *msc = &mc->mc_conns[ candidate ];
int rc = LDAP_UNAVAILABLE,
binding = LDAP_BACK_CONN_BINDING( msc );
ldap_pvt_thread_mutex_lock( &mi->mi_conninfo.lai_mutex );
@ -515,6 +516,9 @@ meta_back_retry(
/* mc here must be the regular mc, reset and ready for init */
rc = meta_back_init_one_conn( op, rs, mt, mc, candidate,
LDAP_BACK_CONN_ISPRIV( mc ), sendok );
if ( binding ) {
LDAP_BACK_CONN_BINDING_SET( msc );
}
if ( rc == LDAP_SUCCESS ) {
rc = meta_back_single_dobind( op, rs, mcp, candidate,
@ -524,6 +528,9 @@ meta_back_retry(
if ( rc != LDAP_SUCCESS ) {
if ( *mcp != NULL ) {
if ( binding ) {
LDAP_BACK_CONN_BINDING_CLEAR( msc );
}
meta_back_release_conn_lock( op, mc, 1, 0 );
*mcp = NULL;
}