mirror of
https://git.openldap.org/openldap/openldap.git
synced 2026-01-08 16:04:47 -05:00
Change MR flag names and add comments as to what they mean to slap.h
This commit is contained in:
parent
a5e883a886
commit
25886d989a
8 changed files with 64 additions and 43 deletions
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
||||
|
|
|
|||
|
|
@ -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 );
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
(!((usage) & SLAP_MR_ATTRIBUTE_SYNTAX_MATCH))
|
||||
#define SLAP_IS_MR_ATTRIBUTE_SYNTAX_MATCH( usage ) \
|
||||
((usage) & SLAP_MR_ATTRIBUTE_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)
|
||||
#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;
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in a new issue