/* $OpenLDAP$ */
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
- * Copyright 2001-2007 The OpenLDAP Foundation.
+ * Copyright 2001-2011 The OpenLDAP Foundation.
* Portions Copyright 2001-2003 Pierangelo Masarati.
* All rights reserved.
*
slap_overinst *el_on;
Entry *el_e;
Attribute *el_a;
- struct berval el_ndn;
+ struct berval *el_ndn;
struct berval el_nbase;
int el_scope;
struct berval el_filter;
return -1;
}
-int
-monitor_back_register_overlay(
- BackendDB *be )
-{
- return -1;
-}
-
int
monitor_back_register_backend_limbo(
BackendInfo *bi )
int
monitor_back_register_database_limbo(
- BackendDB *be )
+ BackendDB *be,
+ struct berval *ndn_out )
{
entry_limbo_t **elpp, el = { 0 };
monitor_info_t *mi;
el.el_type = LIMBO_DATABASE;
- el.el_be = be;
+ el.el_be = be->bd_self;
+ el.el_ndn = ndn_out;
for ( elpp = &mi->mi_entry_limbo;
*elpp;
int
monitor_back_register_overlay_limbo(
- BackendDB *be )
+ BackendDB *be,
+ struct slap_overinst *on,
+ struct berval *ndn_out )
{
- return -1;
+ entry_limbo_t **elpp, el = { 0 };
+ monitor_info_t *mi;
+
+ if ( be_monitor == NULL ) {
+ Debug( LDAP_DEBUG_ANY,
+ "monitor_back_register_overlay_limbo: "
+ "monitor database not configured.\n",
+ 0, 0, 0 );
+ return -1;
+ }
+
+ mi = ( monitor_info_t * )be_monitor->be_private;
+
+
+ el.el_type = LIMBO_OVERLAY;
+
+ el.el_be = be->bd_self;
+ el.el_on = on;
+ el.el_ndn = ndn_out;
+
+ for ( elpp = &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
OperationBuffer opbuf;
Operation *op;
void *thrctx;
- SlapReply rs = { 0 };
+ SlapReply rs = { REP_RESULT };
slap_callback cb = { NULL, monitor_search2ndn_cb, NULL, NULL };
int rc;
}
thrctx = ldap_pvt_thread_pool_context();
- connection_fake_init( &conn, &opbuf, thrctx );
+ connection_fake_init2( &conn, &opbuf, thrctx, 0 );
op = &opbuf.ob_op;
op->o_tag = LDAP_REQ_SEARCH;
cleanup:;
if ( op->ors_filter != NULL ) {
- filter_free_x( op, op->ors_filter );
+ filter_free_x( op, op->ors_filter, 1 );
}
if ( !BER_BVISNULL( &op->ors_filterstr ) ) {
op->o_tmpfree( op->ors_filterstr.bv_val, op->o_tmpmemctx );
entry_limbo_t **elpp, el = { 0 };
el.el_type = LIMBO_ATTRS;
- if ( !BER_BVISNULL( &ndn ) ) {
- ber_dupbv( &el.el_ndn, &ndn );
- }
+ el.el_ndn = ndn_in;
if ( !BER_BVISNULL( nbase ) ) {
ber_dupbv( &el.el_nbase, nbase);
}
*elpp = (entry_limbo_t *)ch_malloc( sizeof( entry_limbo_t ) );
if ( *elpp == NULL ) {
- el.el_e->e_private = NULL;
- entry_free( el.el_e );
- return -1;
- }
-
- if ( *elpp != NULL ) {
- el.el_next = NULL;
- **elpp = el;
-
- } else {
if ( !BER_BVISNULL( &el.el_filter ) ) {
ch_free( el.el_filter.bv_val );
}
if ( !BER_BVISNULL( &el.el_nbase ) ) {
ch_free( &el.el_nbase.bv_val );
}
- if ( !BER_BVISNULL( &el.el_ndn ) ) {
- ch_free( el.el_ndn.bv_val );
- }
return -1;
}
+
+ el.el_next = NULL;
+ **elpp = el;
}
return 0;
"SINGLE-VALUE "
"USAGE dSAOperation )", SLAP_AT_HIDE,
offsetof(monitor_info_t, mi_ad_monitorRuntimeConfig) },
+ { "( 1.3.6.1.4.1.4203.666.1.55.30 "
+ "NAME 'monitorSuperiorDN' "
+ "DESC 'monitor superior DN' "
+ /* "SUP distinguishedName " */
+ "EQUALITY distinguishedNameMatch "
+ "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 "
+ "NO-USER-MODIFICATION "
+ "USAGE dSAOperation )", SLAP_AT_FINAL|SLAP_AT_HIDE,
+ offsetof(monitor_info_t, mi_ad_monitorSuperiorDN) },
{ NULL, 0, -1 }
};
bi->bi_extended = 0;
- bi->bi_entry_release_rw = 0;
+ bi->bi_entry_release_rw = monitor_back_release;
bi->bi_chk_referrals = 0;
bi->bi_operational = monitor_back_operational;
bi->bi_tool_entry_open = 0;
bi->bi_tool_entry_close = 0;
bi->bi_tool_entry_first = 0;
+ bi->bi_tool_entry_first_x = 0;
bi->bi_tool_entry_next = 0;
bi->bi_tool_entry_get = 0;
bi->bi_tool_entry_put = 0;
if ( el->el_a ) {
attrs_free( el->el_a );
}
- if ( !BER_BVISNULL( &el->el_ndn ) ) {
- ber_memfree( el->el_ndn.bv_val );
- }
if ( !BER_BVISNULL( &el->el_nbase ) ) {
ber_memfree( el->el_nbase.bv_val );
}
monitor_entry_t *mp;
int i;
struct berval bv, rdn = BER_BVC(SLAPD_MONITOR_DN);
- struct tm *tms;
-#ifdef HAVE_GMTIME_R
- struct tm tm_buf;
-#endif
+ struct tm tms;
static char tmbuf[ LDAP_LUTIL_GENTIME_BUFSIZE ];
struct berval desc[] = {
BER_BVC("This subtree contains monitoring/managing objects."),
/*
* Start
*/
-#ifndef HAVE_GMTIME_R
- ldap_pvt_thread_mutex_lock( &gmtime_mutex );
-#endif
-#ifdef HACK_LOCAL_TIME
-# ifdef HAVE_LOCALTIME_R
- tms = localtime_r( &starttime, &tm_buf );
-# else
- tms = localtime( &starttime );
-# endif /* HAVE_LOCALTIME_R */
- lutil_localtime( tmbuf, sizeof(tmbuf), tms, -timezone );
-#else /* !HACK_LOCAL_TIME */
-# ifdef HAVE_GMTIME_R
- tms = gmtime_r( &starttime, &tm_buf );
-# else
- tms = gmtime( &starttime );
-# endif /* HAVE_GMTIME_R */
- lutil_gentime( tmbuf, sizeof(tmbuf), tms );
-#endif /* !HACK_LOCAL_TIME */
-#ifndef HAVE_GMTIME_R
- ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
-#endif
+ ldap_pvt_gmtime( &starttime, &tms );
+ lutil_gentime( tmbuf, sizeof(tmbuf), &tms );
mi->mi_startTime.bv_val = tmbuf;
mi->mi_startTime.bv_len = strlen( tmbuf );
* opens the monitor backend subsystems
*/
for ( ms = monitor_subsys; ms[ 0 ] != NULL; ms++ ) {
- if ( ms[ 0 ]->mss_open && ( *ms[ 0 ]->mss_open )( be, ms[ 0 ] ) )
- {
+ if ( ms[ 0 ]->mss_open && ms[ 0 ]->mss_open( be, ms[ 0 ] ) ) {
return( -1 );
}
ms[ 0 ]->mss_flags |= MONITOR_F_OPENED;
case LIMBO_ATTRS:
rc = monitor_back_register_entry_attrs(
- &el->el_ndn,
+ el->el_ndn,
el->el_a,
el->el_cb,
&el->el_nbase,
case LIMBO_CB:
rc = monitor_back_register_entry_callback(
- &el->el_ndn,
+ el->el_ndn,
el->el_cb,
&el->el_nbase,
el->el_scope,
break;
case LIMBO_DATABASE:
- rc = monitor_back_register_database( el->el_be );
+ rc = monitor_back_register_database( el->el_be, el->el_ndn );
break;
case LIMBO_OVERLAY_INFO:
break;
case LIMBO_OVERLAY:
- rc = monitor_back_register_overlay( el->el_be );
+ rc = monitor_back_register_overlay( el->el_be, el->el_on, el->el_ndn );
break;
default: