]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/schema_init.c
Remove lint
[openldap] / servers / slapd / schema_init.c
index 5e41856b58be662ae11b99203aea83b7a4756192..5409bc1e002969ca07af2155b6e96591380517d1 100644 (file)
@@ -37,7 +37,7 @@
 /* recycled matching routines */
 #define bitStringMatch                                 octetStringMatch
 #define numericStringMatch                             caseIgnoreIA5Match
-#define objectIdentifierMatch                  caseIgnoreIA5Match
+#define objectIdentifierMatch                  octetStringMatch
 #define telephoneNumberMatch                   caseIgnoreIA5Match
 #define telephoneNumberSubstringsMatch caseIgnoreIA5SubstringsMatch
 #define generalizedTimeMatch                   caseIgnoreIA5Match
@@ -59,6 +59,7 @@
 #define caseIgnoreOrderingMatch                        caseIgnoreMatch
 #define caseExactOrderingMatch                 caseExactMatch
 #define integerOrderingMatch                   integerMatch
+#define        octetStringOrderingMatch                octetStringMatch
 
 /* unimplemented matching routines */
 #define caseIgnoreListMatch                            NULL
@@ -138,7 +139,7 @@ octetStringMatch(
 }
 
 /* Index generation function */
-static int octetStringIndexer(
+int octetStringIndexer(
        slap_mask_t use,
        slap_mask_t flags,
        Syntax *syntax,
@@ -186,6 +187,7 @@ static int octetStringIndexer(
        }
 
        keys[i].bv_val = NULL;
+       keys[i].bv_len = 0;
 
        *keysp = keys;
 
@@ -193,20 +195,20 @@ static int octetStringIndexer(
 }
 
 /* Index generation function */
-static int octetStringFilter(
+int octetStringFilter(
        slap_mask_t use,
        slap_mask_t flags,
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       void * assertValue,
+       void * assertedValue,
        BerVarray *keysp )
 {
        size_t slen, mlen;
        BerVarray keys;
        HASH_CONTEXT   HASHcontext;
        unsigned char   HASHdigest[HASH_BYTES];
-       struct berval *value = (struct berval *) assertValue;
+       struct berval *value = (struct berval *) assertedValue;
        struct berval digest;
        digest.bv_val = HASHdigest;
        digest.bv_len = sizeof(HASHdigest);
@@ -231,6 +233,7 @@ static int octetStringFilter(
 
        ber_dupbv( keys, &digest );
        keys[1].bv_val = NULL;
+       keys[1].bv_len = 0;
 
        *keysp = keys;
 
@@ -511,7 +514,7 @@ Directory String -
   In later versions, more CHOICEs were added.  In all cases the string
   must be non-empty.
 
-  In LDPAv3, a directory string is a UTF-8 encoded UCS string.
+  In LDAPv3, a directory string is a UTF-8 encoded UCS string.
 
   For matching, there are both case ignore and exact rules.  Both
   also require that "insignificant" spaces be ignored.
@@ -929,7 +932,7 @@ approxFilter(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       void * assertValue,
+       void * assertedValue,
        BerVarray *keysp )
 {
        char *c;
@@ -938,7 +941,7 @@ approxFilter(
        BerVarray keys;
 
        /* Yes, this is necessary */
-       val = UTF8bvnormalize( ((struct berval *)assertValue),
+       val = UTF8bvnormalize( ((struct berval *)assertedValue),
                NULL, LDAP_UTF8_APPROX );
        if( val == NULL || val->bv_val == NULL ) {
                keys = (struct berval *)ch_malloc( sizeof(struct berval) );
@@ -1068,7 +1071,7 @@ approxFilter(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       void * assertValue,
+       void * assertedValue,
        BerVarray *keysp )
 {
        BerVarray keys;
@@ -1077,7 +1080,7 @@ approxFilter(
        keys = (struct berval *)ch_malloc( sizeof( struct berval * ) * 2 );
 
        /* Yes, this is necessary */
-       s = UTF8normalize( ((struct berval *)assertValue),
+       s = UTF8normalize( ((struct berval *)assertedValue),
                             UTF8_NOCASEFOLD );
        if( s == NULL ) {
                keys[0] = NULL;
@@ -1333,7 +1336,7 @@ static int caseExactIgnoreFilter(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       void * assertValue,
+       void * assertedValue,
        BerVarray *keysp )
 {
        unsigned casefold;
@@ -1353,7 +1356,7 @@ static int caseExactIgnoreFilter(
        casefold = ( mr != caseExactMatchingRule )
                ? LDAP_UTF8_CASEFOLD : LDAP_UTF8_NOCASEFOLD;
 
-       UTF8bvnormalize( (struct berval *) assertValue, &value, casefold );
+       UTF8bvnormalize( (struct berval *) assertedValue, &value, casefold );
        /* This usually happens if filter contains bad UTF8 */
        if( value.bv_val == NULL ) {
                keys = ch_malloc( sizeof( struct berval ) );
@@ -1572,7 +1575,7 @@ static int caseExactIgnoreSubstringsFilter(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       void * assertValue,
+       void * assertedValue,
        BerVarray *keysp )
 {
        SubstringsAssertion *sa;
@@ -1589,7 +1592,7 @@ static int caseExactIgnoreSubstringsFilter(
        casefold = ( mr != caseExactSubstringsMatchingRule )
                ? LDAP_UTF8_CASEFOLD : LDAP_UTF8_NOCASEFOLD;
 
-       sa = UTF8SubstringsassertionNormalize( assertValue, casefold );
+       sa = UTF8SubstringsassertionNormalize( assertedValue, casefold );
        if( sa == NULL ) {
                *keysp = NULL;
                return LDAP_SUCCESS;
@@ -2021,7 +2024,7 @@ static int integerFilter(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       void * assertValue,
+       void * assertedValue,
        BerVarray *keysp )
 {
        size_t slen, mlen;
@@ -2036,7 +2039,7 @@ static int integerFilter(
        slen = syntax->ssyn_oidlen;
        mlen = mr->smr_oidlen;
 
-       integerNormalize( syntax, assertValue, &norm );
+       integerNormalize( syntax, assertedValue, &norm );
 
        keys = ch_malloc( sizeof( struct berval ) * 2 );
 
@@ -2415,7 +2418,7 @@ static int caseExactIA5Filter(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       void * assertValue,
+       void * assertedValue,
        BerVarray *keysp )
 {
        size_t slen, mlen;
@@ -2430,7 +2433,7 @@ static int caseExactIA5Filter(
        slen = syntax->ssyn_oidlen;
        mlen = mr->smr_oidlen;
 
-       value = (struct berval *) assertValue;
+       value = (struct berval *) assertedValue;
 
        keys = ch_malloc( sizeof( struct berval ) * 2 );
 
@@ -2621,10 +2624,10 @@ static int caseExactIA5SubstringsFilter(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       void * assertValue,
+       void * assertedValue,
        BerVarray *keysp )
 {
-       SubstringsAssertion *sa = assertValue;
+       SubstringsAssertion *sa = assertedValue;
        char pre;
        ber_len_t nkeys = 0;
        size_t slen, mlen, klen;
@@ -3002,7 +3005,7 @@ static int caseIgnoreIA5Filter(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       void * assertValue,
+       void * assertedValue,
        BerVarray *keysp )
 {
        size_t slen, mlen;
@@ -3017,7 +3020,7 @@ static int caseIgnoreIA5Filter(
        slen = syntax->ssyn_oidlen;
        mlen = mr->smr_oidlen;
 
-       ber_dupbv( &value, (struct berval *) assertValue );
+       ber_dupbv( &value, (struct berval *) assertedValue );
        ldap_pvt_str2lower( value.bv_val );
 
        keys = ch_malloc( sizeof( struct berval ) * 2 );
@@ -3216,10 +3219,10 @@ static int caseIgnoreIA5SubstringsFilter(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       void * assertValue,
+       void * assertedValue,
        BerVarray *keysp )
 {
-       SubstringsAssertion *sa = assertValue;
+       SubstringsAssertion *sa = assertedValue;
        char pre;
        ber_len_t nkeys = 0;
        size_t slen, mlen, klen;
@@ -3543,7 +3546,7 @@ integerBitAndMatch(
        if(( lAssertedValue == LONG_MIN || lAssertedValue == LONG_MAX) && errno == ERANGE )
                return LDAP_CONSTRAINT_VIOLATION;
 
-       *matchp = (lValue & lAssertedValue);
+       *matchp = (lValue & lAssertedValue) ? 0 : 1;
        return LDAP_SUCCESS;
 }
 
@@ -3567,7 +3570,7 @@ integerBitOrMatch(
        if(( lAssertedValue == LONG_MIN || lAssertedValue == LONG_MAX) && errno == ERANGE )
                return LDAP_CONSTRAINT_VIOLATION;
 
-       *matchp = (lValue | lAssertedValue);
+       *matchp = (lValue | lAssertedValue) ? 0 : -1;
        return LDAP_SUCCESS;
 }
 
@@ -3915,13 +3918,13 @@ static int certificateExactFilter(
        Syntax *syntax,
        MatchingRule *mr,
        struct berval *prefix,
-       void * assertValue,
+       void * assertedValue,
        BerVarray *keysp )
 {
        BerVarray keys;
        struct berval asserted_serial;
 
-       serial_and_issuer_parse(assertValue,
+       serial_and_issuer_parse(assertedValue,
                                &asserted_serial,
                                NULL);
 
@@ -4266,19 +4269,10 @@ bootParameterValidate(
        return LDAP_SUCCESS;
 }
 
-static struct syntax_defs_rec {
-       char *sd_desc;
 #define X_BINARY "X-BINARY-TRANSFER-REQUIRED 'TRUE' "
 #define X_NOT_H_R "X-NOT-HUMAN-READABLE 'TRUE' "
-       int sd_flags;
-       slap_syntax_validate_func *sd_validate;
-       slap_syntax_transform_func *sd_normalize;
-       slap_syntax_transform_func *sd_pretty;
-#ifdef SLAPD_BINARY_CONVERSION
-       slap_syntax_transform_func *sd_ber2str;
-       slap_syntax_transform_func *sd_str2ber;
-#endif
-} syntax_defs[] = {
+
+static slap_syntax_defs_rec syntax_defs[] = {
        {"( 1.3.6.1.4.1.1466.115.121.1.1 DESC 'ACI Item' "
                X_BINARY X_NOT_H_R ")",
                SLAP_SYNTAX_BINARY|SLAP_SYNTAX_BER, NULL, NULL, NULL},
@@ -4434,11 +4428,37 @@ static struct syntax_defs_rec {
        {NULL, 0, NULL, NULL, NULL}
 };
 
+#ifdef HAVE_TLS
+char *certificateExactMatchSyntaxes[] = {
+       "1.3.6.1.4.1.1466.115.121.1.8" /* certificate */,
+       NULL
+};
+#endif
+char *directoryStringSyntaxes[] = {
+       "1.3.6.1.4.1.1466.115.121.1.44" /* printableString */,
+       NULL
+};
+char *integerFirstComponentMatchSyntaxes[] = {
+       "1.3.6.1.4.1.1466.115.121.1.27" /* INTEGER */,
+       "1.3.6.1.4.1.1466.115.121.1.17" /* ditStructureRuleDescription */,
+       NULL
+};
+char *objectIdentifierFirstComponentMatchSyntaxes[] = {
+       "1.3.6.1.4.1.1466.115.121.1.38" /* OID */,
+       "1.3.6.1.4.1.1466.115.121.1.3"  /* attributeTypeDescription */,
+       "1.3.6.1.4.1.1466.115.121.1.16" /* ditContentRuleDescription */,
+       "1.3.6.1.4.1.1466.115.121.1.54" /* ldapSyntaxDescription */,
+       "1.3.6.1.4.1.1466.115.121.1.30" /* matchingRuleDescription */,
+       "1.3.6.1.4.1.1466.115.121.1.31" /* matchingRuleUseDescription */,
+       "1.3.6.1.4.1.1466.115.121.1.35" /* nameFormDescription */,
+       "1.3.6.1.4.1.1466.115.121.1.37" /* objectClassDescription */,
+       NULL
+};
+
 /*
  * Other matching rules in X.520 that we do not use (yet):
  *
  * 2.5.13.9            numericStringOrderingMatch
- * 2.5.13.18   octetStringOrderingMatch
  * 2.5.13.19   octetStringSubstringsMatch
  * 2.5.13.25   uTCTimeMatch
  * 2.5.13.26   uTCTimeOrderingMatch
@@ -4456,24 +4476,14 @@ static struct syntax_defs_rec {
  * 2.5.13.43   readerAndKeyIDMatch
  * 2.5.13.44   attributeIntegrityMatch
  */
-static struct mrule_defs_rec {
-       char *                                          mrd_desc;
-       slap_mask_t                                     mrd_usage;
-       slap_mr_convert_func *          mrd_convert;
-       slap_mr_normalize_func *        mrd_normalize;
-       slap_mr_match_func *            mrd_match;
-       slap_mr_indexer_func *          mrd_indexer;
-       slap_mr_filter_func *           mrd_filter;
-
-       char *                                          mrd_associated;
-} mrule_defs[] = {
+static slap_mrule_defs_rec mrule_defs[] = {
        /*
         * EQUALITY matching rules must be listed after associated APPROX
         * matching rules.  So, we list all APPROX matching rules first.
         */
        {"( " directoryStringApproxMatchOID " NAME 'directoryStringApproxMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
-               SLAP_MR_HIDE | SLAP_MR_EQUALITY_APPROX | SLAP_MR_EXT,
+               SLAP_MR_HIDE | SLAP_MR_EQUALITY_APPROX | SLAP_MR_EXT, NULL,
                NULL, NULL,
                directoryStringApproxMatch,
                directoryStringApproxIndexer, 
@@ -4482,7 +4492,7 @@ static struct mrule_defs_rec {
 
        {"( " IA5StringApproxMatchOID " NAME 'IA5StringApproxMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )",
-               SLAP_MR_HIDE | SLAP_MR_EQUALITY_APPROX | SLAP_MR_EXT,
+               SLAP_MR_HIDE | SLAP_MR_EQUALITY_APPROX | SLAP_MR_EXT, NULL,
                NULL, NULL,
                IA5StringApproxMatch,
                IA5StringApproxIndexer, 
@@ -4495,14 +4505,14 @@ static struct mrule_defs_rec {
        
        {"( 2.5.13.0 NAME 'objectIdentifierMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT, NULL,
                NULL, NULL,
                objectIdentifierMatch, caseIgnoreIA5Indexer, caseIgnoreIA5Filter,
                NULL},
 
        {"( 2.5.13.1 NAME 'distinguishedNameMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT, NULL,
                NULL, NULL,
                dnMatch, dnIndexer, dnFilter,
                NULL},
@@ -4510,20 +4520,21 @@ static struct mrule_defs_rec {
        {"( 2.5.13.2 NAME 'caseIgnoreMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
                SLAP_MR_EQUALITY | SLAP_MR_EXT | SLAP_MR_DN_FOLD,
+                       directoryStringSyntaxes,
                NULL, NULL,
                caseIgnoreMatch, caseExactIgnoreIndexer, caseExactIgnoreFilter,
                directoryStringApproxMatchOID },
 
        {"( 2.5.13.3 NAME 'caseIgnoreOrderingMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
-               SLAP_MR_ORDERING,
+               SLAP_MR_ORDERING, directoryStringSyntaxes,
                NULL, NULL,
                caseIgnoreOrderingMatch, NULL, NULL,
                NULL},
 
        {"( 2.5.13.4 NAME 'caseIgnoreSubstringsMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
-               SLAP_MR_SUBSTR | SLAP_MR_EXT,
+               SLAP_MR_SUBSTR, NULL,
                NULL, NULL,
                caseExactIgnoreSubstringsMatch,
                caseExactIgnoreSubstringsIndexer,
@@ -4532,21 +4543,21 @@ static struct mrule_defs_rec {
 
        {"( 2.5.13.5 NAME 'caseExactMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT, directoryStringSyntaxes,
                NULL, NULL,
                caseExactMatch, caseExactIgnoreIndexer, caseExactIgnoreFilter,
                directoryStringApproxMatchOID },
 
        {"( 2.5.13.6 NAME 'caseExactOrderingMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.15 )",
-               SLAP_MR_ORDERING,
+               SLAP_MR_ORDERING, directoryStringSyntaxes,
                NULL, NULL,
                caseExactOrderingMatch, NULL, NULL,
                NULL},
 
        {"( 2.5.13.7 NAME 'caseExactSubstringsMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
-               SLAP_MR_SUBSTR | SLAP_MR_EXT,
+               SLAP_MR_SUBSTR, directoryStringSyntaxes,
                NULL, NULL,
                caseExactIgnoreSubstringsMatch,
                caseExactIgnoreSubstringsIndexer,
@@ -4555,7 +4566,7 @@ static struct mrule_defs_rec {
 
        {"( 2.5.13.8 NAME 'numericStringMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.36 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT | SLAP_MR_DN_FOLD,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT | SLAP_MR_DN_FOLD, NULL,
                NULL, NULL,
                caseIgnoreIA5Match,
                caseIgnoreIA5Indexer,
@@ -4564,7 +4575,7 @@ static struct mrule_defs_rec {
 
        {"( 2.5.13.10 NAME 'numericStringSubstringsMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
-               SLAP_MR_SUBSTR | SLAP_MR_EXT,
+               SLAP_MR_SUBSTR, NULL,
                NULL, NULL,
                caseIgnoreIA5SubstringsMatch,
                caseIgnoreIA5SubstringsIndexer,
@@ -4573,56 +4584,63 @@ static struct mrule_defs_rec {
 
        {"( 2.5.13.11 NAME 'caseIgnoreListMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.41 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT | SLAP_MR_DN_FOLD,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT | SLAP_MR_DN_FOLD, NULL,
                NULL, NULL,
                caseIgnoreListMatch, NULL, NULL,
                NULL},
 
        {"( 2.5.13.12 NAME 'caseIgnoreListSubstringsMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
-               SLAP_MR_SUBSTR | SLAP_MR_EXT,
+               SLAP_MR_SUBSTR, NULL,
                NULL, NULL,
                caseIgnoreListSubstringsMatch, NULL, NULL,
                NULL},
 
        {"( 2.5.13.13 NAME 'booleanMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.7 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT, NULL,
                NULL, NULL,
                booleanMatch, NULL, NULL,
                NULL},
 
        {"( 2.5.13.14 NAME 'integerMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT, NULL,
                NULL, NULL,
                integerMatch, integerIndexer, integerFilter,
                NULL},
 
        {"( 2.5.13.15 NAME 'integerOrderingMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )",
-               SLAP_MR_ORDERING,
+               SLAP_MR_ORDERING, NULL,
                NULL, NULL,
                integerOrderingMatch, NULL, NULL,
                NULL},
 
        {"( 2.5.13.16 NAME 'bitStringMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.6 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT, NULL,
                NULL, NULL,
                bitStringMatch, bitStringIndexer, bitStringFilter,
                NULL},
 
        {"( 2.5.13.17 NAME 'octetStringMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT, NULL,
                NULL, NULL,
                octetStringMatch, octetStringIndexer, octetStringFilter,
                NULL},
 
+       {"( 2.5.13.18 NAME 'octetStringOrderingMatch' "
+               "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )",
+               SLAP_MR_ORDERING, NULL,
+               NULL, NULL,
+               octetStringOrderingMatch, NULL, NULL,
+               NULL},
+
        {"( 2.5.13.20 NAME 'telephoneNumberMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT | SLAP_MR_DN_FOLD,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT | SLAP_MR_DN_FOLD, NULL,
                NULL, NULL,
                telephoneNumberMatch,
                telephoneNumberIndexer,
@@ -4631,7 +4649,7 @@ static struct mrule_defs_rec {
 
        {"( 2.5.13.21 NAME 'telephoneNumberSubstringsMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.58 )",
-               SLAP_MR_SUBSTR | SLAP_MR_EXT,
+               SLAP_MR_SUBSTR, NULL,
                NULL, NULL,
                telephoneNumberSubstringsMatch,
                telephoneNumberSubstringsIndexer,
@@ -4640,42 +4658,42 @@ static struct mrule_defs_rec {
 
        {"( 2.5.13.22 NAME 'presentationAddressMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.43 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT, NULL,
                NULL, NULL,
                NULL, NULL, NULL,
                NULL},
 
        {"( 2.5.13.23 NAME 'uniqueMemberMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.34 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT, NULL,
                NULL, NULL,
                uniqueMemberMatch, NULL, NULL,
                NULL},
 
        {"( 2.5.13.24 NAME 'protocolInformationMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.42 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT, NULL,
                NULL, NULL,
                protocolInformationMatch, NULL, NULL,
                NULL},
 
        {"( 2.5.13.27 NAME 'generalizedTimeMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT, NULL,
                NULL, NULL,
                generalizedTimeMatch, NULL, NULL,
                NULL},
 
        {"( 2.5.13.28 NAME 'generalizedTimeOrderingMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.24 )",
-               SLAP_MR_ORDERING,
+               SLAP_MR_ORDERING, NULL,
                NULL, NULL,
                generalizedTimeOrderingMatch, NULL, NULL,
                NULL},
 
        {"( 2.5.13.29 NAME 'integerFirstComponentMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT, integerFirstComponentMatchSyntaxes,
                NULL, NULL,
                integerFirstComponentMatch, NULL, NULL,
                NULL},
@@ -4683,6 +4701,7 @@ static struct mrule_defs_rec {
        {"( 2.5.13.30 NAME 'objectIdentifierFirstComponentMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.38 )",
                SLAP_MR_EQUALITY | SLAP_MR_EXT,
+                       objectIdentifierFirstComponentMatchSyntaxes,
                NULL, NULL,
                objectIdentifierFirstComponentMatch, NULL, NULL,
                NULL},
@@ -4690,7 +4709,7 @@ static struct mrule_defs_rec {
 #ifdef HAVE_TLS
        {"( 2.5.13.34 NAME 'certificateExactMatch' "
                "SYNTAX 1.2.826.0.1.3344810.7.1 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT, certificateExactMatchSyntaxes,
                certificateExactConvert, NULL,
                certificateExactMatch,
                certificateExactIndexer, certificateExactFilter,
@@ -4699,21 +4718,21 @@ static struct mrule_defs_rec {
 
        {"( 1.3.6.1.4.1.1466.109.114.1 NAME 'caseExactIA5Match' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT, NULL,
                NULL, NULL,
                caseExactIA5Match, caseExactIA5Indexer, caseExactIA5Filter,
                IA5StringApproxMatchOID },
 
        {"( 1.3.6.1.4.1.1466.109.114.2 NAME 'caseIgnoreIA5Match' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )",
-               SLAP_MR_EQUALITY | SLAP_MR_EXT | SLAP_MR_DN_FOLD,
+               SLAP_MR_EQUALITY | SLAP_MR_EXT | SLAP_MR_DN_FOLD, NULL,
                NULL, NULL,
                caseIgnoreIA5Match, caseIgnoreIA5Indexer, caseIgnoreIA5Filter,
                IA5StringApproxMatchOID },
 
        {"( 1.3.6.1.4.1.1466.109.114.3 NAME 'caseIgnoreIA5SubstringsMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )",
-               SLAP_MR_SUBSTR,
+               SLAP_MR_SUBSTR, NULL,
                NULL, NULL,
                caseIgnoreIA5SubstringsMatch,
                caseIgnoreIA5SubstringsIndexer,
@@ -4722,7 +4741,7 @@ static struct mrule_defs_rec {
 
        {"( 1.3.6.1.4.1.4203.1.2.1 NAME 'caseExactIA5SubstringsMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.26 )",
-               SLAP_MR_SUBSTR,
+               SLAP_MR_SUBSTR, NULL,
                NULL, NULL,
                caseExactIA5SubstringsMatch,
                caseExactIA5SubstringsIndexer,
@@ -4733,7 +4752,7 @@ static struct mrule_defs_rec {
        /* needs updating */
        {"( 1.3.6.1.4.1.4203.666.4.1 NAME 'authPasswordMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )",
-               SLAP_MR_EQUALITY,
+               SLAP_MR_EQUALITY, NULL,
                NULL, NULL,
                authPasswordMatch, NULL, NULL,
                NULL},
@@ -4742,7 +4761,7 @@ static struct mrule_defs_rec {
 #ifdef SLAPD_ACI_ENABLED
        {"( 1.3.6.1.4.1.4203.666.4.2 NAME 'OpenLDAPaciMatch' "
                "SYNTAX 1.3.6.1.4.1.4203.666.2.1 )",
-               SLAP_MR_EQUALITY,
+               SLAP_MR_EQUALITY, NULL,
                NULL, NULL,
                OpenLDAPaciMatch, NULL, NULL,
                NULL},
@@ -4750,19 +4769,21 @@ static struct mrule_defs_rec {
 
        {"( 1.2.840.113556.1.4.803 NAME 'integerBitAndMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )",
-               SLAP_MR_EXT,
+               SLAP_MR_EXT, NULL,
                NULL, NULL,
                integerBitAndMatch, NULL, NULL,
                NULL},
 
        {"( 1.2.840.113556.1.4.804 NAME 'integerBitOrMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.27 )",
-               SLAP_MR_EXT,
+               SLAP_MR_EXT, NULL,
                NULL, NULL,
                integerBitOrMatch, NULL, NULL,
                NULL},
 
-       {NULL, SLAP_MR_NONE, NULL, NULL, NULL, NULL}
+       {NULL, SLAP_MR_NONE, NULL,
+               NULL, NULL, NULL, NULL, NULL,
+               NULL }
 };
 
 int
@@ -4775,17 +4796,7 @@ slap_schema_init( void )
        assert( schema_init_done == 0 );
 
        for ( i=0; syntax_defs[i].sd_desc != NULL; i++ ) {
-               res = register_syntax( syntax_defs[i].sd_desc,
-                       syntax_defs[i].sd_flags,
-                       syntax_defs[i].sd_validate,
-                       syntax_defs[i].sd_normalize,
-                       syntax_defs[i].sd_pretty
-#ifdef SLAPD_BINARY_CONVERSION
-                       ,
-                       syntax_defs[i].sd_ber2str,
-                       syntax_defs[i].sd_str2ber
-#endif
-               );
+               res = register_syntax( &syntax_defs[i] );
 
                if ( res ) {
                        fprintf( stderr, "slap_schema_init: Error registering syntax %s\n",
@@ -4795,22 +4806,16 @@ slap_schema_init( void )
        }
 
        for ( i=0; mrule_defs[i].mrd_desc != NULL; i++ ) {
-               if( mrule_defs[i].mrd_usage == SLAP_MR_NONE ) {
+               if( mrule_defs[i].mrd_usage == SLAP_MR_NONE &&
+                       mrule_defs[i].mrd_compat_syntaxes == NULL )
+               {
                        fprintf( stderr,
                                "slap_schema_init: Ingoring unusable matching rule %s\n",
                                 mrule_defs[i].mrd_desc );
                        continue;
                }
 
-               res = register_matching_rule(
-                       mrule_defs[i].mrd_desc,
-                       mrule_defs[i].mrd_usage,
-                       mrule_defs[i].mrd_convert,
-                       mrule_defs[i].mrd_normalize,
-                       mrule_defs[i].mrd_match,
-                       mrule_defs[i].mrd_indexer,
-                       mrule_defs[i].mrd_filter,
-                       mrule_defs[i].mrd_associated );
+               res = register_matching_rule( &mrule_defs[i] );
 
                if ( res ) {
                        fprintf( stderr,
@@ -4838,5 +4843,6 @@ schema_destroy( void )
        for ( i=0; i < (int)(sizeof(mr_ptr)/sizeof(mr_ptr[0])); i++ )
                *mr_ptr[i].mr = NULL;
        mr_destroy();
+       mru_destroy();
        syn_destroy();
 }