monitor_back_get_subsys_by_dn,
monitor_back_register_subsys,
+ monitor_back_register_backend,
+ monitor_back_register_database,
+ monitor_back_register_overlay_info,
+ monitor_back_register_overlay,
monitor_back_register_entry,
monitor_back_register_entry_parent,
monitor_back_register_entry_attrs,
}, { 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 be_monitor != NULL;
}
+int
+monitor_back_register_backend(
+ BackendInfo *bi )
+{
+ return -1;
+}
+
+int
+monitor_back_register_overlay_info(
+ slap_overinst *on )
+{
+ return -1;
+}
+
+int
+monitor_back_register_overlay(
+ BackendDB *be )
+{
+ 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;
Connection conn = { 0 };
OperationBuffer opbuf;
Operation *op;
+ void *thrctx;
SlapReply rs = { 0 };
slap_callback cb = { NULL, monitor_search2ndn_cb, NULL, NULL };
int rc;
}
op = (Operation *) &opbuf;
- connection_fake_init( &conn, op, &conn );
+ thrctx = ldap_pvt_thread_pool_context();
+ connection_fake_init( &conn, op, thrctx );
op->o_tag = LDAP_REQ_SEARCH;
/* use global malloc for now */
if ( op->o_tmpmemctx ) {
- /* FIXME: connection_fake_init() calls slap_sl_mem_create, so we destroy it for now */
- slap_sl_mem_destroy( NULL, op->o_tmpmemctx );
op->o_tmpmemctx = NULL;
}
op->o_tmpmfuncs = &ch_mfuncs;
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;
monitor_subsys_t *ms;
- /*
- * register subsys
- */
- for ( ms = known_monitor_subsys; ms->mss_name != NULL; ms++ ) {
- if ( monitor_back_register_subsys( ms ) ) {
- return -1;
- }
- }
-
/*
* database monitor can be defined once only
*/
}
be_monitor = be;
+ /*
+ * register subsys
+ */
+ for ( ms = known_monitor_subsys; ms->mss_name != NULL; ms++ ) {
+ if ( monitor_back_register_subsys( ms ) ) {
+ return -1;
+ }
+ }
+
/* indicate system schema supported */
SLAP_BFLAGS(be) |= SLAP_BFLAG_MONITOR;
&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 );
}