From e255d3e9967459a091c498c0a2541edf4f56a6b9 Mon Sep 17 00:00:00 2001 From: Ondrej Kuznik Date: Thu, 12 Apr 2012 09:46:08 +0200 Subject: [PATCH] ITS#7182 Remove use of monitor_info_t in back-ldap. --- servers/slapd/back-ldap/monitor.c | 36 +++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/servers/slapd/back-ldap/monitor.c b/servers/slapd/back-ldap/monitor.c index f1816780a2..68e9f46182 100644 --- a/servers/slapd/back-ldap/monitor.c +++ b/servers/slapd/back-ldap/monitor.c @@ -37,6 +37,9 @@ static ObjectClass *oc_olmLDAPDatabase; static ObjectClass *oc_olmLDAPConnection; +static ObjectClass *oc_monitorContainer; +static ObjectClass *oc_monitorCounterObject; + static AttributeDescription *ad_olmDbURIList; static AttributeDescription *ad_olmDbOperations; static AttributeDescription *ad_olmDbBoundDN; @@ -155,6 +158,16 @@ static struct { { NULL } }; +static struct { + char *name; + ObjectClass **oc; +} s_moc[] = { + { "monitorContainer", &oc_monitorContainer }, + { "monitorCounterObject", &oc_monitorCounterObject }, + + { NULL } +}; + static struct { char *desc; ObjectClass **oc; @@ -578,14 +591,12 @@ ldap_back_monitor_conn_init( monitor_subsys_t *ms ) { ldapinfo_t *li = (ldapinfo_t *) ms->mss_private; - monitor_info_t *mi; monitor_extra_t *mbe; Entry *e; int rc; assert( be != NULL ); - mi = (monitor_info_t *) be->be_private; mbe = (monitor_extra_t *) be->bd_info->bi_extra; ms->mss_dn = ms->mss_ndn = li->li_monitor_info.lmi_ndn; @@ -594,8 +605,7 @@ ldap_back_monitor_conn_init( ms->mss_destroy = ldap_back_monitor_subsystem_destroy; e = mbe->entry_stub( &ms->mss_dn, &ms->mss_ndn, - &ms->mss_rdn, - mi->mi_oc_monitorContainer, NULL, NULL ); + &ms->mss_rdn, oc_monitorContainer, NULL, NULL ); if ( e == NULL ) { Debug( LDAP_DEBUG_ANY, "ldap_back_monitor_conn_init: " @@ -737,7 +747,6 @@ ldap_back_monitor_ops_init( { ldapinfo_t *li = (ldapinfo_t *) ms->mss_private; - monitor_info_t *mi; monitor_extra_t *mbe; Entry *e, *parent; int rc; @@ -746,7 +755,6 @@ ldap_back_monitor_ops_init( assert( be != NULL ); - mi = (monitor_info_t *) be->be_private; mbe = (monitor_extra_t *) be->bd_info->bi_extra; ms->mss_dn = ms->mss_ndn = li->li_monitor_info.lmi_ndn; @@ -754,8 +762,7 @@ ldap_back_monitor_ops_init( ms->mss_destroy = ldap_back_monitor_subsystem_destroy; parent = mbe->entry_stub( &ms->mss_dn, &ms->mss_ndn, - &ms->mss_rdn, - mi->mi_oc_monitorContainer, NULL, NULL ); + &ms->mss_rdn, oc_monitorContainer, NULL, NULL ); if ( parent == NULL ) { Debug( LDAP_DEBUG_ANY, "ldap_back_monitor_ops_init: " @@ -785,7 +792,7 @@ ldap_back_monitor_ops_init( e = mbe->entry_stub( &parent->e_name, &parent->e_nname, &ldap_back_monitor_op[op].rdn, - mi->mi_oc_monitorCounterObject, NULL, NULL ); + oc_monitorCounterObject, NULL, NULL ); if ( e == NULL ) { Debug( LDAP_DEBUG_ANY, "ldap_back_monitor_ops_init: " @@ -906,6 +913,17 @@ ldap_back_monitor_initialize( void ) } } + for ( i = 0; s_moc[ i ].name != NULL; i++ ) { + *s_moc[i].oc = oc_find( s_moc[ i ].name ); + if ( ! *s_moc[i].oc ) { + Debug( LDAP_DEBUG_ANY, + "ldap_back_monitor_initialize: failed to find objectClass (%s)\n", + s_moc[ i ].name, 0, 0 ); + return 5; + + } + } + return ( ldap_back_monitor_initialized_failure = LDAP_SUCCESS ); } -- 2.39.5