mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-06 10:46:21 +08:00
Replacement for value_find and compatibility macro.
Now we will be able to fix compares.
This commit is contained in:
parent
de353ebeda
commit
cb98a604fb
@ -756,10 +756,12 @@ LDAP_SLAPD_F (int) value_match LDAP_P((
|
||||
struct berval *v1,
|
||||
void *v2,
|
||||
const char ** text ));
|
||||
LDAP_SLAPD_F (int) value_find LDAP_P((
|
||||
LDAP_SLAPD_F (int) value_find_ex LDAP_P((
|
||||
AttributeDescription *ad,
|
||||
unsigned flags,
|
||||
struct berval **values,
|
||||
struct berval *value ));
|
||||
#define value_find(ad, values, value) ( value_find_ex(ad,0,values,value ) )
|
||||
LDAP_SLAPD_F (int) value_add LDAP_P(( struct berval ***vals, struct berval **addvals ));
|
||||
|
||||
/*
|
||||
|
@ -168,25 +168,39 @@ value_match(
|
||||
}
|
||||
|
||||
|
||||
int value_find(
|
||||
int value_find_ex(
|
||||
AttributeDescription *ad,
|
||||
unsigned flags,
|
||||
struct berval **vals,
|
||||
struct berval *val )
|
||||
{
|
||||
int i;
|
||||
int rc;
|
||||
struct berval *nval = NULL;
|
||||
struct berval *nval_tmp = NULL;
|
||||
MatchingRule *mr = ad->ad_type->sat_equality;
|
||||
|
||||
if( mr == NULL || !mr->smr_match ) {
|
||||
return LDAP_INAPPROPRIATE_MATCHING;
|
||||
}
|
||||
|
||||
/* Take care of this here or ssyn_normalize later will hurt */
|
||||
if ( !(flags & SLAP_MR_VALUE_IS_IN_MR_SYNTAX) &&
|
||||
mr->smr_convert ) {
|
||||
rc = (mr->smr_convert)(val,&nval);
|
||||
if ( rc != LDAP_SUCCESS ) {
|
||||
return LDAP_INVALID_SYNTAX;
|
||||
}
|
||||
}
|
||||
|
||||
if( mr->smr_syntax->ssyn_normalize ) {
|
||||
rc = mr->smr_syntax->ssyn_normalize(
|
||||
mr->smr_syntax, val, &nval );
|
||||
mr->smr_syntax, nval == NULL ? val : nval, &nval_tmp );
|
||||
|
||||
ber_bvfree(nval);
|
||||
nval = nval_tmp;
|
||||
if( rc != LDAP_SUCCESS ) {
|
||||
ber_bvfree(nval);
|
||||
return LDAP_INAPPROPRIATE_MATCHING;
|
||||
}
|
||||
}
|
||||
@ -195,7 +209,9 @@ int value_find(
|
||||
int match;
|
||||
const char *text;
|
||||
|
||||
rc = value_match( &match, ad, mr, 0,
|
||||
/* We did convert, so keep value_match from trying */
|
||||
rc = value_match( &match, ad, mr,
|
||||
flags & !SLAP_MR_VALUE_IS_IN_MR_SYNTAX,
|
||||
vals[i], nval == NULL ? val : nval, &text );
|
||||
|
||||
if( rc == LDAP_SUCCESS && match == 0 ) {
|
||||
|
Loading…
Reference in New Issue
Block a user