)
{
for ( ; a != NULL; a = a->a_next ) {
- if ( is_ad_subtype( a->a_desc, desc ) == 0 ) {
+ if ( is_ad_subtype( a->a_desc, desc ) ) {
return( a );
}
}
#endif
for ( i = 0; a->a_vals[i] != NULL; i++ ) {
- int rc;
+ int ret;
#ifdef SLAPD_SCHEMA_NOT_COMPAT
+ int rc;
const char *text;
- rc = value_match( a->a_desc, mr,
+ rc = value_match( &ret, a->a_desc, mr,
a->a_vals[i], ava->aa_value,
&text );
+
+ if( rc != LDAP_SUCCESS ) {
+ return rc;
+ }
#else
- rc = value_cmp( a->a_vals[i], &ava->ava_value, a->a_syntax,
+ ret = value_cmp( a->a_vals[i], &ava->ava_value, a->a_syntax,
3 );
#endif
switch ( type ) {
case LDAP_FILTER_EQUALITY:
case LDAP_FILTER_APPROX:
- if ( rc == 0 ) {
+ if ( ret == 0 ) {
return LDAP_COMPARE_TRUE;
}
break;
case LDAP_FILTER_GE:
- if ( rc >= 0 ) {
+ if ( ret >= 0 ) {
return LDAP_COMPARE_TRUE;
}
break;
case LDAP_FILTER_LE:
- if ( rc <= 0 ) {
+ if ( ret <= 0 ) {
return LDAP_COMPARE_TRUE;
}
break;
struct berval **out,
const char ** text ));
LIBSLAPD_F (int) value_match LDAP_P((
+ int *match,
AttributeDescription *ad,
MatchingRule *mr,
struct berval *v1,
static int
caseExactIA5Match(
+ int *match,
unsigned use,
Syntax *syntax,
MatchingRule *mr,
struct berval *value,
void *assertedValue )
{
- return strcmp( value->bv_val,
+ *match = strcmp( value->bv_val,
((struct berval *) assertedValue)->bv_val );
+ return LDAP_SUCCESS;
}
static int
caseIgnoreIA5Match(
+ int *match,
unsigned use,
Syntax *syntax,
MatchingRule *mr,
struct berval *value,
void *assertedValue )
{
- return strcasecmp( value->bv_val,
+ *match = strcasecmp( value->bv_val,
((struct berval *) assertedValue)->bv_val );
+ return LDAP_SUCCESS;
}
static int
objectClassMatch(
+ int *match,
unsigned use,
Syntax *syntax,
MatchingRule *mr,
ObjectClass *oc = oc_find( value->bv_val );
ObjectClass *asserted = oc_find( ((struct berval *) assertedValue)->bv_val );
- return oc == NULL || oc != asserted;
+ *match = ( oc == NULL || oc != asserted );
+ return LDAP_SUCCESS;
}
struct syntax_defs_rec {
/* Match (compare) function */
typedef int slap_mr_match_func LDAP_P((
+ int *match,
unsigned use,
struct slap_syntax *syntax, /* syntax of stored value */
struct slap_matching_rule *mr,
#ifdef SLAPD_SCHEMA_NOT_COMPAT
int
value_match(
+ int *match,
AttributeDescription *ad,
MatchingRule *mr,
struct berval *v1, /* (unnormalized) stored value */
struct berval *v2, /* (normalized) asserted value */
const char ** text )
{
- /* not yet implemented */
- return 0;
+ int rc;
+ int usage = 0;
+
+ if( !mr->smr_match ) {
+ return LDAP_INAPPROPRIATE_MATCHING;
+ }
+
+ rc = (mr->smr_match)( match, usage,
+ ad->ad_type->sat_syntax,
+ mr, v1, v2 );
+
+ return rc;
}
+
#else
int
value_cmp(
for ( i = 0; vals[i] != NULL; i++ ) {
#ifdef SLAPD_SCHEMA_NOT_COMPAT
- if ( value_match( ad, mr, vals[i], val, text ) == 0 )
+ int rc;
+ int match;
+ rc = value_match( &match, ad, mr, vals[i], val, text );
+
+ if( rc == LDAP_SUCCESS && match == 0 )
#else
if ( value_cmp( vals[i], v, syntax, normalize ) == 0 )
#endif