- /*
- * database monitor can be defined once only
- */
- if ( be_monitor ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, CRIT,
- "only one monitor backend is allowed\n", 0, 0, 0);
-#else
- Debug( LDAP_DEBUG_ANY,
- "only one monitor backend is allowed\n", 0, 0, 0 );
-#endif
- return( -1 );
- }
- be_monitor = be;
-
- /* indicate system schema supported */
- be->be_flags |= SLAP_BFLAG_MONITOR;
-
- dn.bv_val = SLAPD_MONITOR_DN;
- dn.bv_len = sizeof( SLAPD_MONITOR_DN ) - 1;
-
- rc = dnNormalize( 0, NULL, NULL, &dn, &ndn, NULL );
- if( rc != LDAP_SUCCESS ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, CRIT,
- "unable to normalize monitor DN \"" SLAPD_MONITOR_DN
- "\"\n" , 0, 0, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "unable to normalize monitor DN \"" SLAPD_MONITOR_DN
- "\"\n", 0, 0, 0 );
-#endif
- return -1;
- }
-
- ber_dupbv( &bv, &dn );
- ber_bvarray_add( &be->be_suffix, &bv );
- ber_bvarray_add( &be->be_nsuffix, &ndn );
-
- mi = ( struct monitorinfo * )ch_calloc( sizeof( struct monitorinfo ), 1 );
- if ( mi == NULL ) {
-#ifdef NEW_LOGGING
- LDAP_LOG( OPERATION, CRIT,
- "unable to initialize monitor backend\n", 0, 0, 0 );
-#else
- Debug( LDAP_DEBUG_ANY,
- "unable to initialize monitor backend\n", 0, 0, 0 );
-#endif
- return -1;
- }
-
- memset( mi, 0, sizeof( struct monitorinfo ) );
-
- ldap_pvt_thread_mutex_init( &mi->mi_cache_mutex );
-
- be->be_private = mi;
-
- return 0;
-}
-
-int
-monitor_back_db_open(
- BackendDB *be
-)
-{
- struct monitorinfo *mi = (struct monitorinfo *)be->be_private;
- struct monitorsubsys *ms;
- Entry *e, *e_tmp;
- struct monitorentrypriv *mp;
- int i, k;
- char buf[ BACKMONITOR_BUFSIZE ], *end_of_line;
- const char *text;
- struct berval bv;