]> git.sur5r.net Git - openldap/commitdiff
another round at cleaning it up: better naming, more attributes and so
authorPierangelo Masarati <ando@openldap.org>
Mon, 28 Jan 2002 17:21:52 +0000 (17:21 +0000)
committerPierangelo Masarati <ando@openldap.org>
Mon, 28 Jan 2002 17:21:52 +0000 (17:21 +0000)
servers/slapd/back-monitor/back-monitor.h
servers/slapd/back-monitor/backend.c
servers/slapd/back-monitor/conn.c
servers/slapd/back-monitor/database.c
servers/slapd/back-monitor/listener.c
servers/slapd/daemon.c

index bbd392c26e584a8762a382493777c917f87f25e2..fdf8c23750611b248b50682e3d9528d2ee64cdc0 100644 (file)
@@ -79,7 +79,7 @@ struct monitorinfo {
  * DNs
  */
 #define        SLAPD_MONITOR_LISTENER          0
-#define SLAPD_MONITOR_LISTENER_NAME    "Listener"
+#define SLAPD_MONITOR_LISTENER_NAME    "Listeners"
 #define SLAPD_MONITOR_LISTENER_RDN     \
        "cn=" SLAPD_MONITOR_LISTENER_NAME
 #define SLAPD_MONITOR_LISTENER_DN      \
@@ -156,7 +156,7 @@ struct monitorinfo {
        SLAPD_MONITOR_OPS_RDN "," SLAPD_MONITOR_DN
 
 #define SLAPD_MONITOR_SENT             11
-#define SLAPD_MONITOR_SENT_NAME                "Sent"
+#define SLAPD_MONITOR_SENT_NAME                "Statistics"
 #define SLAPD_MONITOR_SENT_RDN \
        "cn=" SLAPD_MONITOR_SENT_NAME
 #define SLAPD_MONITOR_SENT_DN  \
index c43f7989d617f298e4746a12072169977c6ea1b8..17e1b41657359a0a5458033382a0b146aca95c09 100644 (file)
@@ -82,9 +82,9 @@ monitor_subsys_backend_init(
                bi = &backendInfo[i];
 
                snprintf( buf, sizeof( buf ),
-                               "dn: cn=%d,%s\n"
+                               "dn: cn=Backend %d,%s\n"
                                SLAPD_MONITOR_OBJECTCLASSES
-                               "cn: %d\n",
+                               "cn: Backend %d\n",
                                i,
                                monitor_subsys[SLAPD_MONITOR_BACKEND].mss_dn.bv_val,
                                i );
@@ -94,13 +94,13 @@ monitor_subsys_backend_init(
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
                                "monitor_subsys_backend_init: "
-                               "unable to create entry 'cn=%d,%s'\n",
+                               "unable to create entry 'cn=Backend %d,%s'\n",
                                i, 
                                monitor_subsys[SLAPD_MONITOR_BACKEND].mss_ndn.bv_val ));
 #else
                        Debug( LDAP_DEBUG_ANY,
                                "monitor_subsys_backend_init: "
-                               "unable to create entry 'cn=%d,%s'\n%s",
+                               "unable to create entry 'Backend cn=%d,%s'\n%s",
                                i, 
                                monitor_subsys[SLAPD_MONITOR_BACKEND].mss_ndn.bv_val,
                                "" );
@@ -126,13 +126,13 @@ monitor_subsys_backend_init(
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
                                "monitor_subsys_backend_init: "
-                               "unable to add entry 'cn=%d,%s'\n",
+                               "unable to add entry 'cn=Backend %d,%s'\n",
                                i,
                                monitor_subsys[SLAPD_MONITOR_BACKEND].mss_ndn.bv_val ));
 #else
                        Debug( LDAP_DEBUG_ANY,
                                "monitor_subsys_backend_init: "
-                               "unable to add entry 'cn=%d,%s'\n%s",
+                               "unable to add entry 'cn=Backend %d,%s'\n%s",
                                i,
                                monitor_subsys[SLAPD_MONITOR_BACKEND].mss_ndn.bv_val,
                                "" );
index 46e2c01a7cae3f5ce1595cabdaaf2d5658187bb0..3b09f93c029fc31e973772f6ccf61821eb044b64 100644 (file)
@@ -257,9 +257,9 @@ conn_create(
        assert( ep != NULL );
 
        snprintf( buf, sizeof( buf ),
-               "dn: cn=%ld,%s\n"
+               "dn: cn=Connection %ld,%s\n"
                SLAPD_MONITOR_OBJECTCLASSES
-               "cn: %ld\n",
+               "cn: Connection %ld\n",
                c->c_connid, monitor_subsys[SLAPD_MONITOR_CONN].mss_dn.bv_val,
                c->c_connid );
        e = str2entry( buf );
@@ -269,14 +269,14 @@ conn_create(
                LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
                        "monitor_subsys_conn_create: "
                        "unable to create entry "
-                       "'cn=%ld,%s' entry\n",
+                       "'cn=Connection %ld,%s' entry\n",
                        c->c_connid, 
                        monitor_subsys[SLAPD_MONITOR_CONN].mss_dn.bv_val ));
 #else
                Debug( LDAP_DEBUG_ANY,
                        "monitor_subsys_conn_create: "
                        "unable to create entry "
-                       "'cn=%ld,%s' entry\n",
+                       "'cn=Connection %ld,%s' entry\n",
                        c->c_connid, 
                        monitor_subsys[SLAPD_MONITOR_CONN].mss_dn.bv_val, 0 );
 #endif
index 42083ce91c423cea2212e76d363da82ce264a9c2..85df772f4c65fa6cae1e3d6b2f5d72d25c33ca57 100644 (file)
@@ -48,6 +48,8 @@ monitor_subsys_database_init(
        int                     i;
        struct monitorentrypriv *mp;
        AttributeDescription    *ad_nc = slap_schema.si_ad_namingContexts;
+       AttributeDescription    *ad_seeAlso = NULL;
+       const char              *text = NULL;
        struct berval           bv[2];
 
        assert( be != NULL );
@@ -73,6 +75,10 @@ monitor_subsys_database_init(
                return( -1 );
        }
 
+       if ( slap_str2ad( "seeAlso", &ad_seeAlso, &text ) != LDAP_SUCCESS ) {
+               return( -1 );
+       }
+
        e_tmp = NULL;
        for ( i = nBackendDB; i--; ) {
                char buf[1024];
@@ -81,25 +87,27 @@ monitor_subsys_database_init(
                be = &backendDB[i];
 
                snprintf( buf, sizeof( buf ),
-                               "dn: cn=%d,%s\n"
+                               "dn: cn=Database %d,%s\n"
                                SLAPD_MONITOR_OBJECTCLASSES
-                               "cn: %d\n",
+                               "cn: Database %d\n"
+                               "description: %s",
                                i,
                                monitor_subsys[SLAPD_MONITOR_DATABASE].mss_dn.bv_val,
-                               i );
+                               i,
+                               be->bd_info->bi_type );
                
                e = str2entry( buf );
                if ( e == NULL ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
                                "monitor_subsys_database_init: "
-                               "unable to create entry 'cn=%d,%s'\n",
+                               "unable to create entry 'cn=Database %d,%s'\n",
                                i, 
                                monitor_subsys[SLAPD_MONITOR_DATABASE].mss_ndn.bv_val ));
 #else
                        Debug( LDAP_DEBUG_ANY,
                                "monitor_subsys_database_init: "
-                               "unable to create entry 'cn=%d,%s'\n%s",
+                               "unable to create entry 'cn=Database %d,%s'\n%s",
                                i, 
                                monitor_subsys[SLAPD_MONITOR_DATABASE].mss_ndn.bv_val,
                                "" );
@@ -107,18 +115,32 @@ monitor_subsys_database_init(
                        return( -1 );
                }
                
-               bv[1].bv_val = NULL;
-               bv[0].bv_val = be->bd_info->bi_type;
-               bv[0].bv_len = strlen( bv[0].bv_val );
-               attr_merge( e, monitor_ad_desc, bv );
-               
                for ( j = 0; be->be_suffix[j]; j++ ) {
                        bv[0] = *be->be_suffix[j];
 
                        attr_merge( e, ad_nc, bv );
                        attr_merge( e_database, ad_nc, bv );
                }
-                               
+
+               for ( j = nBackendInfo; j--; ) {
+                       if ( &backendInfo[ j ] == be->bd_info ) {
+                               /* we check the pointer; the test on the
+                                * string should be more reliable */
+                               assert( strcasecmp( backendInfo[ j ].bi_type,
+                                       be->bd_info->bi_type ) == 0 );
+
+                               snprintf( buf, sizeof( buf ), 
+                                       "cn=Backend %d,%s", 
+                                       j, monitor_subsys[SLAPD_MONITOR_BACKEND].mss_dn.bv_val );
+                               bv->bv_val = buf;
+                               bv->bv_len = strlen( buf );
+                               attr_merge( e, ad_seeAlso, bv );
+                               break;
+                       }
+               }
+               /* we must find it! */
+               assert( j >= 0 );
+
                mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
                e->e_private = ( void * )mp;
                mp->mp_next = e_tmp;
@@ -131,13 +153,13 @@ monitor_subsys_database_init(
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
                                "monitor_subsys_database_init: "
-                               "unable to add entry 'cn=%d,%s'\n",
+                               "unable to add entry 'cn=Database %d,%s'\n",
                                i, 
                                monitor_subsys[SLAPD_MONITOR_DATABASE].mss_ndn.bv_val ));
 #else
                        Debug( LDAP_DEBUG_ANY,
                                "monitor_subsys_database_init: "
-                               "unable to add entry 'cn=%d,%s'\n",
+                               "unable to add entry 'cn=Database %d,%s'\n",
                                i, 
                                monitor_subsys[SLAPD_MONITOR_DATABASE].mss_ndn.bv_val,
                                0 );
index f1d7fae7b3f4419681be7d905dd4f9645e9b7bbf..8f90519121fa959b0b8fbe6191dc5382276e715b 100644 (file)
@@ -87,13 +87,14 @@ monitor_subsys_listener_init(
        }
 
        e_tmp = NULL;
-       for ( i = 0; l[i]; i++ ) {
+       for ( i = 0; l[i]; i++ );
+       for ( ; i--; ) {
                char            buf[1024];
 
                snprintf( buf, sizeof( buf ),
-                               "dn: cn=%d,%s\n"
+                               "dn: cn=Listener %d,%s\n"
                                SLAPD_MONITOR_OBJECTCLASSES
-                               "cn: %d\n"
+                               "cn: Listener %d\n"
                                "description: %s\n"
                                "labeledURI: %s",
                                i,
@@ -108,14 +109,14 @@ monitor_subsys_listener_init(
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
                                "monitor_subsys_listener_init: "
-                               "unable to create entry 'cn=%s,%s'\n",
-                               l[i]->sl_name,
+                               "unable to create entry 'cn=Listener, %d,%s'\n",
+                               i,
                                monitor_subsys[SLAPD_MONITOR_LISTENER].mss_ndn.bv_val ));
 #else
                        Debug( LDAP_DEBUG_ANY,
                                "monitor_subsys_listener_init: "
-                               "unable to create entry 'cn=%s,%s'\n%s",
-                               l[i]->sl_name, 
+                               "unable to create entry 'cn=Listener %d,%s'\n%s",
+                               i,
                                monitor_subsys[SLAPD_MONITOR_LISTENER].mss_ndn.bv_val,
                                "" );
 #endif
@@ -151,14 +152,14 @@ monitor_subsys_listener_init(
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_CRIT,
                                "monitor_subsys_listener_init: "
-                               "unable to add entry 'cn=%s,%s'\n",
-                               l[i]->sl_name, 
+                               "unable to add entry 'cn=Listener %d,%s'\n",
+                               i,
                                monitor_subsys[SLAPD_MONITOR_LISTENER].mss_ndn.bv_val ));
 #else
                        Debug( LDAP_DEBUG_ANY,
                                "monitor_subsys_listener_init: "
-                               "unable to add entry 'cn=%s,%s'\n",
-                               l[i]->sl_name, 
+                               "unable to add entry 'cn=Listener %d,%s'\n",
+                               i,
                                monitor_subsys[SLAPD_MONITOR_LISTENER].mss_ndn.bv_val,
                                0 );
 #endif
index 25d6ddf8616ce026f58bf8cf1d6c18462836b5d4..f99a34279e8e3f4357b16a766fc3625e2325a2fa 100644 (file)
@@ -1313,6 +1313,7 @@ slapd_daemon_task(
                        case AF_LOCAL:
                                sprintf( peername, "PATH=%s", from.sa_un_addr.sun_path );
                                ssf = LDAP_PVT_SASL_LOCAL_SSF;
+                               dnsname = "local";
                                break;
 #endif /* LDAP_PF_LOCAL */