mirror of
https://git.openldap.org/openldap/openldap.git
synced 2025-01-12 10:54:48 +08:00
ITS#6845 don't muck with save_attrs for index deletes, use a new array
This commit is contained in:
parent
7288804425
commit
bc2b9f54f7
@ -339,31 +339,23 @@ int bdb_modify_internal(
|
|||||||
if ( a2 ) {
|
if ( a2 ) {
|
||||||
/* need to detect which values were deleted */
|
/* need to detect which values were deleted */
|
||||||
int i, j;
|
int i, j;
|
||||||
struct berval tmp;
|
vals = op->o_tmpalloc( (ap->a_numvals + 1) *
|
||||||
j = ap->a_numvals;
|
sizeof(struct berval), op->o_tmpmemctx );
|
||||||
for ( i=0; i<j; ) {
|
j = 0;
|
||||||
|
for ( i=0; i < ap->a_numvals; i++ ) {
|
||||||
rc = attr_valfind( a2, SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
|
rc = attr_valfind( a2, SLAP_MR_ASSERTED_VALUE_NORMALIZED_MATCH,
|
||||||
&ap->a_nvals[i], NULL, op->o_tmpmemctx );
|
&ap->a_nvals[i], NULL, op->o_tmpmemctx );
|
||||||
/* Move deleted values to end of array */
|
/* Save deleted values */
|
||||||
if ( rc == LDAP_NO_SUCH_ATTRIBUTE ) {
|
if ( rc == LDAP_NO_SUCH_ATTRIBUTE )
|
||||||
j--;
|
vals[j++] = ap->a_nvals[i];
|
||||||
if ( i != j ) {
|
|
||||||
tmp = ap->a_nvals[j];
|
|
||||||
ap->a_nvals[j] = ap->a_nvals[i];
|
|
||||||
ap->a_nvals[i] = tmp;
|
|
||||||
tmp = ap->a_vals[j];
|
|
||||||
ap->a_vals[j] = ap->a_vals[i];
|
|
||||||
ap->a_vals[i] = tmp;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
vals = &ap->a_nvals[j];
|
BER_BVZERO(vals+j);
|
||||||
} else {
|
} else {
|
||||||
/* attribute was completely deleted */
|
/* attribute was completely deleted */
|
||||||
vals = ap->a_nvals;
|
vals = ap->a_nvals;
|
||||||
}
|
}
|
||||||
|
rc = 0;
|
||||||
if ( !BER_BVISNULL( vals )) {
|
if ( !BER_BVISNULL( vals )) {
|
||||||
rc = bdb_index_values( op, tid, ap->a_desc,
|
rc = bdb_index_values( op, tid, ap->a_desc,
|
||||||
vals, e->e_id, SLAP_INDEX_DELETE_OP );
|
vals, e->e_id, SLAP_INDEX_DELETE_OP );
|
||||||
@ -373,9 +365,11 @@ int bdb_modify_internal(
|
|||||||
op->o_log_prefix, ap->a_desc->ad_cname.bv_val, 0 );
|
op->o_log_prefix, ap->a_desc->ad_cname.bv_val, 0 );
|
||||||
attrs_free( e->e_attrs );
|
attrs_free( e->e_attrs );
|
||||||
e->e_attrs = save_attrs;
|
e->e_attrs = save_attrs;
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ( vals != ap->a_nvals )
|
||||||
|
op->o_tmpfree( vals, op->o_tmpmemctx );
|
||||||
|
if ( rc ) return rc;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user