Commit 2da2630f authored by Kurt Zeilenga's avatar Kurt Zeilenga
Browse files

Fixed slapd modify/delete by ordered index issue

parent ceae1376
......@@ -6,6 +6,7 @@ OpenLDAP 2.3.14 Engineering
Fixed slapd sc_prev update after free bug (ITS#4237)
Fixed slapd pid file creation (ITS#4241)
Fixed slapd DEBUG dependency (ITS#4245)
Fixed slapd modify/delete by ordered index issue
Fixed slapd-glue (ITS#4084,4133)
Fixed slapd-hdb idl Delete bug (ITS#4250)
Fixed slapd-hdb cache deadlock (ITS#4254)
......
......@@ -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] );
......
......@@ -1632,7 +1632,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;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment