[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: (ITS#5540) Normalization assertion in attr.c



Hi,

I have uploaded a patch against HEAD that normalizes the attributes
used under cn=monitor according to the schema:
ftp://ftp.openldap.org/incoming/sean-burford-monitor-normalize-080624.patch

I picked cn=monitor for the first upload since it can be modified
without having to reimport databases.  Once we've worked through any
issues with this patch I'll seperate out the rest of the normalization
patches and send those in.

namingContexts was the trickiest, since RFC 4512 defines it without an
equality matching rule but monitor_back_register_database() compares
it with backend suffixes.  It has to deal with capitalised values
properly otherwise we end up with duplicate namingContexts entries, so
normalization is required.  The relevant part of the diff is below.  I
am open to suggestions about how this should be dealt with:

+             struct berval   nContext;
+
+             for ( j = 0; !BER_BVISNULL( &a->a_vals[ j ] ); j++ ) {
+                     /* FIXME: namingContexts has no equality rule
+                      * but it needs to be normalized for this
+                      * comparison.  Using si_ad_distinguishedName
+                      * instead of si_ad_namingContexts results
+                      * in the normalization we expect for now.
+                      */
+                     if ( attr_normalize_one(
slap_schema.si_ad_distinguishedName,
+                                             &a->a_vals[ j ],
+                                             &nContext,
+                                             NULL ) ) {
+                             Debug( LDAP_DEBUG_ANY,
+                                     "monitor_subsys_database_init: "
+                                     "unable to normalize DN %d \"%s\"\n",
+                                     j, a->a_vals[ j ], 0 );
+                             return( -1 );
+                     }

                      for ( k = 0; !BER_BVISNULL( &be->be_nsuffix[ k ]
); k++ ) {
!                             if ( dn_match( &nContext,
&be->be_nsuffix[ k ] ) ) {
                                     rc = 0;
                                     goto done;
                               }
                      }
+                     free( nContext.bv_val );


The attribute types that are modified and the attributes that are
affected are listed below.  cn=Monitor didn't need and schema
modifications:

monitorContext: removed nvals
namingContexts: removed nvals
rootDSE monitorContext and namingContexts

monitorCounter: removed nvals
cn=Max File Descriptors
cn=Total,cn=Connections
cn=Current,cn=Connections
cn=Read under rww
DN counter under sent

monitorConnectionProtocol: removed nvals
monitorConnectionMask: normalized
monitorConnectionListener: normalized
monitorConnectionPeerDomain: normalized
monitorConnectionPeerAddress: normalized
monitorConnectionLocalAddress: normalized
monitorConnectionStartTime: normalized
monitorConnectionActivityTime: normalized
monitorOpInitiated: removed nvals
monitorOpCompleted: removed nvals

readOnly: removed nvals

-- 
Thanks,
Sean Burford