From 27f2fab636b852d8245edd1804d5a5aa0281fa75 Mon Sep 17 00:00:00 2001 From: Ludwig Krispenz Date: May 27 2014 15:09:52 +0000 Subject: Ticket 47806 - Failed deletion of aci: no such attribute Bug Description: an aci can be retrieved by doing an ldapsearch, but the attemt to delete this specific aci fails with err=16 Fix Description: the root cause for this problem is that there are many acis in this entry and the valuearray has an array of sorting indexes to use the performance improvement from ticket #346 But in replication update resolution values are moved using functions which are not aware of the attribute syntax and so the sorting gets out of order and the value to be deleted isn't found. NOTE 1: after restart the value could be deleted NOTE 2: with the latest fix for ticket 346 (comment 81) the bug isn't visible since the comparison functions used in both scenarios are similar. but the correct functions should be called. https://fedorahosted.org/389/ticket/47806 Reviewed by: Mark, Thanks --- diff --git a/ldap/servers/slapd/attr.c b/ldap/servers/slapd/attr.c index 39c6e99..a4cf6cb 100644 --- a/ldap/servers/slapd/attr.c +++ b/ldap/servers/slapd/attr.c @@ -840,7 +840,7 @@ attr_value_find_wsi(Slapi_Attr *a, const struct berval *bval, Slapi_Value **valu int slapi_attr_add_value(Slapi_Attr *a, const Slapi_Value *v) { - slapi_valueset_add_value( &a->a_present_values, v); + slapi_valueset_add_attr_value_ext( a, &a->a_present_values, (Slapi_Value *)v, 0); return 0; } @@ -869,7 +869,7 @@ slapi_attr_set_valueset(Slapi_Attr *a, const Slapi_ValueSet *vs) int attr_add_deleted_value(Slapi_Attr *a, const Slapi_Value *v) { - slapi_valueset_add_value( &a->a_deleted_values, v); + slapi_valueset_add_attr_value_ext( a, &a->a_deleted_values, (Slapi_Value *)v, 0); return 0; } diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c index 7a25489..5059457 100644 --- a/ldap/servers/slapd/entrywsi.c +++ b/ldap/servers/slapd/entrywsi.c @@ -52,7 +52,7 @@ entry_present_value_to_deleted_value(Slapi_Attr *a, Slapi_Value *v) Slapi_Value *r= valueset_remove_value(a, &a->a_present_values, v); if(r!=NULL) { - slapi_valueset_add_value_ext(&a->a_deleted_values, r, SLAPI_VALUE_FLAG_PASSIN); + slapi_valueset_add_attr_value_ext(a, &a->a_deleted_values, r, SLAPI_VALUE_FLAG_PASSIN); } return LDAP_SUCCESS; } @@ -77,7 +77,7 @@ entry_deleted_value_to_present_value(Slapi_Attr *a, Slapi_Value *v) Slapi_Value *r= valueset_remove_value(a, &a->a_deleted_values, v); if(r!=NULL) { - slapi_valueset_add_value_ext(&a->a_present_values, r, SLAPI_VALUE_FLAG_PASSIN); + slapi_valueset_add_attr_value_ext(a, &a->a_present_values, r, SLAPI_VALUE_FLAG_PASSIN); } return LDAP_SUCCESS; } @@ -1273,9 +1273,9 @@ resolve_attribute_state_to_present_or_deleted(Slapi_Entry *e, Slapi_Attr *a, Sla if((csn_compare(vucsn,deletedcsn)>=0) || value_distinguished_at_csn(e, a, valuestoupdate[i], deletedcsn)) { - slapi_valueset_add_value_ext(&a->a_present_values, valuestoupdate[i], SLAPI_VALUE_FLAG_PASSIN); + slapi_valueset_add_attr_value_ext(a, &a->a_present_values, valuestoupdate[i], SLAPI_VALUE_FLAG_PASSIN); } else { - slapi_valueset_add_value_ext(&a->a_deleted_values, valuestoupdate[i], SLAPI_VALUE_FLAG_PASSIN); + slapi_valueset_add_attr_value_ext(a, &a->a_deleted_values, valuestoupdate[i], SLAPI_VALUE_FLAG_PASSIN); } } }