operational.c \
cache.c entry.c \
backend.c database.c thread.c conn.c rww.c log.c \
- operation.c sent.c listener.c time.c
+ operation.c sent.c listener.c time.c overlay.c
OBJS = init.lo search.lo compare.lo modify.lo bind.lo \
operational.lo \
cache.lo entry.lo \
backend.lo database.lo thread.lo conn.lo rww.lo log.lo \
- operation.lo sent.lo listener.lo time.lo
+ operation.lo sent.lo listener.lo time.lo overlay.lo
LDAP_INCDIR= ../../../include
LDAP_LIBDIR= ../../../libraries
/*
* DNs
*/
+
+#define SLAPD_MONITOR_AT "cn"
+
#define SLAPD_MONITOR_LISTENER 0
#define SLAPD_MONITOR_LISTENER_NAME "Listeners"
#define SLAPD_MONITOR_LISTENER_RDN \
- "cn=" SLAPD_MONITOR_LISTENER_NAME
+ SLAPD_MONITOR_AT "=" SLAPD_MONITOR_LISTENER_NAME
#define SLAPD_MONITOR_LISTENER_DN \
SLAPD_MONITOR_LISTENER_RDN "," SLAPD_MONITOR_DN
#define SLAPD_MONITOR_DATABASE 1
#define SLAPD_MONITOR_DATABASE_NAME "Databases"
#define SLAPD_MONITOR_DATABASE_RDN \
- "cn=" SLAPD_MONITOR_DATABASE_NAME
+ SLAPD_MONITOR_AT "=" SLAPD_MONITOR_DATABASE_NAME
#define SLAPD_MONITOR_DATABASE_DN \
SLAPD_MONITOR_DATABASE_RDN "," SLAPD_MONITOR_DN
#define SLAPD_MONITOR_BACKEND 2
#define SLAPD_MONITOR_BACKEND_NAME "Backends"
#define SLAPD_MONITOR_BACKEND_RDN \
- "cn=" SLAPD_MONITOR_BACKEND_NAME
+ SLAPD_MONITOR_AT "=" SLAPD_MONITOR_BACKEND_NAME
#define SLAPD_MONITOR_BACKEND_DN \
SLAPD_MONITOR_BACKEND_RDN "," SLAPD_MONITOR_DN
#define SLAPD_MONITOR_THREAD 3
#define SLAPD_MONITOR_THREAD_NAME "Threads"
#define SLAPD_MONITOR_THREAD_RDN \
- "cn=" SLAPD_MONITOR_THREAD_NAME
+ SLAPD_MONITOR_AT "=" SLAPD_MONITOR_THREAD_NAME
#define SLAPD_MONITOR_THREAD_DN \
SLAPD_MONITOR_THREAD_RDN "," SLAPD_MONITOR_DN
#define SLAPD_MONITOR_SASL 4
#define SLAPD_MONITOR_SASL_NAME "SASL"
#define SLAPD_MONITOR_SASL_RDN \
- "cn=" SLAPD_MONITOR_SASL_NAME
+ SLAPD_MONITOR_AT "=" SLAPD_MONITOR_SASL_NAME
#define SLAPD_MONITOR_SASL_DN \
SLAPD_MONITOR_SASL_RDN "," SLAPD_MONITOR_DN
#define SLAPD_MONITOR_TLS 5
#define SLAPD_MONITOR_TLS_NAME "TLS"
#define SLAPD_MONITOR_TLS_RDN \
- "cn=" SLAPD_MONITOR_TLS_NAME
+ SLAPD_MONITOR_AT "=" SLAPD_MONITOR_TLS_NAME
#define SLAPD_MONITOR_TLS_DN \
SLAPD_MONITOR_TLS_RDN "," SLAPD_MONITOR_DN
#define SLAPD_MONITOR_CONN 6
#define SLAPD_MONITOR_CONN_NAME "Connections"
#define SLAPD_MONITOR_CONN_RDN \
- "cn=" SLAPD_MONITOR_CONN_NAME
+ SLAPD_MONITOR_AT "=" SLAPD_MONITOR_CONN_NAME
#define SLAPD_MONITOR_CONN_DN \
SLAPD_MONITOR_CONN_RDN "," SLAPD_MONITOR_DN
#define SLAPD_MONITOR_RWW 7
#define SLAPD_MONITOR_RWW_NAME "Waiters"
#define SLAPD_MONITOR_RWW_RDN \
- "cn=" SLAPD_MONITOR_RWW_NAME
+ SLAPD_MONITOR_AT "=" SLAPD_MONITOR_RWW_NAME
#define SLAPD_MONITOR_RWW_DN \
SLAPD_MONITOR_RWW_RDN "," SLAPD_MONITOR_DN
#define SLAPD_MONITOR_LOG 8
#define SLAPD_MONITOR_LOG_NAME "Log"
#define SLAPD_MONITOR_LOG_RDN \
- "cn=" SLAPD_MONITOR_LOG_NAME
+ SLAPD_MONITOR_AT "=" SLAPD_MONITOR_LOG_NAME
#define SLAPD_MONITOR_LOG_DN \
SLAPD_MONITOR_LOG_RDN "," SLAPD_MONITOR_DN
#define SLAPD_MONITOR_OPS 9
#define SLAPD_MONITOR_OPS_NAME "Operations"
#define SLAPD_MONITOR_OPS_RDN \
- "cn=" SLAPD_MONITOR_OPS_NAME
+ SLAPD_MONITOR_AT "=" SLAPD_MONITOR_OPS_NAME
#define SLAPD_MONITOR_OPS_DN \
SLAPD_MONITOR_OPS_RDN "," SLAPD_MONITOR_DN
#define SLAPD_MONITOR_SENT 10
#define SLAPD_MONITOR_SENT_NAME "Statistics"
#define SLAPD_MONITOR_SENT_RDN \
- "cn=" SLAPD_MONITOR_SENT_NAME
+ SLAPD_MONITOR_AT "=" SLAPD_MONITOR_SENT_NAME
#define SLAPD_MONITOR_SENT_DN \
SLAPD_MONITOR_SENT_RDN "," SLAPD_MONITOR_DN
#define SLAPD_MONITOR_TIME 11
#define SLAPD_MONITOR_TIME_NAME "Time"
#define SLAPD_MONITOR_TIME_RDN \
- "cn=" SLAPD_MONITOR_TIME_NAME
+ SLAPD_MONITOR_AT "=" SLAPD_MONITOR_TIME_NAME
#define SLAPD_MONITOR_TIME_DN \
SLAPD_MONITOR_TIME_RDN "," SLAPD_MONITOR_DN
+#define SLAPD_MONITOR_OVERLAY 12
+#define SLAPD_MONITOR_OVERLAY_NAME "Overlay"
+#define SLAPD_MONITOR_OVERLAY_RDN \
+ SLAPD_MONITOR_AT "=" SLAPD_MONITOR_OVERLAY_NAME
+#define SLAPD_MONITOR_OVERLAY_DN \
+ SLAPD_MONITOR_OVERLAY_RDN "," SLAPD_MONITOR_DN
+
struct monitorsubsys {
int mss_type;
char *mss_name;
monitor_subsys_time_update,
NULL, /* create */
NULL, /* modify */
+ }, {
+ SLAPD_MONITOR_OVERLAY, SLAPD_MONITOR_OVERLAY_NAME,
+ BER_BVNULL, BER_BVNULL, BER_BVNULL,
+ MONITOR_F_PERSISTENT_CH,
+ monitor_subsys_overlay_init,
+ NULL, /* update */
+ NULL, /* create */
+ NULL, /* modify */
}, { -1, NULL }
};
--- /dev/null
+/* overlay.c - deals with overlay subsystem */
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 2001-2004 The OpenLDAP Foundation.
+ * Portions Copyright 2001-2003 Pierangelo Masarati.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* ACKNOWLEDGEMENTS:
+ * This work was initially developed by Pierangelo Masarati for inclusion
+ * in OpenLDAP Software.
+ */
+
+
+#include "portable.h"
+
+#include <stdio.h>
+#include <ac/string.h>
+
+#include "slap.h"
+#include "back-monitor.h"
+
+/*
+ * initializes overlay subentries
+ */
+int
+monitor_subsys_overlay_init(
+ BackendDB *be
+)
+{
+ struct monitorinfo *mi;
+ Entry *e, *e_overlay, *e_tmp;
+ int i;
+ struct monitorentrypriv *mp;
+ slap_overinst *on;
+
+ mi = ( struct monitorinfo * )be->be_private;
+
+ if ( monitor_cache_get( mi,
+ &monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn,
+ &e_overlay ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT,
+ "monitor_subsys_overlay_init: "
+ "unable to get entry '%s'\n",
+ monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn.bv_val, 0, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "monitor_subsys_overlay_init: "
+ "unable to get entry '%s'\n%s%s",
+ monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn.bv_val,
+ "", "" );
+#endif
+ return( -1 );
+ }
+
+ e_tmp = NULL;
+ for ( on = overlay_next( NULL ), i = 0; on ; on = overlay_next( on ), i++ ) {
+ char buf[ BACKMONITOR_BUFSIZE ];
+ struct berval bv;
+ int j;
+
+ snprintf( buf, sizeof( buf ),
+ "dn: cn=Overlay %d,%s\n"
+ "objectClass: %s\n"
+ "structuralObjectClass: %s\n"
+ "cn: Overlay %d\n"
+ "createTimestamp: %s\n"
+ "modifyTimestamp: %s\n",
+ i,
+ monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_dn.bv_val,
+ mi->mi_oc_monitoredObject->soc_cname.bv_val,
+ mi->mi_oc_monitoredObject->soc_cname.bv_val,
+ i,
+ mi->mi_startTime.bv_val,
+ mi->mi_startTime.bv_val );
+
+ e = str2entry( buf );
+ if ( e == NULL ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT,
+ "monitor_subsys_overlay_init: "
+ "unable to create entry 'cn=Overlay %d,%s'\n",
+ i, monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn.bv_val, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "monitor_subsys_overlay_init: "
+ "unable to create entry 'cn=Overlay %d,%s'\n%s",
+ i,
+ monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn.bv_val,
+ "" );
+#endif
+ return( -1 );
+ }
+
+ bv.bv_val = on->on_bi.bi_type;
+ bv.bv_len = strlen( bv.bv_val );
+
+ attr_merge_normalize_one( e, mi->mi_ad_monitoredInfo,
+ &bv, NULL );
+ attr_merge_normalize_one( e_overlay, mi->mi_ad_monitoredInfo,
+ &bv, NULL );
+
+ for ( j = 0; j < nBackendDB; j++ ) {
+ BackendDB *be = &backendDB[j];
+ char buf[ SLAP_LDAPDN_MAXLEN ];
+ struct berval dn;
+ slap_overinst *on2;
+
+ if ( strcmp( be->bd_info->bi_type, "over" ) != 0 ) {
+ continue;
+ }
+
+ on2 = ((slap_overinfo *)be->bd_info)->oi_list;
+ for ( ; on2; on2 = on2->on_next ) {
+ if ( on2->on_bi.bi_type == on->on_bi.bi_type ) {
+ break;
+ }
+ }
+
+ if ( on2 == NULL ) {
+ continue;
+ }
+
+ snprintf( buf, sizeof( buf ), "cn=Database %d,%s",
+ j, monitor_subsys[SLAPD_MONITOR_DATABASE].mss_dn.bv_val );
+ dn.bv_val = buf;
+ dn.bv_len = strlen( buf );
+
+ attr_merge_normalize_one( e, mi->mi_ad_seeAlso,
+ &dn, NULL );
+ }
+
+ mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
+ e->e_private = ( void * )mp;
+ mp->mp_next = e_tmp;
+ mp->mp_children = NULL;
+ mp->mp_info = &monitor_subsys[SLAPD_MONITOR_OVERLAY];
+ mp->mp_flags = monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_flags
+ | MONITOR_F_SUB;
+
+ if ( monitor_cache_add( mi, e ) ) {
+#ifdef NEW_LOGGING
+ LDAP_LOG( OPERATION, CRIT,
+ "monitor_subsys_overlay_init: "
+ "unable to add entry 'cn=Overlay %d,%s'\n",
+ i, monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn.bv_val, 0 );
+#else
+ Debug( LDAP_DEBUG_ANY,
+ "monitor_subsys_overlay_init: "
+ "unable to add entry 'cn=Overlay %d,%s'\n%s",
+ i,
+ monitor_subsys[SLAPD_MONITOR_OVERLAY].mss_ndn.bv_val,
+ "" );
+#endif
+ return( -1 );
+ }
+
+ e_tmp = e;
+ }
+
+ mp = ( struct monitorentrypriv * )e_overlay->e_private;
+ mp->mp_children = e_tmp;
+
+ monitor_cache_release( mi, e_overlay );
+
+ return( 0 );
+}
+
int monitor_subsys_ops_init LDAP_P(( BackendDB *be ));
int monitor_subsys_ops_update LDAP_P(( Operation *op, Entry *e ));
+/*
+ * overlay
+ */
+int monitor_subsys_overlay_init LDAP_P(( BackendDB *be ));
+
/*
* sent
*/