]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-monitor/database.c
More for ITS#5860
[openldap] / servers / slapd / back-monitor / database.c
index ec98abc7bc910a309d1eb4de972f3f3a67a522d3..eb75a340f08eff109d0ec119c264fed33f0c14e2 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2001-2008 The OpenLDAP Foundation.
+ * Copyright 2001-2009 The OpenLDAP Foundation.
  * Portions Copyright 2001-2003 Pierangelo Masarati.
  * All rights reserved.
  *
@@ -66,7 +66,7 @@ init_readOnly( monitor_info_t *mi, Entry *e, slap_mask_t restrictops )
        struct berval   *tf = ( ( restrictops & SLAP_RESTRICT_OP_MASK ) == SLAP_RESTRICT_OP_WRITES ) ?
                (struct berval *)&slap_true_bv : (struct berval *)&slap_false_bv;
 
-       return attr_merge_one( e, mi->mi_ad_readOnly, tf, tf );
+       return attr_merge_one( e, mi->mi_ad_readOnly, tf, NULL );
 }
 
 static int
@@ -160,12 +160,12 @@ monitor_subsys_database_init_one(
                                "monitor_subsys_database_init: "
                                "missing suffix for %s\n",
                                rdnval, 0, 0 );
-                       return -1;
+               } else {
+                       attr_merge( e, slap_schema.si_ad_namingContexts,
+                               be->be_suffix, NULL );
+                       attr_merge( e_database, slap_schema.si_ad_namingContexts,
+                               be->be_suffix, NULL );
                }
-               attr_merge( e, slap_schema.si_ad_namingContexts,
-                               be->be_suffix, be->be_nsuffix );
-               attr_merge( e_database, slap_schema.si_ad_namingContexts,
-                               be->be_suffix, be->be_nsuffix );
        }
 
        (void)init_readOnly( mi, e, be->be_restrictops );
@@ -301,7 +301,7 @@ monitor_subsys_database_init_one(
 
                        } else {
                                attr_merge( e_overlay, slap_schema.si_ad_namingContexts,
-                                               be->be_suffix, be->be_nsuffix );
+                                               be->be_suffix, NULL );
                        }
 
                        mp_overlay = monitor_entrypriv_create();
@@ -405,9 +405,15 @@ monitor_back_register_database(
                if ( a ) {
                        int             j, k;
 
-                       for ( j = 0; !BER_BVISNULL( &a->a_nvals[ j ] ); j++ ) {
-                               for ( k = 0; !BER_BVISNULL( &be->be_nsuffix[ k ] ); k++ ) {
-                                       if ( dn_match( &a->a_nvals[ j ], &be->be_nsuffix[ k ] ) ) {
+                       /* FIXME: RFC 4512 defines namingContexts without an
+                        *        equality matching rule, making comparisons
+                        *        like this one tricky.  We use a_vals and
+                        *        be_suffix instead for now.
+                        */
+                       for ( j = 0; !BER_BVISNULL( &a->a_vals[ j ] ); j++ ) {
+                               for ( k = 0; !BER_BVISNULL( &be->be_suffix[ k ] ); k++ ) {
+                                       if ( dn_match( &a->a_vals[ j ],
+                                                      &be->be_suffix[ k ] ) ) {
                                                rc = 0;
                                                goto done;
                                        }