complete fix to back-ldap (ITS#4315?); not sure dobind should actually be treated as a bind...

This commit is contained in:
Pierangelo Masarati 2006-01-11 12:11:59 +00:00
parent c9ef14afca
commit 0dce854ce4
2 changed files with 26 additions and 9 deletions

View File

@ -620,18 +620,23 @@ done:;
}
void
ldap_back_release_conn(
ldap_back_release_conn_lock(
Operation *op,
SlapReply *rs,
ldapconn_t *lc )
ldapconn_t *lc,
int dolock )
{
ldapinfo_t *li = (ldapinfo_t *)op->o_bd->be_private;
ldap_pvt_thread_mutex_lock( &li->li_conninfo.lai_mutex );
if ( dolock ) {
ldap_pvt_thread_mutex_lock( &li->li_conninfo.lai_mutex );
}
assert( lc->lc_refcnt > 0 );
lc->lc_refcnt--;
LDAP_BACK_CONN_BINDING_CLEAR( lc );
ldap_pvt_thread_mutex_unlock( &li->li_conninfo.lai_mutex );
if ( dolock ) {
ldap_pvt_thread_mutex_unlock( &li->li_conninfo.lai_mutex );
}
}
/*
@ -665,10 +670,20 @@ ldap_back_dobind_int(
while ( lc->lc_refcnt > 1 ) {
ldap_pvt_thread_yield();
if (( rc = LDAP_BACK_CONN_ISBOUND( lc )))
rc = LDAP_BACK_CONN_ISBOUND( lc );
if ( rc ) {
return rc;
}
}
if ( dolock ) {
ldap_pvt_thread_mutex_lock( &li->li_conninfo.lai_mutex );
}
LDAP_BACK_CONN_BINDING_SET( lc );
if ( dolock ) {
ldap_pvt_thread_mutex_unlock( &li->li_conninfo.lai_mutex );
}
/*
* FIXME: we need to let clients use proxyAuthz
* otherwise we cannot do symmetric pools of servers;
@ -785,13 +800,14 @@ retry:;
rc = ldap_back_op_result( lc, op, rs, msgid, 0, sendok );
if ( rc == LDAP_SUCCESS ) {
LDAP_BACK_CONN_ISBOUND_SET( lc );
} else {
ldap_back_release_conn( op, rs, lc );
}
done:;
LDAP_BACK_CONN_BINDING_CLEAR( lc );
rc = LDAP_BACK_CONN_ISBOUND( lc );
if ( !rc ) {
ldap_back_release_conn_lock( op, rs, lc, dolock );
}
return rc;
}

View File

@ -49,7 +49,8 @@ extern BI_entry_get_rw ldap_back_entry_get;
int ldap_back_freeconn( Operation *op, ldapconn_t *lc, int dolock );
ldapconn_t *ldap_back_getconn( Operation *op, SlapReply *rs, ldap_back_send_t sendok );
void ldap_back_release_conn( Operation *op, SlapReply *rs, ldapconn_t *lc );
void ldap_back_release_conn_lock( Operation *op, SlapReply *rs, ldapconn_t *lc, int dolock );
#define ldap_back_release_conn(op, rs, lc) ldap_back_release_conn_lock((op), (rs), (lc), 1)
int ldap_back_dobind( ldapconn_t *lc, Operation *op, SlapReply *rs, ldap_back_send_t sendok );
int ldap_back_retry( ldapconn_t **lcp, Operation *op, SlapReply *rs, ldap_back_send_t sendok );
int ldap_back_map_result( SlapReply *rs );