]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/monitor.c
place old schema codes behind -DSLAPD_SCHEMA_COMPAT
[openldap] / servers / slapd / monitor.c
index 855a2e8dc047852be6fd9064b114e79851f7c99a..935ae28feeb683089363ed97ff53122d6e4943fc 100644 (file)
@@ -1,3 +1,8 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
 /*
  * Copyright (c) 1995 Regents of the University of Michigan.
  * All rights reserved.
 #include <ac/string.h>
 #include <ac/time.h>
 
-#include "ldap_defaults.h"
 #include "slap.h"
 
 #if defined( SLAPD_MONITOR_DN )
 
 void
-monitor_info( Connection *conn, Operation *op )
+monitor_info(
+       Connection *conn,
+       Operation *op,
+       char ** attrs,
+       int attrsonly )
 {
        Entry           *e;
        char            buf[BUFSIZ];
@@ -46,9 +54,24 @@ monitor_info( Connection *conn, Operation *op )
        /* initialize reader/writer lock */
        e->e_attrs = NULL;
        e->e_dn = ch_strdup( SLAPD_MONITOR_DN );
-       e->e_ndn = dn_normalize_case( ch_strdup(SLAPD_MONITOR_DN) );
+       e->e_ndn = ch_strdup(SLAPD_MONITOR_DN);
+       (void) dn_normalize( e->e_ndn );
        e->e_private = NULL;
 
+       {
+               char *rdn = ch_strdup( SLAPD_MONITOR_DN );
+               val.bv_val = strchr( rdn, '=' );
+
+               if( val.bv_val != NULL ) {
+                       *val.bv_val = '\0';
+                       val.bv_len = strlen( ++val.bv_val );
+
+                       attr_merge( e, rdn, vals );
+               }
+
+               free( rdn );
+       }
+
        val.bv_val = (char *) Versionstr;
        if (( p = strchr( Versionstr, '\n' )) == NULL ) {
                val.bv_len = strlen( Versionstr );
@@ -82,19 +105,12 @@ monitor_info( Connection *conn, Operation *op )
                }
 
                ldap_pvt_thread_mutex_lock( &gmtime_mutex );
-#ifndef LDAP_LOCALTIME
+
                ltm = gmtime( &c->c_starttime );
                strftime( buf2, sizeof(buf2), "%Y%m%d%H%M%SZ", ltm );
 
                ltm = gmtime( &c->c_activitytime );
                strftime( buf3, sizeof(buf2), "%Y%m%d%H%M%SZ", ltm );
-#else
-               ltm = localtime( &c->.c_starttime );
-               strftime( buf2, sizeof(buf2), "%y%m%d%H%M%SZ", ltm );
-
-               ltm = localtime( &c->c_activitytime );
-               strftime( buf3, sizeof(buf2), "%y%m%d%H%M%SZ", ltm );
-#endif
 
                ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
 
@@ -104,7 +120,7 @@ monitor_info( Connection *conn, Operation *op )
                        ": %ld/%ld/%ld "
                        ": %s%s%s%s%s%s "
                        ": %s : %s : %s "
-                       ": %s : %s",
+                       ": %s : %s : %s : %s ",
 
                        c->c_connid,
                        (long) c->c_protocol,
@@ -123,8 +139,11 @@ monitor_info( Connection *conn, Operation *op )
                        c->c_bind_in_progress ? "S" : "",
 
                    c->c_cdn ? c->c_cdn : "<anonymous>",
-                   c->c_client_addr ? c->c_client_addr : "unknown",
-                   c->c_client_name ? c->c_client_name : "unknown",
+
+                       c->c_listener_url,
+                   c->c_peer_domain,
+                   c->c_peer_name,
+                   c->c_sock_name,
 
                    buf2,
                        buf3
@@ -206,24 +225,14 @@ monitor_info( Connection *conn, Operation *op )
        currenttime = slap_get_time();
 
        ldap_pvt_thread_mutex_lock( &gmtime_mutex );
-#ifndef LDAP_LOCALTIME
        ltm = gmtime( &currenttime );
        strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", ltm );
-#else
-       ltm = localtime( &currenttime );
-       strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm );
-#endif
        val.bv_val = buf;
        val.bv_len = strlen( buf );
        attr_merge( e, "currenttime", vals );
 
-#ifndef LDAP_LOCALTIME
        ltm = gmtime( &starttime );
        strftime( buf, sizeof(buf), "%Y%m%d%H%M%SZ", ltm );
-#else
-       ltm = localtime( &starttime );
-       strftime( buf, sizeof(buf), "%y%m%d%H%M%SZ", ltm );
-#endif
        ldap_pvt_thread_mutex_unlock( &gmtime_mutex );
 
        val.bv_val = buf;
@@ -242,8 +251,20 @@ monitor_info( Connection *conn, Operation *op )
        attr_merge( e, "concurrency", vals );
 #endif
 
+       val.bv_val = "top";
+       val.bv_len = sizeof("top")-1;
+       attr_merge( e, "objectClass", vals );
+
+       val.bv_val = "LDAPsubentry";
+       val.bv_len = sizeof("LDAPsubentry")-1;
+       attr_merge( e, "objectClass", vals );
+
+       val.bv_val = "extensibleObject";
+       val.bv_len = sizeof("extensibleObject")-1;
+       attr_merge( e, "objectClass", vals );
+
        send_search_entry( &backends[0], conn, op, e,
-               NULL, 0, 1, NULL );
+               attrs, attrsonly, NULL );
        send_search_result( conn, op, LDAP_SUCCESS,
                NULL, NULL, NULL, NULL, 1 );