]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-monitor/database.c
Added a conformant sortedResults support which is unable to sort anything.
[openldap] / servers / slapd / back-monitor / database.c
index 67285793ffe24cc3f9caffc4397c24f077b79d36..1deed07e7d9e17914984b478ab8c9bafe31cf8cd 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2001-2004 The OpenLDAP Foundation.
+ * Copyright 2001-2005 The OpenLDAP Foundation.
  * Portions Copyright 2001-2003 Pierangelo Masarati.
  * All rights reserved.
  *
@@ -30,7 +30,7 @@
 
 #if defined(LDAP_SLAPI)
 #include "slapi.h"
-static int monitor_back_add_plugin( Backend *be, Entry *e );
+static int monitor_back_add_plugin( monitor_info_t *mi, Backend *be, Entry *e );
 #endif /* defined(LDAP_SLAPI) */
 
 #if defined(SLAPD_BDB)
@@ -166,14 +166,15 @@ monitor_subsys_database_init(
        mp->mp_children = NULL;
        ep = &mp->mp_children;
 
-       for ( i = 0; i < nBackendDB; i++ ) {
+       i = -1;
+       LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
                char            buf[ BACKMONITOR_BUFSIZE ];
                int             j;
                slap_overinfo   *oi = NULL;
-               BackendInfo     *bi;
+               BackendInfo     *bi, *bi2;
                Entry           *e;
 
-               be = &backendDB[ i ];
+               i++;
 
                bi = be->bd_info;
 
@@ -356,8 +357,10 @@ monitor_subsys_database_init(
                }
 #endif /* defined(SLAPD_LDAP) */
 
-               for ( j = 0; j < nBackendInfo; j++ ) {
-                       if ( backendInfo[ j ].bi_type == bi->bi_type ) {
+               j = -1;
+               LDAP_STAILQ_FOREACH( bi2, &backendInfo, bi_next ) {
+                       j++;
+                       if ( bi2->bi_type == bi->bi_type ) {
                                struct berval           bv;
 
                                snprintf( buf, sizeof( buf ), 
@@ -391,7 +394,7 @@ monitor_subsys_database_init(
                }
 
 #if defined(LDAP_SLAPI)
-               monitor_back_add_plugin( be, e );
+               monitor_back_add_plugin( mi, be, e );
 #endif /* defined(LDAP_SLAPI) */
 
                if ( oi != NULL ) {
@@ -550,8 +553,11 @@ monitor_subsys_database_modify(
        if ( n < 0 || n >= nBackendDB )
                return LDAP_NO_SUCH_OBJECT;
 
+       LDAP_STAILQ_FOREACH( be, &backendDB, be_next ) {
+               if ( n == 0 ) break;
+               n--;
+       }
        /* do not allow some changes on back-monitor (needs work)... */
-       be = &backendDB[ n ];
        if ( SLAP_MONITOR( be ) )
                return LDAP_UNWILLING_TO_PERFORM;
                
@@ -829,11 +835,10 @@ done:;
 
 #if defined(LDAP_SLAPI)
 static int
-monitor_back_add_plugin( Backend *be, Entry *e_database )
+monitor_back_add_plugin( monitor_info_t *mi, Backend *be, Entry *e_database )
 {
        Slapi_PBlock    *pCurrentPB; 
        int             i, rc = LDAP_SUCCESS;
-       monitor_info_t  *mi = ( monitor_info_t * )be->be_private;
 
        if ( slapi_int_pblock_get_first( be, &pCurrentPB ) != LDAP_SUCCESS ) {
                /*