various cleanup

This commit is contained in:
Pierangelo Masarati 2005-11-01 16:36:17 +00:00
parent 948e19e132
commit 3cb2bc0c56
5 changed files with 14 additions and 34 deletions

View File

@ -380,8 +380,7 @@ retry:;
if ( rs->sr_err == LDAP_UNAVAILABLE && nretries != META_RETRY_NEVER ) {
ldap_pvt_thread_mutex_lock( &mi->mi_conn_mutex );
if ( mc->mc_refcnt == 1 ) {
ldap_unbind_ext_s( msc->msc_ld, NULL, NULL );
msc->msc_ld = NULL;
meta_clear_one_candidate( msc );
LDAP_BACK_CONN_ISBOUND_CLEAR( msc );
( void )rewrite_session_delete( mt->mt_rwmap.rwm_rw, op->o_conn );
@ -558,8 +557,7 @@ retry:;
}
if ( mc->mc_refcnt == 1 ) {
ldap_unbind_ext_s( msc->msc_ld, NULL, NULL );
msc->msc_ld = NULL;
meta_clear_one_candidate( msc );
LDAP_BACK_CONN_ISBOUND_CLEAR( msc );
( void )rewrite_session_delete( mt->mt_rwmap.rwm_rw, op->o_conn );

View File

@ -178,18 +178,18 @@ meta_clear_one_candidate(
metasingleconn_t *msc )
{
if ( msc->msc_ld ) {
ldap_unbind_ext_s( msc->msc_ld, NULL, NULL );
ldap_unbind_ext( msc->msc_ld, NULL, NULL );
msc->msc_ld = NULL;
}
if ( !BER_BVISNULL( &msc->msc_bound_ndn ) ) {
ber_memfree( msc->msc_bound_ndn.bv_val );
ber_memfree_x( msc->msc_bound_ndn.bv_val, NULL );
BER_BVZERO( &msc->msc_bound_ndn );
}
if ( !BER_BVISNULL( &msc->msc_cred ) ) {
memset( msc->msc_cred.bv_val, 0, msc->msc_cred.bv_len );
ber_memfree( msc->msc_cred.bv_val );
ber_memfree_x( msc->msc_cred.bv_val, NULL );
BER_BVZERO( &msc->msc_cred );
}

View File

@ -447,8 +447,7 @@ retry_lock:;
goto retry_lock;
}
ldap_unbind_ext_s( msc->msc_ld, NULL, NULL );
msc->msc_ld = NULL;
meta_clear_one_candidate( msc );
LDAP_BACK_CONN_ISBOUND_CLEAR( msc );
( void )rewrite_session_delete( mt->mt_rwmap.rwm_rw, op->o_conn );

View File

@ -146,21 +146,7 @@ meta_back_conn_free(
ntargets = mc->mc_conns[ 0 ].msc_info->mi_ntargets;
for ( i = 0; i < ntargets; i++ ) {
metasingleconn_t *msc = &mc->mc_conns[ i ];
if ( msc->msc_ld != NULL ) {
ldap_unbind_ext_s( msc->msc_ld, NULL, NULL );
}
if ( !BER_BVISNULL( &msc->msc_bound_ndn ) ) {
ber_memfree( msc->msc_bound_ndn.bv_val );
}
if ( !BER_BVISNULL( &msc->msc_cred ) ) {
/* destroy sensitive data */
memset( msc->msc_cred.bv_val, 0, msc->msc_cred.bv_len );
ber_memfree( msc->msc_cred.bv_val );
}
(void)meta_clear_one_candidate( &mc->mc_conns[ i ] );
}
ldap_pvt_thread_mutex_destroy( &mc->mc_mutex );
@ -235,11 +221,13 @@ meta_back_db_destroy(
* Destroy the per-target stuff (assuming there's at
* least one ...)
*/
for ( i = 0; i < mi->mi_ntargets; i++ ) {
target_free( &mi->mi_targets[ i ] );
}
if ( mi->mi_targets != NULL ) {
for ( i = 0; i < mi->mi_ntargets; i++ ) {
target_free( &mi->mi_targets[ i ] );
}
free( mi->mi_targets );
free( mi->mi_targets );
}
ldap_pvt_thread_mutex_lock( &mi->mi_cache.mutex );
if ( mi->mi_cache.tree ) {

View File

@ -48,6 +48,7 @@ meta_back_conn_destroy(
conn->c_connid, 0, 0 );
mc_curr.mc_conn = conn;
mc_curr.mc_local_ndn = conn->c_ndn;
ldap_pvt_thread_mutex_lock( &mi->mi_conn_mutex );
mc = avl_delete( &mi->mi_conntree, ( caddr_t )&mc_curr,
@ -61,12 +62,6 @@ meta_back_conn_destroy(
assert( mc->mc_refcnt == 0 );
for ( i = 0; i < mi->mi_ntargets; ++i ) {
if ( mc->mc_conns[ i ].msc_ld != NULL ) {
meta_clear_one_candidate( &mc->mc_conns[ i ] );
}
}
meta_back_conn_free( mc );
}