return -1;
}
- if ( monitor_cache_get( mi, &ms->mss_ndn, &e_backend ) )
- {
+ if ( monitor_cache_get( mi, &ms->mss_ndn, &e_backend ) ) {
Debug( LDAP_DEBUG_ANY,
"monitor_subsys_backend_init: "
"unable to get entry \"%s\"\n",
i = -1;
LDAP_STAILQ_FOREACH( bi, &backendInfo, bi_next ) {
char buf[ BACKMONITOR_BUFSIZE ];
- BackendDB *be;
+ BackendDB *be;
struct berval bv;
int j;
Entry *e;
assert( ndn != NULL );
assert( ep != NULL );
+ *ep = NULL;
+
tmp_mc.mc_ndn = *ndn;
ldap_pvt_thread_mutex_lock( &mi->mi_cache_mutex );
mc = ( monitor_cache_t * )avl_find( mi->mi_cache,
if ( mc != NULL ) {
/* entry is returned with mutex locked */
monitor_cache_lock( mc->mc_e );
- ldap_pvt_thread_mutex_unlock( &mi->mi_cache_mutex );
*ep = mc->mc_e;
-
- return( 0 );
}
-
+
ldap_pvt_thread_mutex_unlock( &mi->mi_cache_mutex );
- *ep = NULL;
- return( -1 );
+ return ( *ep == NULL ? -1 : 0 );
}
/*
monitor_back_db_init(
BackendDB *be )
{
- monitor_info_t *mi;
int rc;
struct berval dn, ndn;
struct berval bv;
rc = dnNormalize( 0, NULL, NULL, &dn, &ndn, NULL );
if( rc != LDAP_SUCCESS ) {
Debug( LDAP_DEBUG_ANY,
- "unable to normalize monitor DN \"%s\"\n",
- SLAPD_MONITOR_DN, 0, 0 );
+ "unable to normalize monitor DN \"%s\" (%d)\n",
+ dn.bv_val, rc, 0 );
return -1;
}
/* NOTE: only one monitor database is allowed,
* so we use static storage */
- mi = &monitor_info;
-
- ldap_pvt_thread_mutex_init( &mi->mi_cache_mutex );
+ ldap_pvt_thread_mutex_init( &monitor_info.mi_cache_mutex );
- be->be_private = mi;
+ be->be_private = &monitor_info;
return 0;
}