cb->mc_free = bdb_monitor_free;
cb->mc_private = (void *)bdb;
- (void)mbe->register_database( be );
-
- rc = mbe->register_entry_attrs( NULL, a, cb,
- base, bdb->bi_monitor.bdm_scope, filter );
+ /* make sure the database is registered; then add monitor attributes */
+ rc = mbe->register_database( be );
+ if ( rc == 0 ) {
+ rc = mbe->register_entry_attrs( NULL, a, cb,
+ base, bdb->bi_monitor.bdm_scope, filter );
+ }
cleanup:;
if ( rc != 0 ) {
*ms_database,
*ms_overlay;
struct berval bv;
+ char buf[ BACKMONITOR_BUFSIZE ];
assert( be_monitor != NULL );
+ if ( !monitor_subsys_is_opened() ) {
+ return monitor_back_register_database_limbo( be );
+ }
+
mi = ( monitor_info_t * )be_monitor->be_private;
ms_backend = monitor_back_get_subsys( SLAPD_MONITOR_BACKEND_NAME );
mp = ( monitor_entry_t * )e_database->e_private;
for ( i = -1, ep = &mp->mp_children; *ep; i++ ) {
+ Attribute *a;
+
+ a = attr_find( (*ep)->e_attrs, slap_schema.si_ad_namingContexts );
+ if ( a ) {
+ int j, k;
+
+ for ( j = 0; !BER_BVISNULL( &a->a_nvals[ j ] ); j++ ) {
+ for ( k = 0; !BER_BVISNULL( &be->be_nsuffix[ k ] ); k++ ) {
+ if ( dn_match( &a->a_nvals[ j ], &be->be_nsuffix[ k ] ) ) {
+ rc = 0;
+ goto done;
+ }
+ }
+ }
+ }
+
mp = ( monitor_entry_t * )(*ep)->e_private;
assert( mp != NULL );
ep = &mp->mp_next;
}
- {
- char buf[ BACKMONITOR_BUFSIZE ];
-
- bv.bv_val = buf;
- bv.bv_len = snprintf( buf, sizeof( buf ), "cn=Database %d", i );
- if ( bv.bv_len >= sizeof( buf ) ) {
- return -1;
- }
-
- rc = monitor_subsys_database_init_one( mi, be,
- ms_database, ms_backend, ms_overlay, &bv, e_database, &ep );
- if ( rc != 0 ) {
- return rc;
- }
+ bv.bv_val = buf;
+ bv.bv_len = snprintf( buf, sizeof( buf ), "cn=Database %d", i );
+ if ( bv.bv_len >= sizeof( buf ) ) {
+ rc = -1;
+ goto done;
}
+ rc = monitor_subsys_database_init_one( mi, be,
+ ms_database, ms_backend, ms_overlay, &bv, e_database, &ep );
+ if ( rc != 0 ) {
+ goto done;
+ }
+
+done:;
monitor_cache_release( mi, e_database );
- return 0;
+ return rc;
}
int
}, { NULL }
};
+int
+monitor_subsys_is_opened( void )
+{
+ return monitor_subsys_opened;
+}
+
int
monitor_back_register_subsys(
monitor_subsys_t *ms )
/* if a subsystem is registered __AFTER__ subsystem
* initialization (depending on the sequence the databases
* are listed in slapd.conf), init it */
- if ( monitor_subsys_opened ) {
+ if ( monitor_subsys_is_opened() ) {
/* FIXME: this should only be possible
* if be_monitor is already initialized */
LIMBO_ENTRY,
LIMBO_ENTRY_PARENT,
LIMBO_ATTRS,
- LIMBO_CB
+ LIMBO_CB,
+ LIMBO_BACKEND,
+ LIMBO_DATABASE,
+ LIMBO_OVERLAY_INFO,
+ LIMBO_OVERLAY,
+
+ LIMBO_LAST
};
typedef struct entry_limbo_t {
int el_type;
+ BackendInfo *el_bi;
+ BackendDB *el_be;
+ slap_overinst *el_on;
Entry *el_e;
Attribute *el_a;
struct berval el_ndn;
return -1;
}
+int
+monitor_back_register_backend_limbo(
+ BackendInfo *bi )
+{
+ return -1;
+}
+
+int
+monitor_back_register_database_limbo(
+ BackendDB *be )
+{
+ entry_limbo_t **elpp, el = { 0 };
+ monitor_info_t *mi;
+
+ if ( be_monitor == NULL ) {
+ Debug( LDAP_DEBUG_ANY,
+ "monitor_back_register_database_limbo: "
+ "monitor database not configured.\n",
+ 0, 0, 0 );
+ return -1;
+ }
+
+ mi = ( monitor_info_t * )be_monitor->be_private;
+
+
+ el.el_type = LIMBO_DATABASE;
+
+ el.el_be = be;
+
+ for ( elpp = (entry_limbo_t **)&mi->mi_entry_limbo;
+ *elpp;
+ elpp = &(*elpp)->el_next )
+ /* go to last */;
+
+ *elpp = (entry_limbo_t *)ch_malloc( sizeof( entry_limbo_t ) );
+
+ el.el_next = NULL;
+ **elpp = el;
+
+ return 0;
+}
+
+int
+monitor_back_register_overlay_info_limbo(
+ slap_overinst *on )
+{
+ return -1;
+}
+
+int
+monitor_back_register_overlay_limbo(
+ BackendDB *be )
+{
+ return -1;
+}
+
int
monitor_back_register_entry(
Entry *e,
assert( e != NULL );
assert( e->e_private == NULL );
- if ( monitor_subsys_opened ) {
+ if ( monitor_subsys_is_opened() ) {
Entry *e_parent = NULL,
*e_new = NULL,
**ep = NULL;
return -1;
}
- if ( monitor_subsys_opened ) {
+ if ( monitor_subsys_is_opened() ) {
Entry *e_parent = NULL,
*e_new = NULL,
**ep = NULL;
return -1;
}
- if ( monitor_subsys_opened ) {
+ if ( monitor_subsys_is_opened() ) {
Entry *e = NULL;
Attribute **atp = NULL;
monitor_entry_t *mp = NULL;
assert( mi != NULL );
- if ( monitor_subsys_opened ) {
+ if ( monitor_subsys_is_opened() ) {
Entry *e = NULL;
monitor_entry_t *mp = NULL;
monitor_callback_t *cb = NULL;
return -1;
}
- if ( monitor_subsys_opened ) {
+ if ( monitor_subsys_is_opened() ) {
Entry *e = NULL;
monitor_entry_t *mp = NULL;
return -1;
}
- if ( monitor_subsys_opened ) {
+ if ( monitor_subsys_is_opened() ) {
Entry *e = NULL;
monitor_entry_t *mp = NULL;
int freeit = 0;
&el->el_filter );
break;
+ case LIMBO_BACKEND:
+ rc = monitor_back_register_backend( el->el_bi );
+ break;
+
+ case LIMBO_DATABASE:
+ rc = monitor_back_register_database( el->el_be );
+ break;
+
+ case LIMBO_OVERLAY_INFO:
+ rc = monitor_back_register_overlay_info( el->el_on );
+ break;
+
+ case LIMBO_OVERLAY:
+ rc = monitor_back_register_overlay( el->el_be );
+ break;
+
default:
assert( 0 );
}
* init
*/
extern int
+monitor_subsys_is_opened LDAP_P((
+ void ));
+extern int
monitor_back_register_subsys LDAP_P((
monitor_subsys_t *ms ));
extern int
extern int
monitor_back_register_overlay LDAP_P((
BackendDB *be ));
+extern int
+monitor_back_register_backend_limbo LDAP_P((
+ BackendInfo *bi ));
+extern int
+monitor_back_register_database_limbo LDAP_P((
+ BackendDB *be ));
+extern int
+monitor_back_register_overlay_info_limbo LDAP_P((
+ slap_overinst *on ));
+extern int
+monitor_back_register_overlay_limbo LDAP_P((
+ BackendDB *be ));
extern monitor_subsys_t *
monitor_back_get_subsys LDAP_P((
const char *name ));