From: Kurt Zeilenga Date: Thu, 9 Sep 2004 03:56:58 +0000 (+0000) Subject: Add additional DN matching rules. X-Git-Tag: OPENLDAP_REL_ENG_2_3_0ALPHA~556 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=910076d26f45089e129a5ec29bb1b01a5981586c;p=openldap Add additional DN matching rules. --- diff --git a/servers/slapd/dn.c b/servers/slapd/dn.c index 9b6edbcf68..c45e6917ef 100644 --- a/servers/slapd/dn.c +++ b/servers/slapd/dn.c @@ -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; } diff --git a/servers/slapd/schema_init.c b/servers/slapd/schema_init.c index 07d3ceccac..a0e5fe6a06 100644 --- a/servers/slapd/schema_init.c +++ b/servers/slapd/schema_init.c @@ -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 )", diff --git a/servers/slapd/schema_prep.c b/servers/slapd/schema_prep.c index 82ab93dea1..a368e51e31 100644 --- a/servers/slapd/schema_prep.c +++ b/servers/slapd/schema_prep.c @@ -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", diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index e22a503e09..10804f08a5 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -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;