mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Add mr_usable_with_at() routine. Use both in generation
of rule uses, but also in test_filter_mra()
This commit is contained in:
parent
5c61f55faa
commit
c6052ac8b0
@ -270,8 +270,7 @@ static int test_mra_filter(
|
|||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
/* check if matching is appropriate */
|
/* check if matching is appropriate */
|
||||||
if ( strcmp( mra->ma_rule->smr_syntax->ssyn_oid,
|
if ( !mr_usable_with_at( mra->ma_rule, a->a_desc->ad_type )) {
|
||||||
a->a_desc->ad_type->sat_syntax->ssyn_oid ) != 0 ) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,8 +345,7 @@ static int test_mra_filter(
|
|||||||
const char *text = NULL;
|
const char *text = NULL;
|
||||||
|
|
||||||
/* check if matching is appropriate */
|
/* check if matching is appropriate */
|
||||||
if ( strcmp( mra->ma_rule->smr_syntax->ssyn_oid,
|
if ( !mr_usable_with_at( mra->ma_rule, ad->ad_type )) {
|
||||||
ad->ad_type->sat_syntax->ssyn_oid ) != 0 ) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -383,21 +383,9 @@ matching_rule_use_init( void )
|
|||||||
at = NULL;
|
at = NULL;
|
||||||
for ( at_start( &at ); at; at_next( &at ) ) {
|
for ( at_start( &at ); at; at_next( &at ) ) {
|
||||||
if( at->sat_flags & SLAP_AT_HIDE ) continue;
|
if( at->sat_flags & SLAP_AT_HIDE ) continue;
|
||||||
if( mr->smr_usage & SLAP_MR_EXT && (
|
|
||||||
mr->smr_syntax == at->sat_syntax ||
|
|
||||||
mr == at->sat_equality ||
|
|
||||||
mr == at->sat_approx ) )
|
|
||||||
{
|
|
||||||
ldap_charray_add( &applies_oids, at->sat_cname.bv_val );
|
|
||||||
|
|
||||||
} else if ( mr->smr_compat_syntaxes ) {
|
if( mr_usable_with_at( mr, at )) {
|
||||||
int i;
|
ldap_charray_add( &applies_oids, at->sat_cname.bv_val );
|
||||||
for( i=0; mr->smr_compat_syntaxes[i]; i++ ) {
|
|
||||||
if( at->sat_syntax == mr->smr_compat_syntaxes[i] ) {
|
|
||||||
ldap_charray_add( &applies_oids, at->sat_cname.bv_val );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,6 +425,27 @@ matching_rule_use_init( void )
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int mr_usable_with_at(
|
||||||
|
MatchingRule *mr,
|
||||||
|
AttributeType *at )
|
||||||
|
{
|
||||||
|
if( mr->smr_usage & SLAP_MR_EXT && (
|
||||||
|
mr->smr_syntax == at->sat_syntax ||
|
||||||
|
mr == at->sat_equality || mr == at->sat_approx ) )
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( mr->smr_compat_syntaxes ) {
|
||||||
|
int i;
|
||||||
|
for( i=0; mr->smr_compat_syntaxes[i]; i++ ) {
|
||||||
|
if( at->sat_syntax == mr->smr_compat_syntaxes[i] ) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
#if defined( SLAPD_SCHEMA_DN )
|
#if defined( SLAPD_SCHEMA_DN )
|
||||||
|
|
||||||
|
@ -630,6 +630,9 @@ LDAP_SLAPD_F (int) matching_rule_use_init LDAP_P(( void ));
|
|||||||
LDAP_SLAPD_F (int) mr_schema_info( Entry *e );
|
LDAP_SLAPD_F (int) mr_schema_info( Entry *e );
|
||||||
LDAP_SLAPD_F (int) mru_schema_info( Entry *e );
|
LDAP_SLAPD_F (int) mru_schema_info( Entry *e );
|
||||||
|
|
||||||
|
LDAP_SLAPD_F (int) mr_usable_with_at( MatchingRule *mr,
|
||||||
|
AttributeType *at );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mra.c
|
* mra.c
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user