mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-15 03:01:09 +08:00
SLAPD_SCHEMA_NOT_COMPAT: equality filters
(2.5.4.0=2.5.6.0) works! ie: (objectclass=top)
This commit is contained in:
parent
522761dc17
commit
c1da50a426
@ -223,7 +223,7 @@ attrs_find(
|
||||
)
|
||||
{
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
@ -253,34 +253,39 @@ test_ava_filter(
|
||||
#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;
|
||||
|
@ -686,6 +686,7 @@ LIBSLAPD_F (int) value_normalize LDAP_P((
|
||||
struct berval **out,
|
||||
const char ** text ));
|
||||
LIBSLAPD_F (int) value_match LDAP_P((
|
||||
int *match,
|
||||
AttributeDescription *ad,
|
||||
MatchingRule *mr,
|
||||
struct berval *v1,
|
||||
|
@ -307,30 +307,35 @@ IA5StringNormalize(
|
||||
|
||||
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,
|
||||
@ -340,7 +345,8 @@ objectClassMatch(
|
||||
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 {
|
||||
|
@ -191,6 +191,7 @@ typedef int slap_mr_normalize_func LDAP_P((
|
||||
|
||||
/* 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,
|
||||
|
@ -177,15 +177,27 @@ value_normalize(
|
||||
#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(
|
||||
@ -256,7 +268,11 @@ value_find(
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user