From: Kurt Zeilenga Date: Wed, 26 Feb 2003 02:55:28 +0000 (+0000) Subject: Change MR flag names and add comments as to what they mean to slap.h X-Git-Tag: NO_SLAP_OP_BLOCKS~294 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=25886d989a7aea00d127ec75b797fef7a559a406;p=openldap Change MR flag names and add comments as to what they mean to slap.h --- diff --git a/servers/slapd/acl.c b/servers/slapd/acl.c index 20935cad3d..579add45d4 100644 --- a/servers/slapd/acl.c +++ b/servers/slapd/acl.c @@ -889,7 +889,9 @@ dn_match_cleanup:; at = attrs_find( at->a_next, b->a_dn_at ) ) { if( value_find_ex( b->a_dn_at, - SLAP_MR_VALUE_NORMALIZED_MATCH, at->a_vals, &bv ) == 0 ) { + SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH, at->a_vals, &bv ) + == 0 ) + { /* found it */ match = 1; break; @@ -902,8 +904,8 @@ dn_match_cleanup:; */ if ( b->a_dn_self ) { /* check if the target is an attribute. */ - if ( val == NULL ) - continue; + if ( val == NULL ) continue; + /* target is attribute, check if the attribute value * is the op dn. */ diff --git a/servers/slapd/back-bdb/group.c b/servers/slapd/back-bdb/group.c index d449056794..0f38e6d349 100644 --- a/servers/slapd/back-bdb/group.c +++ b/servers/slapd/back-bdb/group.c @@ -206,8 +206,10 @@ dn2entry_retry: group_oc_name, group_at_name, 0 ); #endif - if( value_find_ex( group_at, SLAP_MR_VALUE_NORMALIZED_MATCH, - attr->a_vals, op_ndn ) != LDAP_SUCCESS ) { + if( value_find_ex( group_at, + SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH, + attr->a_vals, op_ndn ) != LDAP_SUCCESS ) + { #ifdef NEW_LOGGING LDAP_LOG( BACK_BDB, DETAIL1, "bdb_group: \"%s\" not in \"%s\": %s\n", diff --git a/servers/slapd/back-ldbm/group.c b/servers/slapd/back-ldbm/group.c index 5507a78774..1bf1802645 100644 --- a/servers/slapd/back-ldbm/group.c +++ b/servers/slapd/back-ldbm/group.c @@ -178,8 +178,9 @@ ldbm_back_group( #endif - if( value_find_ex( group_at, SLAP_MR_VALUE_NORMALIZED_MATCH, - attr->a_vals, op_ndn ) != LDAP_SUCCESS ) { + if( value_find_ex( group_at, SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH, + attr->a_vals, op_ndn ) != LDAP_SUCCESS ) + { #ifdef NEW_LOGGING LDAP_LOG( BACK_LDBM, DETAIL1, "ldbm_back_group: \"%s\" not in \"%s\": %s\n", diff --git a/servers/slapd/back-monitor/log.c b/servers/slapd/back-monitor/log.c index 121820dc09..dcc34c4bb3 100644 --- a/servers/slapd/back-monitor/log.c +++ b/servers/slapd/back-monitor/log.c @@ -308,7 +308,6 @@ add_values( Entry *e, Modification *mod, int *newlevel ) a = attr_find( e->e_attrs, mod->sm_desc ); if ( a != NULL ) { - /* "description" SHOULD have appropriate rules ... */ if ( mr == NULL || !mr->smr_match ) { return LDAP_INAPPROPRIATE_MATCHING; @@ -321,10 +320,10 @@ add_values( Entry *e, Modification *mod, int *newlevel ) struct berval asserted; rc = value_normalize( mod->sm_desc, - SLAP_MR_EQUALITY, - &mod->sm_bvalues[i], - &asserted, - &text ); + SLAP_MR_EQUALITY, + &mod->sm_bvalues[i], + &asserted, + &text ); if ( rc != LDAP_SUCCESS ) { return rc; @@ -333,8 +332,8 @@ add_values( Entry *e, Modification *mod, int *newlevel ) for ( j = 0; a->a_vals[j].bv_val != NULL; j++ ) { int match; int rc = value_match( &match, mod->sm_desc, mr, - SLAP_MR_VALUE_SYNTAX_MATCH, - &a->a_vals[j], &asserted, &text ); + SLAP_MR_ATTRIBUTE_SYNTAX_MATCH, + &a->a_vals[j], &asserted, &text ); if ( rc == LDAP_SUCCESS && match == 0 ) { free( asserted.bv_val ); @@ -412,8 +411,8 @@ delete_values( Entry *e, Modification *mod, int *newlevel ) for ( j = 0; a->a_vals[j].bv_val != NULL; j++ ) { int match; int rc = value_match( &match, mod->sm_desc, mr, - SLAP_MR_VALUE_SYNTAX_MATCH, - &a->a_vals[j], &asserted, &text ); + SLAP_MR_ATTRIBUTE_SYNTAX_MATCH, + &a->a_vals[j], &asserted, &text ); if( rc == LDAP_SUCCESS && match != 0 ) { continue; diff --git a/servers/slapd/mods.c b/servers/slapd/mods.c index 26bdad092a..37392a41b9 100644 --- a/servers/slapd/mods.c +++ b/servers/slapd/mods.c @@ -135,7 +135,7 @@ modify_check_duplicates( int match; rc = (*mr->smr_match)( &match, - SLAP_MR_VALUE_SYNTAX_MATCH, + SLAP_MR_ATTRIBUTE_SYNTAX_MATCH, ad->ad_type->sat_syntax, mr, &nmods[ i ], &nvals[ j ] ); if ( rc != LDAP_SUCCESS ) { @@ -173,7 +173,7 @@ modify_check_duplicates( int match; rc = (*mr->smr_match)( &match, - SLAP_MR_VALUE_SYNTAX_MATCH, + SLAP_MR_ATTRIBUTE_SYNTAX_MATCH, ad->ad_type->sat_syntax, mr, &nmods[ i ], &nmods[ j ] ); if ( rc != LDAP_SUCCESS ) { @@ -230,7 +230,7 @@ modify_check_duplicates( int match; rc = (*mr->smr_match)( &match, - SLAP_MR_VALUE_SYNTAX_MATCH, + SLAP_MR_ATTRIBUTE_SYNTAX_MATCH, ad->ad_type->sat_syntax, mr, &nmods[ i ], &asserted ); if ( rc != LDAP_SUCCESS ) { @@ -405,7 +405,7 @@ modify_add_values( int match; rc = value_match( &match, mod->sm_desc, mr, - SLAP_MR_VALUE_SYNTAX_MATCH, + SLAP_MR_ATTRIBUTE_SYNTAX_MATCH, &a->a_vals[ i ], &asserted, text ); if( rc == LDAP_SUCCESS && match == 0 ) { @@ -567,7 +567,7 @@ modify_delete_values( } rc = (*mr->smr_match)( &match, - SLAP_MR_VALUE_SYNTAX_MATCH, + SLAP_MR_ATTRIBUTE_SYNTAX_MATCH, a->a_desc->ad_type->sat_syntax, mr, &nvals[ j ], &asserted ); diff --git a/servers/slapd/schema_prep.c b/servers/slapd/schema_prep.c index 1fc700ba12..9b1dbb57e0 100644 --- a/servers/slapd/schema_prep.c +++ b/servers/slapd/schema_prep.c @@ -90,7 +90,7 @@ objectSubClassMatch( return SLAPD_COMPARE_UNDEFINED; } - if( SLAP_IS_MR_VALUE_SYNTAX_MATCH( flags ) ) { + if( SLAP_IS_MR_ATTRIBUTE_SYNTAX_MATCH( flags ) ) { *matchp = ( asserted != oc ); } else { *matchp = !is_object_subclass( asserted, oc ); diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 5a9984bcd4..7a5ff020da 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -428,28 +428,44 @@ typedef struct slap_matching_rule { #define SLAP_MR_SUBSTR_FINAL ( SLAP_MR_SUBSTR | 0x0040U ) /* - * normally the provided value is expected to conform to + * normally the asserted value is expected to conform to * assertion syntax specified in the matching rule, however * at times (such as during individual value modification), - * the provided value is expected to conform to the + * the asserted value is expected to conform to the * attribute's value syntax. */ -#define SLAP_MR_ASSERTION_SYNTAX_MATCH 0x0000U -#define SLAP_MR_VALUE_SYNTAX_MATCH 0x0001U -#define SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH 0x0003U -#define SLAP_MR_VALUE_NORMALIZED_MATCH 0x0004U +#define SLAP_MR_ASSERTION_SYNTAX_MATCH 0x0000U +#define SLAP_MR_ATTRIBUTE_SYNTAX_MATCH 0x0001U + +/* For SLAP_MR_ATTRIBUTE_SYNTAX_MATCHes, this flag indicates + * that the asserted value of the attribute syntax has been + * converted to the assertion syntax. (Not sure why we just + * don't clear the SLAP_MR_ATTRIBUTE_SYNTAX_MATCH flag instead.) + */ +#define SLAP_MR_ATTRIBUTE_SYNTAX_CONVERTED_MATCH 0x0002U + +/* either or both the asserted value or attribute value + * may be provided in normalized form + */ +#define SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH 0x0004U +#define SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH 0x0008U #define SLAP_IS_MR_ASSERTION_SYNTAX_MATCH( usage ) \ - (!((usage) & SLAP_MR_VALUE_SYNTAX_MATCH)) -#define SLAP_IS_MR_VALUE_SYNTAX_MATCH( usage ) \ - ((usage) & SLAP_MR_VALUE_SYNTAX_MATCH) - -#define SLAP_IS_MR_VALUE_SYNTAX_CONVERTED_MATCH( usage ) \ - (((usage) & SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH) \ - == SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH) -#define SLAP_IS_MR_VALUE_SYNTAX_NONCONVERTED_MATCH( usage ) \ - (((usage) & SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH) \ - == SLAP_MR_VALUE_SYNTAX_MATCH) + (!((usage) & SLAP_MR_ATTRIBUTE_SYNTAX_MATCH)) +#define SLAP_IS_MR_ATTRIBUTE_SYNTAX_MATCH( usage ) \ + ((usage) & SLAP_MR_ATTRIBUTE_SYNTAX_MATCH) + +#define SLAP_IS_MR_ATTRIBUTE_SYNTAX_CONVERTED_MATCH( usage ) \ + (((usage) & SLAP_MR_ATTRIBUTE_SYNTAX_CONVERTED_MATCH) \ + == SLAP_MR_ATTRIBUTE_SYNTAX_CONVERTED_MATCH) +#define SLAP_IS_MR_ATTRIBUTE_SYNTAX_NONCONVERTED_MATCH( usage ) \ + (((usage) & SLAP_MR_ATTRIBUTE_SYNTAX_CONVERTED_MATCH) \ + == SLAP_MR_ATTRIBUTE_SYNTAX_MATCH) + +#define SLAP_IS_MR_ASSERTED_VALUE_NORMALIZED_MATCH( usage ) \ + ((usage) & SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH ) +#define SLAP_IS_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH( usage ) \ + ((usage) & SLAP_MR_ATTRIBUTE_VALUE_NORMALIZED_MATCH ) Syntax *smr_syntax; slap_mr_convert_func *smr_convert; diff --git a/servers/slapd/value.c b/servers/slapd/value.c index e93c80c050..ab5d175086 100644 --- a/servers/slapd/value.c +++ b/servers/slapd/value.c @@ -339,7 +339,7 @@ value_match( } } - if ( SLAP_IS_MR_VALUE_SYNTAX_NONCONVERTED_MATCH( flags ) && + if ( SLAP_IS_MR_ATTRIBUTE_SYNTAX_NONCONVERTED_MATCH( flags ) && mr->smr_convert ) { rc = (mr->smr_convert)( v2, &nv2 ); @@ -348,7 +348,7 @@ value_match( } /* let smr_match know we've converted the value */ - flags |= SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH; + flags |= SLAP_MR_ATTRIBUTE_SYNTAX_CONVERTED_MATCH; } rc = (mr->smr_match)( match, flags, @@ -379,7 +379,7 @@ int value_find_ex( } /* Take care of this here or ssyn_normalize later will hurt */ - if ( SLAP_IS_MR_VALUE_SYNTAX_NONCONVERTED_MATCH( flags ) + if ( SLAP_IS_MR_ATTRIBUTE_SYNTAX_NONCONVERTED_MATCH( flags ) && mr->smr_convert ) { rc = (mr->smr_convert)( val, &nval ); @@ -388,11 +388,12 @@ int value_find_ex( } /* let value_match know we've done the version */ - flags |= SLAP_MR_VALUE_SYNTAX_CONVERTED_MATCH; + flags |= SLAP_MR_ATTRIBUTE_SYNTAX_CONVERTED_MATCH; } - if( !(flags & SLAP_MR_VALUE_NORMALIZED_MATCH) && - mr->smr_syntax->ssyn_normalize ) { + if( !(flags & SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH) && + mr->smr_syntax->ssyn_normalize ) + { struct berval nval_tmp = { 0, NULL }; rc = mr->smr_syntax->ssyn_normalize(