Misc extensible match clean up.

This commit is contained in:
Kurt Zeilenga 2002-03-11 01:48:37 +00:00
parent a5b0759733
commit c02f448a16
3 changed files with 37 additions and 8 deletions

View file

@ -736,6 +736,24 @@ filter2bv( Filter *f, struct berval *fstr )
break;
case LDAP_FILTER_EXT:
filter_escape_value( &f->f_mr_value, &tmp );
fstr->bv_len = f->f_mr_desc->ad_cname.bv_len +
( f->f_mr_dnattrs ? sizeof(":dn")-1 : 0 ) +
( f->f_mr_rule_text.bv_len ? f->f_mr_rule_text.bv_len+1 : 0 ) +
tmp.bv_len + ( sizeof("(:=)") - 1 );
fstr->bv_val = malloc( fstr->bv_len + 1 );
snprintf( fstr->bv_val, fstr->bv_len + 1, "(%s%s%s%s:=%s)",
f->f_mr_desc->ad_cname.bv_val,
f->f_mr_dnattrs ? ":dn" : "",
f->f_mr_rule_text.bv_len ? ":" : "",
f->f_mr_rule_text.bv_len ? f->f_mr_rule_text.bv_val : "",
tmp.bv_val );
ber_memfree( tmp.bv_val );
break;
case SLAPD_FILTER_COMPUTED:
ber_str2bv(
f->f_result == LDAP_COMPARE_FALSE ? "(?=false)" :

View file

@ -227,23 +227,30 @@ static int test_mra_filter(
{
Attribute *a;
if( mra->ma_desc == NULL || mra->ma_dnattrs ) {
return LDAP_INAPPROPRIATE_MATCHING;
}
if( !access_allowed( be, conn, op, e,
mra->ma_desc, &mra->ma_value, ACL_SEARCH, NULL ) )
{
return LDAP_INSUFFICIENT_ACCESS;
}
if( mra->ma_rule == NULL ) {
mra->ma_rule = mra->ma_desc->ad_type->sat_equality;
}
if( mra->ma_rule == NULL ) {
return LDAP_INAPPROPRIATE_MATCHING;
}
if( strcmp(mra->ma_rule->smr_syntax->ssyn_oid,
mra->ma_desc->ad_type->sat_syntax->ssyn_oid) != 0)
{
return LDAP_INVALID_SYNTAX;
}
if( mra->ma_rule == NULL )
{
return LDAP_INAPPROPRIATE_MATCHING;
}
for(a = attrs_find( e->e_attrs, mra->ma_desc );
a != NULL;
a = attrs_find( a->a_next, mra->ma_desc ) )
@ -263,7 +270,7 @@ static int test_mra_filter(
return rc;
}
if ( ret ) {
if ( ret == 0 ) {
return LDAP_COMPARE_TRUE;
}
}

View file

@ -999,7 +999,9 @@ caseExactMatch(
struct berval *value,
void *assertedValue )
{
*matchp = UTF8bvnormcmp( value, (struct berval *) assertedValue, LDAP_UTF8_NOCASEFOLD );
*matchp = UTF8bvnormcmp( value,
(struct berval *) assertedValue,
LDAP_UTF8_NOCASEFOLD );
return LDAP_SUCCESS;
}
@ -1645,7 +1647,9 @@ caseIgnoreMatch(
struct berval *value,
void *assertedValue )
{
*matchp = UTF8bvnormcmp( value, (struct berval *) assertedValue, LDAP_UTF8_CASEFOLD );
*matchp = UTF8bvnormcmp( value,
(struct berval *) assertedValue,
LDAP_UTF8_CASEFOLD );
return LDAP_SUCCESS;
}