From: Pierangelo Masarati Date: Sat, 12 Apr 2003 00:30:47 +0000 (+0000) Subject: add new schema stuff (no #ifdef, too heavy) X-Git-Tag: OPENLDAP_REL_ENG_2_2_0ALPHA~389 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=576089061d4f6eaf57ac9f24437cb6c8a3e2b324;p=openldap add new schema stuff (no #ifdef, too heavy) --- diff --git a/servers/slapd/back-monitor/back-monitor.h b/servers/slapd/back-monitor/back-monitor.h index dd63038570..f90981ff0a 100644 --- a/servers/slapd/back-monitor/back-monitor.h +++ b/servers/slapd/back-monitor/back-monitor.h @@ -41,6 +41,8 @@ LDAP_BEGIN_DECL +#define MONITOR_DEVEL + /* * The cache maps DNs to Entries. * Each entry, on turn, holds the list of its children in the e_private field. @@ -73,6 +75,26 @@ struct monitorentrypriv { struct monitorinfo { Avlnode *mi_cache; ldap_pvt_thread_mutex_t mi_cache_mutex; + + ObjectClass *monitor_oc_monitorServer; + ObjectClass *monitor_oc_monitorContainer; + ObjectClass *monitor_oc_monitorCounter; + ObjectClass *monitor_oc_monitorOperation; + ObjectClass *monitor_oc_monitorConnection; + ObjectClass *monitor_oc_managedObject; + ObjectClass *monitor_oc_monitoredObject; + + AttributeDescription *monitor_ad_monitoredInfo; + AttributeDescription *monitor_ad_managedInfo; + AttributeDescription *monitor_ad_monitorCounter; + AttributeDescription *monitor_ad_monitorOpCompleted; + AttributeDescription *monitor_ad_monitorOpInitiated; + AttributeDescription *monitor_ad_monitorConnectionNumber; + AttributeDescription *monitor_ad_monitorConnectionAuthzDN; + AttributeDescription *monitor_ad_monitorConnectionLocalAddress; + AttributeDescription *monitor_ad_monitorConnectionPeerAddress; + + AttributeDescription *monitor_ad_description; }; /* @@ -202,7 +224,6 @@ struct monitorsubsys { extern struct monitorsubsys monitor_subsys[]; -extern AttributeDescription *monitor_ad_desc; extern BackendDB *be_monitor; /* diff --git a/servers/slapd/back-monitor/backend.c b/servers/slapd/back-monitor/backend.c index 538070a4f5..c1382ff966 100644 --- a/servers/slapd/back-monitor/backend.c +++ b/servers/slapd/back-monitor/backend.c @@ -109,8 +109,10 @@ monitor_subsys_backend_init( bv.bv_val = bi->bi_type; bv.bv_len = strlen( bv.bv_val ); - attr_merge_normalize_one( e, monitor_ad_desc, &bv, NULL ); - attr_merge_normalize_one( e_backend, monitor_ad_desc, &bv, NULL ); + attr_merge_normalize_one( e, mi->monitor_ad_description, + &bv, NULL ); + attr_merge_normalize_one( e_backend, mi->monitor_ad_description, + &bv, NULL ); if ( bi->bi_controls ) { int j; diff --git a/servers/slapd/back-monitor/conn.c b/servers/slapd/back-monitor/conn.c index acb4919729..f899616e3a 100644 --- a/servers/slapd/back-monitor/conn.c +++ b/servers/slapd/back-monitor/conn.c @@ -104,7 +104,7 @@ monitor_subsys_conn_init( bv.bv_val = "0"; bv.bv_len = 1; - attr_merge_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_one( e, mi->monitor_ad_description, &bv, NULL ); mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 ); e->e_private = ( void * )mp; @@ -161,7 +161,7 @@ monitor_subsys_conn_init( bv.bv_val = "0"; bv.bv_len = 1; - attr_merge_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_one( e, mi->monitor_ad_description, &bv, NULL ); mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 ); e->e_private = ( void * )mp; @@ -231,7 +231,7 @@ monitor_subsys_conn_update( Attribute *a; char buf[16]; - a = attr_find( e->e_attrs, monitor_ad_desc ); + a = attr_find( e->e_attrs, mi->monitor_ad_description ); if ( a == NULL ) { return( -1 ); } @@ -246,6 +246,7 @@ monitor_subsys_conn_update( static int conn_create( + struct monitorinfo *mi, Connection *c, Entry **ep ) @@ -334,7 +335,7 @@ conn_create( bv.bv_val = buf; bv.bv_len = strlen( buf ); - attr_merge_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_one( e, mi->monitor_ad_description, &bv, NULL ); mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 ); e->e_private = ( void * )mp; @@ -373,7 +374,7 @@ monitor_subsys_conn_create( for ( c = connection_first( &connindex ); c != NULL; c = connection_next( c, &connindex )) { - if ( conn_create( c, &e ) || e == NULL ) { + if ( conn_create( mi, c, &e ) || e == NULL ) { connection_done(c); for ( ; e_tmp != NULL; ) { mp = ( struct monitorentrypriv * )e_tmp->e_private; @@ -420,7 +421,7 @@ monitor_subsys_conn_create( c != NULL; c = connection_next( c, &connindex )) { if ( c->c_connid == connid ) { - if ( conn_create( c, ep ) || *ep == NULL ) { + if ( conn_create( mi, c, ep ) || *ep == NULL ) { connection_done(c); return( -1 ); } diff --git a/servers/slapd/back-monitor/database.c b/servers/slapd/back-monitor/database.c index f21eee7abf..4a6af5a684 100644 --- a/servers/slapd/back-monitor/database.c +++ b/servers/slapd/back-monitor/database.c @@ -58,7 +58,6 @@ monitor_subsys_database_init( const char *text = NULL; assert( be != NULL ); - assert( monitor_ad_desc != NULL ); mi = ( struct monitorinfo * )be->be_private; @@ -205,6 +204,7 @@ monitor_back_add_plugin( Backend *be, Entry *e_database ) { Slapi_PBlock *pCurrentPB; int i, rc = LDAP_SUCCESS; + struct monitorinfo *mi = ( struct monitorinfo * )be->be_private; if ( slapi_x_pblock_get_first( be, &pCurrentPB ) != LDAP_SUCCESS ) { /* @@ -239,7 +239,8 @@ monitor_back_add_plugin( Backend *be, Entry *e_database ) bv.bv_val = buf; bv.bv_len = strlen( buf ); - attr_merge_normalize_one( e_database, monitor_ad_desc, &bv, NULL ); + attr_merge_normalize_one( e_database, + mi->monitor_ad_description, &bv, NULL ); i++; diff --git a/servers/slapd/back-monitor/init.c b/servers/slapd/back-monitor/init.c index c75567d853..a9798b963a 100644 --- a/servers/slapd/back-monitor/init.c +++ b/servers/slapd/back-monitor/init.c @@ -245,6 +245,96 @@ monitor_back_db_init( struct berval dn, ndn; const char *text; struct berval bv; + struct m_s { + char *name; + char *schema; + int offset; + } moc[] = { + { "monitorServer", "( 1.3.6.1.4.1.4203.666.XXX " + "NAME 'monitorServer' " + "DESC 'Server monitoring root entry' " + "SUP monitor STRUCTURAL)", + offsetof(struct monitorinfo, monitor_oc_monitorServer) }, + { "monitorContainer", "( 1.3.6.1.4.1.4203.666.XXX " + "NAME 'monitorContainer' " + "DESC 'monitor container class' " + "SUP monitor STRUCTURAL)", + offsetof(struct monitorinfo, monitor_oc_monitorContainer) }, + { "monitorCounter", "( 1.3.6.1.4.1.4203.666.XXX " + "NAME 'monitorCounter' " + "DESC 'monitor counter class' " + "SUP monitor STRUCTURAL)", + offsetof(struct monitorinfo, monitor_oc_monitorCounter) }, + { "monitorOperation", "( 1.3.6.1.4.1.4203.666.XXX " + "NAME 'monitorOperation' " + "DESC 'monitor operation class' " + "SUP monitor STRUCTURAL)", + offsetof(struct monitorinfo, monitor_oc_monitorOperation) }, + { "monitorConnection", "( 1.3.6.1.4.1.4203.666.XXX " + "NAME 'monitorConnection' " + "DESC 'monitor connection class' " + "SUP monitor STRUCTURAL)", + offsetof(struct monitorinfo, monitor_oc_monitorConnection) }, + { "managedObject", "( 1.3.6.1.4.1.4203.666.XXX " + "NAME 'managedObject' " + "DESC 'monitor managed entity class' " + "SUP monitor STRUCTURAL)", + offsetof(struct monitorinfo, monitor_oc_managedObject) }, + { "monitoredObject", "( 1.3.6.1.4.1.4203.666.XXX " + "NAME 'monitoredObject' " + "DESC 'monitor monitored entity class' " + "SUP monitor STRUCTURAL)", + offsetof(struct monitorinfo, monitor_oc_monitoredObject) }, + { NULL, NULL, -1 } + }, mat[] = { + { "monitoredInfo", "( 1.3.6.1.4.1.4203.666.XXX" + "NAME 'monitoredInfo' " + "DESC 'monitored info' " + "SUP name )", + offsetof(struct monitorinfo, monitor_ad_monitoredInfo) }, + { "managedInfo", "( 1.3.6.1.4.1.4203.666.XXX" + "NAME 'managedInfo' " + "DESC 'monitor managed info' " + "SUP name )", + offsetof(struct monitorinfo, monitor_ad_managedInfo) }, + { "monitorCounter", "( 1.3.6.1.4.1.4203.666.XXX" + "NAME 'monitorCounter' " + "DESC 'monitor counter' " + "EQUALITY integerMatch " + "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )", + offsetof(struct monitorinfo, monitor_ad_monitorCounter) }, + { "monitorOpCompleted", "( 1.3.6.1.4.1.4203.666.XXX" + "NAME 'monitorOpCompleted' " + "DESC 'monitor completed operations' " + "SUP monitorCounter )", + offsetof(struct monitorinfo, monitor_ad_monitorOpCompleted) }, + { "monitorOpInitiated", "( 1.3.6.1.4.1.4203.666.XXX" + "NAME 'monitorOpInitiated' " + "DESC 'monitor initiated operations' " + "SUP monitorCounter )", + offsetof(struct monitorinfo, monitor_ad_monitorOpInitiated) }, + { "monitorConnectionNumber", "( 1.3.6.1.4.1.4203.666.XXX" + "NAME 'monitorConnectionNumber' " + "DESC 'monitor connection number' " + "SUP monitorCounter )", + offsetof(struct monitorinfo, monitor_ad_monitorConnectionNumber) }, + { "monitorConnectionAuthzDN", "( 1.3.6.1.4.1.4203.666.XXX" + "NAME 'monitorConnectionAuthzDN' " + "DESC 'monitor connection authorization DN' " + "SUP distinguishedName)", + offsetof(struct monitorinfo, monitor_ad_monitorConnectionAuthzDN) }, + { "monitorConnectionLocalAddress", "( 1.3.6.1.4.1.4203.666.XXX" + "NAME 'monitorConnectionLocalAddress' " + "DESC 'monitor connection local address' " + "SUP monitoredInfo)", + offsetof(struct monitorinfo, monitor_ad_monitorConnectionLocalAddress) }, + { "monitorConnectionPeerAddress", "( 1.3.6.1.4.1.4203.666.XXX" + "NAME 'monitorConnectionPeerAddress' " + "DESC 'monitor connection peer address' " + "SUP monitoredInfo)", + offsetof(struct monitorinfo, monitor_ad_monitorConnectionPeerAddress) }, + { NULL, NULL, -1 } + }; /* * database monitor can be defined once only @@ -252,11 +342,10 @@ monitor_back_db_init( if ( be_monitor ) { #ifdef NEW_LOGGING LDAP_LOG( OPERATION, CRIT, - "only one monitor backend is allowed\n" , 0, 0, 0); + "only one monitor backend is allowed\n", 0, 0, 0); #else Debug( LDAP_DEBUG_ANY, - "only one monitor backend is allowed\n%s%s%s", - "", "", "" ); + "only one monitor backend is allowed\n", 0, 0, 0 ); #endif return( -1 ); } @@ -272,11 +361,12 @@ monitor_back_db_init( if( rc != LDAP_SUCCESS ) { #ifdef NEW_LOGGING LDAP_LOG( OPERATION, CRIT, - "monitor DN \"" SLAPD_MONITOR_DN "\" backend is allowed\n" , 0, 0, 0 ); + "unable to normalize monitor DN \"" SLAPD_MONITOR_DN + "\"\n" , 0, 0, 0 ); #else Debug( LDAP_DEBUG_ANY, - "monitor DN \"" SLAPD_MONITOR_DN "\" backend is allowed\n", - 0, 0, 0 ); + "unable to normalize monitor DN \"" SLAPD_MONITOR_DN + "\"\n", 0, 0, 0 ); #endif return -1; } @@ -286,9 +376,117 @@ monitor_back_db_init( ber_bvarray_add( &be->be_nsuffix, &ndn ); mi = ( struct monitorinfo * )ch_calloc( sizeof( struct monitorinfo ), 1 ); + if ( mi == NULL ) { + return -1; + } + ldap_pvt_thread_mutex_init( &mi->mi_cache_mutex ); - if ( slap_str2ad( "description", &monitor_ad_desc, &text ) ) { + for ( i = 0; moc[i].name; i++ ) { + LDAPObjectClass *oc; + int code; + const char *err; + ObjectClass *Oc; + + oc = ldap_str2objectclass(moc[i].schema, &code, &err, + LDAP_SCHEMA_ALLOW_ALL ); + if ( !oc ) { +#ifdef NEW_LOGGING + LDAP_LOG( OPERATION, CRIT, + "unable to parse monitor objectclass '%s' " + "(%s before %s)\n" , moc[i].name, + ldap_scherr2str(code), err ); +#else + Debug( LDAP_DEBUG_ANY, + "unable to parse monitor objectclass '%s' " + "(%s before %s)\n" , moc[i].name, + ldap_scherr2str(code), err ); +#endif + return -1; + } + + if ( oc->oc_oid == NULL ) { +#ifdef NEW_LOGGING + LDAP_LOG( OPERATION, CRIT, + "objectclass '%s' has no OID\n" , + moc[i].name, 0, 0 ); +#else + Debug( LDAP_DEBUG_ANY, + "objectclass '%s' has no OID\n" , + moc[i].name, 0, 0 ); +#endif + return -1; + } + + code = oc_add(oc,1,&err); + if ( code ) { +#ifdef NEW_LOGGING + LDAP_LOG( OPERATION, CRIT, + "objectclass '%s' (%s before %s)\n" , + moc[i].name, scherr2str(code), err ); +#else + Debug( LDAP_DEBUG_ANY, + "objectclass '%s' (%s before %s)\n" , + moc[i].name, scherr2str(code), err ); +#endif + return -1; + } + + ldap_memfree(oc); + + Oc = oc_find( moc[i].name ); + if ( Oc == NULL ) { + return -1; + } + + ((ObjectClass **)&(((char *)mi)[moc[i].offset]))[0] = Oc; + } + + for ( i = 0; mat[i].name; i++ ) { + LDAPAttributeType *at; + int code; + const char *err; + AttributeDescription **ad; + + at = ldap_str2attributetype( mat[i].schema, &code, + &err, LDAP_SCHEMA_ALLOW_ALL ); + if ( !at ) { + return 1; + } + + if ( at->at_oid == NULL ) { + return 1; + } + + /* operational attributes should be defined internally + if ( at->at_usage ) { + fprintf( stderr, "%s: line %d: attribute type \"%s\" is operational\n", + fname, lineno, at->at_oid ); + return 1; + } */ + + code = at_add(at,&err); + if ( code ) { + return 1; + } + ldap_memfree(at); + + ad = ((AttributeDescription **)&(((char *)mi)[mat[i].offset])); + ad[0] = NULL; + if ( slap_str2ad( mat[i].name, ad, &text ) ) { +#ifdef NEW_LOGGING + LDAP_LOG( OPERATION, CRIT, + "monitor_back_db_init: %s\n", text, 0, 0 ); +#else + Debug( LDAP_DEBUG_ANY, + "monitor_subsys_backend_init: %s\n%s%s", + text, "", "" ); +#endif + return -1; + } + } + + if ( slap_str2ad( "description", &mi->monitor_ad_description, &text ) ) { #ifdef NEW_LOGGING LDAP_LOG( OPERATION, CRIT, "monitor_back_db_init: %s\n", text, 0, 0 ); diff --git a/servers/slapd/back-monitor/listener.c b/servers/slapd/back-monitor/listener.c index d25d49d6c1..334cbe385f 100644 --- a/servers/slapd/back-monitor/listener.c +++ b/servers/slapd/back-monitor/listener.c @@ -50,7 +50,6 @@ monitor_subsys_listener_init( Listener **l; assert( be != NULL ); - assert( monitor_ad_desc != NULL ); mi = ( struct monitorinfo * )be->be_private; @@ -127,7 +126,7 @@ monitor_subsys_listener_init( bv.bv_val = "TLS"; bv.bv_len = sizeof("TLS")-1; - attr_merge_normalize_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_normalize_one( e, mi->monitor_ad_description, &bv, NULL ); } #endif /* HAVE_TLS */ #ifdef LDAP_CONNECTIONLESS @@ -137,7 +136,7 @@ monitor_subsys_listener_init( bv.bv_val = "UDP"; bv.bv_len = sizeof("UDP")-1; - attr_merge_normalize_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_normalize_one( e, mi->monitor_ad_description, &bv, NULL ); } #endif /* HAVE_TLS */ diff --git a/servers/slapd/back-monitor/log.c b/servers/slapd/back-monitor/log.c index eae5411860..df63d49840 100644 --- a/servers/slapd/back-monitor/log.c +++ b/servers/slapd/back-monitor/log.c @@ -116,13 +116,13 @@ monitor_subsys_log_init( /* initialize the debug level(s) */ for ( i = 0; int_2_level[ i ].i != 0; i++ ) { - if ( monitor_ad_desc->ad_type->sat_equality->smr_normalize ) { + if ( mi->monitor_ad_description->ad_type->sat_equality->smr_normalize ) { int rc; - rc = (*monitor_ad_desc->ad_type->sat_equality->smr_normalize)( + rc = (*mi->monitor_ad_description->ad_type->sat_equality->smr_normalize)( 0, - monitor_ad_desc->ad_type->sat_syntax, - monitor_ad_desc->ad_type->sat_equality, + mi->monitor_ad_description->ad_type->sat_syntax, + mi->monitor_ad_description->ad_type->sat_equality, &int_2_level[ i ].s, &int_2_level[ i ].n, NULL ); if ( rc ) { @@ -131,7 +131,7 @@ monitor_subsys_log_init( } if ( int_2_level[ i ].i & ldap_syslog ) { - attr_merge_one( e, monitor_ad_desc, + attr_merge_one( e, mi->monitor_ad_description, &int_2_level[ i ].s, &int_2_level[ i ].n ); } @@ -149,6 +149,7 @@ monitor_subsys_log_modify( Modifications *modlist ) { + struct monitorinfo *mi = (struct monitorinfo *)op->o_bd->be_private; int rc = LDAP_OTHER; int newlevel = ldap_syslog; Attribute *save_attrs; @@ -178,7 +179,7 @@ monitor_subsys_log_modify( /* * only the monitor description attribute can be modified */ - } else if ( mod->sm_desc != monitor_ad_desc ) { + } else if ( mod->sm_desc != mi->monitor_ad_description ) { rc = LDAP_UNWILLING_TO_PERFORM; break; } diff --git a/servers/slapd/back-monitor/operation.c b/servers/slapd/back-monitor/operation.c index 60fdd92535..2222615a02 100644 --- a/servers/slapd/back-monitor/operation.c +++ b/servers/slapd/back-monitor/operation.c @@ -123,7 +123,7 @@ monitor_subsys_ops_init( bv.bv_val = "0"; bv.bv_len = 1; - attr_merge_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_one( e, mi->monitor_ad_description, &bv, NULL ); mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 ); e->e_private = ( void * )mp; @@ -190,7 +190,7 @@ monitor_subsys_ops_init( bv.bv_val = "0"; bv.bv_len = 1; - attr_merge_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_one( e, mi->monitor_ad_description, &bv, NULL ); mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 ); e->e_private = ( void * )mp; @@ -257,7 +257,7 @@ monitor_subsys_ops_init( bv.bv_val = "0"; bv.bv_len = 1; - attr_merge_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_one( e, mi->monitor_ad_description, &bv, NULL ); mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 ); e->e_private = ( void * )mp; @@ -324,7 +324,7 @@ monitor_subsys_ops_init( bv.bv_val = "0"; bv.bv_len = 1; - attr_merge_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_one( e, mi->monitor_ad_description, &bv, NULL ); mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 ); e->e_private = ( void * )mp; @@ -433,7 +433,7 @@ monitor_subsys_ops_update( Attribute *a; char buf[16]; - a = attr_find( e->e_attrs, monitor_ad_desc ); + a = attr_find( e->e_attrs, mi->monitor_ad_description ); if ( a == NULL ) { return( -1 ); } diff --git a/servers/slapd/back-monitor/rww.c b/servers/slapd/back-monitor/rww.c index a51e92f53a..8ec531c395 100644 --- a/servers/slapd/back-monitor/rww.c +++ b/servers/slapd/back-monitor/rww.c @@ -105,7 +105,8 @@ monitor_subsys_readw_update_internal( } snprintf( buf, sizeof( buf ), "%s=%d", str, num ); - if ( ( a = attr_find( e->e_attrs, monitor_ad_desc ) ) != NULL ) { + a = attr_find( e->e_attrs, mi->monitor_ad_description ); + if ( a != NULL ) { for ( b = a->a_vals; b[0].bv_val != NULL; b++ ) { if ( strncmp( b[0].bv_val, str, strlen( str ) ) == 0 ) { free( b[0].bv_val ); @@ -121,7 +122,8 @@ monitor_subsys_readw_update_internal( bv.bv_val = buf; bv.bv_len = strlen( buf ); - attr_merge_normalize_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_normalize_one( e, mi->monitor_ad_description, + &bv, NULL ); } return( 0 ); diff --git a/servers/slapd/back-monitor/sent.c b/servers/slapd/back-monitor/sent.c index 2e17b84d9b..9b4aaaf6b9 100644 --- a/servers/slapd/back-monitor/sent.c +++ b/servers/slapd/back-monitor/sent.c @@ -101,7 +101,7 @@ monitor_subsys_sent_init( bv.bv_val = "0"; bv.bv_len = 1; - attr_merge_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_one( e, mi->monitor_ad_description, &bv, NULL ); mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 ); e->e_private = ( void * )mp; @@ -157,7 +157,7 @@ monitor_subsys_sent_init( bv.bv_val = "0"; bv.bv_len = 1; - attr_merge_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_one( e, mi->monitor_ad_description, &bv, NULL ); mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 ); e->e_private = ( void * )mp; @@ -213,7 +213,7 @@ monitor_subsys_sent_init( bv.bv_val = "0"; bv.bv_len = 1; - attr_merge_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_one( e, mi->monitor_ad_description, &bv, NULL ); mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 ); e->e_private = ( void * )mp; @@ -269,7 +269,7 @@ monitor_subsys_sent_init( bv.bv_val = "0"; bv.bv_len = 1; - attr_merge_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_one( e, mi->monitor_ad_description, &bv, NULL ); mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 ); e->e_private = ( void * )mp; @@ -346,7 +346,7 @@ monitor_subsys_sent_update( Attribute *a; char buf[16]; - a = attr_find( e->e_attrs, monitor_ad_desc ); + a = attr_find( e->e_attrs, mi->monitor_ad_description ); if ( a == NULL ) { return( -1 ); } diff --git a/servers/slapd/back-monitor/thread.c b/servers/slapd/back-monitor/thread.c index 7e49177cc5..54fb941d48 100644 --- a/servers/slapd/back-monitor/thread.c +++ b/servers/slapd/back-monitor/thread.c @@ -75,7 +75,7 @@ monitor_subsys_thread_init( bv.bv_val = buf; bv.bv_len = strlen( bv.bv_val ); - attr_merge_normalize_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_normalize_one( e, mi->monitor_ad_description, &bv, NULL ); monitor_cache_release( mi, e ); @@ -98,8 +98,8 @@ monitor_subsys_thread_update( snprintf( buf, sizeof( buf ), "backload=%d", ldap_pvt_thread_pool_backload( &connection_pool ) ); - if ( ( a = attr_find( e->e_attrs, monitor_ad_desc ) ) != NULL ) { - + a = attr_find( e->e_attrs, mi->monitor_ad_description ); + if ( a != NULL ) { for ( b = a->a_vals; b[0].bv_val != NULL; b++ ) { if ( strncmp( b[0].bv_val, "backload=", sizeof( "backload=" ) - 1 ) == 0 ) { @@ -115,7 +115,8 @@ monitor_subsys_thread_update( bv.bv_val = buf; bv.bv_len = strlen( buf ); - attr_merge_normalize_one( e, monitor_ad_desc, &bv, NULL ); + attr_merge_normalize_one( e, mi->monitor_ad_description, + &bv, NULL ); } return( 0 );