From 70963520d4c300049d708b16814f0c8687ddb19d Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Tue, 1 Mar 2005 18:40:23 +0000 Subject: [PATCH] fix ITS#3406 wrt/ dnattr; silence warning --- servers/slapd/filterentry.c | 38 +++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/servers/slapd/filterentry.c b/servers/slapd/filterentry.c index 9c7fae7f6a..a9d8bd17a0 100644 --- a/servers/slapd/filterentry.c +++ b/servers/slapd/filterentry.c @@ -434,11 +434,13 @@ static int test_mra_filter( for ( iAVA = 0; rdn[ iAVA ]; iAVA++ ) { LDAPAVA *ava = rdn[ iAVA ]; - struct berval *bv = &ava->la_value, value; + struct berval *bv = &ava->la_value, + value = BER_BVNULL, + nbv = BER_BVNULL; AttributeDescription *ad = (AttributeDescription *)ava->la_private; - int ret; - const char *text; + int ret; + const char *text; assert( ad ); @@ -473,13 +475,37 @@ static int test_mra_filter( } } + if ( mra->ma_rule->smr_normalize ) { + /* see comment above */ + if ( mra->ma_rule->smr_normalize( + SLAP_MR_VALUE_OF_ATTRIBUTE_SYNTAX, + mra->ma_rule->smr_syntax, + mra->ma_rule, + bv, &nbv, memctx ) != LDAP_SUCCESS ) + { + /* FIXME: stop processing? */ + rc = LDAP_SUCCESS; + ret = -1; + goto cleanup; + } + + } else { + nbv = *bv; + } + /* check match */ rc = value_match( &ret, ad, mra->ma_rule, 0, - bv, &value, &text ); - if ( value.bv_val != mra->ma_value.bv_val ) { + &nbv, &value, &text ); + +cleanup:; + if ( !BER_BVISNULL( &value ) && value.bv_val != mra->ma_value.bv_val ) { memfree( value.bv_val, memctx ); } + if ( !BER_BVISNULL( &nbv ) && nbv.bv_val != bv->bv_val ) { + memfree( nbv.bv_val, memctx ); + } + if ( rc == LDAP_SUCCESS && ret == 0 ) rc = LDAP_COMPARE_TRUE; if ( rc != LDAP_SUCCESS ) { @@ -504,7 +530,7 @@ test_ava_filter( int rc; Attribute *a; #ifdef LDAP_COMP_MATCH - int i, num_attr_vals; + int i, num_attr_vals = 0; AttributeAliasing *a_alias = NULL; #endif -- 2.39.5