]> git.sur5r.net Git - openldap/commitdiff
Add additional DN matching rules.
authorKurt Zeilenga <kurt@openldap.org>
Thu, 9 Sep 2004 03:56:58 +0000 (03:56 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 9 Sep 2004 03:56:58 +0000 (03:56 +0000)
servers/slapd/dn.c
servers/slapd/schema_init.c
servers/slapd/schema_prep.c
servers/slapd/slap.h

index 9b6edbcf680b5f82ae8ae6e0ec42732b186a4f14..c45e6917efe7f729bccd5064b1517d5fa6b62876 100644 (file)
@@ -1001,10 +1001,66 @@ dnRelativeMatch(
                        }
                }
 
+               *matchp = match;
+               return LDAP_SUCCESS;
+
+       }
+
+       if( mr == slap_schema.si_mr_dnSuperiorMatch ) {
+               asserted = value;
+               value = (struct berval *) assertedValue;
+               mr = slap_schema.si_mr_dnSubordinateMatch;
+       }
+
+       if( mr == slap_schema.si_mr_dnSubordinateMatch ) {
+               if( asserted->bv_len >= value->bv_len ) {
+                       match = -1;
+               } else {
+                       if( DN_SEPARATOR(
+                               value->bv_val[value->bv_len - asserted->bv_len - 1] ))
+                       {
+                               match = memcmp(
+                                       &value->bv_val[value->bv_len - asserted->bv_len],
+                                       asserted->bv_val, 
+                                       asserted->bv_len );
+                       } else {
+                               return 1;
+                       }
+               }
+
+               *matchp = match;
+               return LDAP_SUCCESS;
+       }
+
+       if( mr == slap_schema.si_mr_dnOneLevelMatch ) {
+               if( asserted->bv_len >= value->bv_len ) {
+                       match = -1;
+               } else {
+                       if( DN_SEPARATOR(
+                               value->bv_val[value->bv_len - asserted->bv_len - 1] ))
+                       {
+                               match = memcmp(
+                                       &value->bv_val[value->bv_len - asserted->bv_len],
+                                       asserted->bv_val, 
+                                       asserted->bv_len );
+
+                               if( !match ) {
+                                       struct berval rdn;
+                                       rdn.bv_val = value->bv_val;
+                                       rdn.bv_len = value->bv_len - asserted->bv_len - 1;
+                                       match = dnIsOneLevelRDN( &rdn ) ? 0 : 1;
+                               }
+                       } else {
+                               return 1;
+                       }
+               }
+
                *matchp = match;
                return LDAP_SUCCESS;
        }
 
+       /* should not be reachable */
+       assert( 0 );
        return LDAP_OTHER;
 }
 
index 07d3ceccacca0ecb0829f774632dd05a611ffbef..a0e5fe6a061d63a86e490fb4d86b2aefae3d6e6f 100644 (file)
@@ -3217,7 +3217,6 @@ static slap_mrule_defs_rec mrule_defs[] = {
                NULL, NULL,
                NULL },
 
-#if 0
        {"( 1.3.6.1.4.1.4203.666.4.8 NAME 'dnOneLevelMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )",
                SLAP_MR_HIDE | SLAP_MR_EXT, NULL,
@@ -3238,7 +3237,6 @@ static slap_mrule_defs_rec mrule_defs[] = {
                NULL, dnNormalize, dnRelativeMatch,
                NULL, NULL,
                NULL },
-#endif
 
        {"( 1.2.36.79672281.1.13.3 NAME 'rdnMatch' "
                "SYNTAX 1.2.36.79672281.1.5.0 )",
index 82ab93dea1cf98630fcea777da7595108306674c..a368e51e310a45063f1bbc621380abd2fb52e5e0 100644 (file)
@@ -993,16 +993,12 @@ static struct slap_schema_mr_map {
                offsetof(struct slap_internal_schema, si_mr_distinguishedNameMatch) },
        { "dnSubtreeMatch",
                offsetof(struct slap_internal_schema, si_mr_dnSubtreeMatch) },
-
-#if 0
        { "dnOneLevelMatch",
                offsetof(struct slap_internal_schema, si_mr_dnOneLevelMatch) },
        { "dnSubordinateMatch",
                offsetof(struct slap_internal_schema, si_mr_dnSubordinateMatch) },
        { "dnSuperiorMatch",
                offsetof(struct slap_internal_schema, si_mr_dnSuperiorMatch) },
-#endif
-
        { "integerMatch",
                offsetof(struct slap_internal_schema, si_mr_integerMatch) },
        { "integerFirstComponentMatch",
index e22a503e093b0d734f2f4b899bf2dca11a52bbe5..10804f08a521d1e421959b36272a54449e5c2d29 100644 (file)
@@ -869,11 +869,9 @@ struct slap_internal_schema {
        /* Matching Rules */
        MatchingRule    *si_mr_distinguishedNameMatch;
        MatchingRule    *si_mr_dnSubtreeMatch;
-#if 0
        MatchingRule    *si_mr_dnOneLevelMatch;
        MatchingRule    *si_mr_dnSubordinateMatch;
        MatchingRule    *si_mr_dnSuperiorMatch;
-#endif
        MatchingRule    *si_mr_caseExactMatch;
        MatchingRule    *si_mr_caseExactSubstringsMatch;
        MatchingRule    *si_mr_caseExactIA5Match;