another round at cleaning it up: better naming, more attributes and so

This commit is contained in:
Pierangelo Masarati 2002-01-28 17:21:52 +00:00
parent 79bf6eb80e
commit f00f86bf22
6 changed files with 60 additions and 36 deletions

View 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 \

View 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,
"" );

View 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

View 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 );

View 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

View 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 */