From: Pierangelo Masarati Date: Mon, 28 Jan 2002 17:21:52 +0000 (+0000) Subject: another round at cleaning it up: better naming, more attributes and so X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~3 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f00f86bf22b088dc92044cdb49676f873ecacbbd;p=openldap another round at cleaning it up: better naming, more attributes and so --- diff --git a/servers/slapd/back-monitor/back-monitor.h b/servers/slapd/back-monitor/back-monitor.h index bbd392c26e..fdf8c23750 100644 --- a/servers/slapd/back-monitor/back-monitor.h +++ b/servers/slapd/back-monitor/back-monitor.h @@ -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 \ diff --git a/servers/slapd/back-monitor/backend.c b/servers/slapd/back-monitor/backend.c index c43f7989d6..17e1b41657 100644 --- a/servers/slapd/back-monitor/backend.c +++ b/servers/slapd/back-monitor/backend.c @@ -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, "" ); diff --git a/servers/slapd/back-monitor/conn.c b/servers/slapd/back-monitor/conn.c index 46e2c01a7c..3b09f93c02 100644 --- a/servers/slapd/back-monitor/conn.c +++ b/servers/slapd/back-monitor/conn.c @@ -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 diff --git a/servers/slapd/back-monitor/database.c b/servers/slapd/back-monitor/database.c index 42083ce91c..85df772f4c 100644 --- a/servers/slapd/back-monitor/database.c +++ b/servers/slapd/back-monitor/database.c @@ -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 ); diff --git a/servers/slapd/back-monitor/listener.c b/servers/slapd/back-monitor/listener.c index f1d7fae7b3..8f90519121 100644 --- a/servers/slapd/back-monitor/listener.c +++ b/servers/slapd/back-monitor/listener.c @@ -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 diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index 25d6ddf861..f99a34279e 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -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 */