be->be_private = bdb;
be->be_cf_ocs = be->bd_info->bi_cf_ocs;
- rc = bdb_monitor_init( be );
+ rc = bdb_monitor_db_init( be );
return rc;
}
}
/* monitor setup */
- rc = bdb_monitor_open( be );
+ rc = bdb_monitor_db_open( be );
if ( rc != 0 ) {
goto fail;
}
bdb_idl_cache_entry_t *entry, *next_entry;
/* monitor handling */
- (void)bdb_monitor_close( be );
+ (void)bdb_monitor_db_close( be );
bdb->bi_flags &= ~BDB_IS_OPEN;
{
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
+ /* monitor handling */
+ (void)bdb_monitor_db_close( be );
+
if( bdb->bi_dbenv_home ) ch_free( bdb->bi_dbenv_home );
if( bdb->bi_db_config_path ) ch_free( bdb->bi_db_config_path );
int i, rc;
+ /* NOTE: if slap_shutdown != 0, priv might have already been freed */
+
/* Remove objectClass */
mod.sm_op = LDAP_MOD_DELETE;
mod.sm_desc = slap_schema.si_ad_objectClass;
/*
* call from within bdb_initialize()
*/
-int
+static int
bdb_monitor_initialize( void )
{
int i, code;
- BackendInfo *bi;
static int bdb_monitor_initialized = 0;
- bi = backend_info("monitor");
- if ( !bi )
+ if ( backend_info( "monitor" ) == NULL ) {
return -1;
-
- /* register schema here */
+ }
if ( bdb_monitor_initialized++ ) {
return 0;
}
+ /* register schema here */
+
for ( i = 0; s_oid[ i ].name; i++ ) {
char *argv[ 3 ];
* call from within bdb_db_init()
*/
int
-bdb_monitor_init( BackendDB *be )
+bdb_monitor_db_init( BackendDB *be )
{
if ( bdb_monitor_initialize() == LDAP_SUCCESS ) {
+ /* monitoring in back-bdb is on by default */
SLAP_DBFLAGS( be ) |= SLAP_DBFLAG_MONITORING;
}
* call from within bdb_db_open()
*/
int
-bdb_monitor_open( BackendDB *be )
+bdb_monitor_db_open( BackendDB *be )
{
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
Attribute *a, *next;
struct berval suffix, *filter, *base;
char *ptr;
int rc = 0;
- monitor_extra_t *mbe;
+ BackendInfo *mi;
+ monitor_extra_t *mbe;
if ( !SLAP_DBMONITORING( be ) ) {
return 0;
}
- {
- BackendInfo *mi = backend_info( "monitor" );
- if ( !mi || !mi->bi_extra ) {
- SLAP_DBFLAGS( be ) ^= SLAP_DBFLAG_MONITORING;
- return 0;
- }
- mbe = mi->bi_extra;
+ mi = backend_info( "monitor" );
+ if ( !mi || !mi->bi_extra ) {
+ SLAP_DBFLAGS( be ) ^= SLAP_DBFLAG_MONITORING;
+ return 0;
}
+ mbe = mi->bi_extra;
/* don't bother if monitor is not configured */
if ( !mbe->is_configured() ) {
cb = ch_calloc( sizeof( monitor_callback_t ), 1 );
cb->mc_update = bdb_monitor_update;
+#if 0 /* uncomment if required */
cb->mc_modify = bdb_monitor_modify;
+#endif
cb->mc_free = bdb_monitor_free;
cb->mc_private = (void *)bdb;
* call from within bdb_db_close()
*/
int
-bdb_monitor_close( BackendDB *be )
+bdb_monitor_db_close( BackendDB *be )
{
struct bdb_info *bdb = (struct bdb_info *) be->be_private;
if ( !BER_BVISNULL( &bdb->bi_monitor.bdm_filter ) ) {
- BackendInfo *mi = backend_info( "monitor" );
- monitor_extra_t *mbe;
-
- if ( !mi || !mi->bi_extra )
- return 0;
- mbe = mi->bi_extra;
- mbe->unregister_entry_callback( NULL,
- (monitor_callback_t *)bdb->bi_monitor.bdm_cb,
- &bdb->bi_monitor.bdm_nbase,
- bdb->bi_monitor.bdm_scope,
- &bdb->bi_monitor.bdm_filter );
+ BackendInfo *mi = backend_info( "monitor" );
+ monitor_extra_t *mbe;
+
+ if ( mi && &mi->bi_extra ) {
+ mbe = mi->bi_extra;
+ mbe->unregister_entry_callback( NULL,
+ (monitor_callback_t *)bdb->bi_monitor.bdm_cb,
+ &bdb->bi_monitor.bdm_nbase,
+ bdb->bi_monitor.bdm_scope,
+ &bdb->bi_monitor.bdm_filter );
+ }
if ( !BER_BVISNULL( &bdb->bi_monitor.bdm_filter ) ) {
ch_free( bdb->bi_monitor.bdm_filter.bv_val );
* call from within bdb_db_destroy()
*/
int
-bdb_monitor_destroy( BackendDB *be )
+bdb_monitor_db_destroy( BackendDB *be )
{
return 0;
}