From: Kurt Zeilenga Date: Tue, 7 Sep 2004 20:58:46 +0000 (+0000) Subject: Add presence and equality support for entryDN, X-Git-Tag: OPENLDAP_REL_ENG_2_3_0ALPHA~562 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=f9c9219f987afd633b668b116cbfeef82b9066dd;p=openldap Add presence and equality support for entryDN, extensible matching (the main objective) coming soon. (This stuff should really be table driven (for extensibility reasons).) --- diff --git a/servers/slapd/filterentry.c b/servers/slapd/filterentry.c index 0021f85996..29cb5b9085 100644 --- a/servers/slapd/filterentry.c +++ b/servers/slapd/filterentry.c @@ -359,7 +359,7 @@ test_ava_filter( && op && op->o_bd && op->o_bd->be_has_subordinates ) { int hasSubordinates; - struct berval hs; + struct berval hs; if( type != LDAP_FILTER_EQUALITY && type != LDAP_FILTER_APPROX ) @@ -388,6 +388,28 @@ test_ava_filter( return LDAP_COMPARE_FALSE; } + if ( ava->aa_desc == slap_schema.si_ad_entryDN ) { + MatchingRule *mr; + int rc, ret; + const char *text; + + if( type != LDAP_FILTER_EQUALITY && + type != LDAP_FILTER_APPROX ) + { + /* No other match is allowed */ + return LDAP_OTHER; + } + + mr = a->a_desc->ad_type->sat_equality; + assert( mr ); + + rc = value_match( &ret, a->a_desc, mr, 0, + &e->e_nname, &ava->aa_value, &text ); + + if( rc != LDAP_SUCCESS ) return rc; + if( ret == 0 ) return LDAP_COMPARE_TRUE; + return LDAP_COMPARE_FALSE; + } for(a = attrs_find( e->e_attrs, ava->aa_desc ); a != NULL; @@ -461,8 +483,7 @@ test_presence_filter( return LDAP_INSUFFICIENT_ACCESS; } - a = attrs_find( e->e_attrs, desc ); - if ( a == NULL && desc == slap_schema.si_ad_hasSubordinates ) { + if ( desc == slap_schema.si_ad_hasSubordinates ) { /* * XXX: fairly optimistic: if the function is defined, @@ -477,6 +498,14 @@ test_presence_filter( return LDAP_COMPARE_FALSE; } + if ( desc == slap_schema.si_ad_entryDN || + desc == slap_schema.si_ad_subschemaSubentry ) + { + /* entryDN and subschemaSubentry are always present */ + return LDAP_COMPARE_TRUE; + } + + a = attrs_find( e->e_attrs, desc ); return a != NULL ? LDAP_COMPARE_TRUE : LDAP_COMPARE_FALSE; } @@ -492,7 +521,6 @@ test_filter_and( Debug( LDAP_DEBUG_FILTER, "=> test_filter_and\n", 0, 0, 0 ); - for ( f = flist; f != NULL; f = f->f_next ) { int rc = test_filter( op, e, f );