mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
Fix mod delete by ordered index
This commit is contained in:
parent
10d8ae3c51
commit
bb1984eb3e
@ -282,7 +282,7 @@ str2entry2( char *s, int checkvals )
|
||||
* validate value per syntax
|
||||
*/
|
||||
#ifdef SLAP_ORDERED_PRETTYNORM
|
||||
rc = ordered_value_validate( ad, &vals[i] );
|
||||
rc = ordered_value_validate( ad, &vals[i], LDAP_MOD_ADD );
|
||||
#else /* ! SLAP_ORDERED_PRETTYNORM */
|
||||
rc = validate( ad->ad_type->sat_syntax, &vals[i] );
|
||||
#endif /* ! SLAP_ORDERED_PRETTYNORM */
|
||||
|
@ -665,7 +665,7 @@ int slap_mods_check(
|
||||
} else {
|
||||
#ifdef SLAP_ORDERED_PRETTYNORM
|
||||
rc = ordered_value_validate( ad,
|
||||
&ml->sml_values[nvals] );
|
||||
&ml->sml_values[nvals], ml->sml_op );
|
||||
#else /* ! SLAP_ORDERED_PRETTYNORM */
|
||||
rc = validate( ad->ad_type->sat_syntax,
|
||||
&ml->sml_values[nvals] );
|
||||
|
@ -1635,7 +1635,8 @@ LDAP_SLAPD_F (int) ordered_value_add LDAP_P((
|
||||
|
||||
LDAP_SLAPD_F (int) ordered_value_validate LDAP_P((
|
||||
AttributeDescription *ad,
|
||||
struct berval *in ));
|
||||
struct berval *in,
|
||||
int mop ));
|
||||
|
||||
LDAP_SLAPD_F (int) ordered_value_pretty LDAP_P((
|
||||
AttributeDescription *ad,
|
||||
|
@ -409,12 +409,13 @@ ordered_value_sort( Attribute *a, int do_renumber )
|
||||
/*
|
||||
* wrapper for validate function
|
||||
* uses the validate function of the syntax after removing
|
||||
* the index, if allowed an present
|
||||
* the index, if allowed and present
|
||||
*/
|
||||
int
|
||||
ordered_value_validate(
|
||||
AttributeDescription *ad,
|
||||
struct berval *in )
|
||||
struct berval *in,
|
||||
int mop )
|
||||
{
|
||||
struct berval bv = *in;
|
||||
|
||||
@ -435,6 +436,9 @@ ordered_value_validate(
|
||||
bv.bv_len -= ptr - bv.bv_val;
|
||||
bv.bv_val = ptr;
|
||||
in = &bv;
|
||||
/* If deleting by index, just succeed */
|
||||
if ( mop == LDAP_MOD_DELETE && BER_BVISEMPTY( &bv ))
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
@ -544,6 +548,11 @@ ordered_value_normalize(
|
||||
bv.bv_len -= idx.bv_len;
|
||||
bv.bv_val = ptr;
|
||||
|
||||
/* validator will already prevent this for Adds */
|
||||
if ( BER_BVISEMPTY( &bv )) {
|
||||
ber_dupbv_x( normalized, &idx, ctx );
|
||||
return LDAP_SUCCESS;
|
||||
}
|
||||
val = &bv;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user