From db60b2709772320fef9c365b1992a209935131f4 Mon Sep 17 00:00:00 2001 From: German Parente Date: Nov 05 2014 16:18:07 +0000 Subject: Description: Fix for ticket 47915: replication inconsistency for add/replace/delete single valued attribute https://fedorahosted.org/389/ticket/47915 Resolves: Ticket 47915 Bug Description: In MMR, when deleting a single valued attribute specifying its value, the operation is not replicated and the entry state does not reflect the attribute deletion. Reviewed by: Rich and Ludwig (Thanks a lot!) Branch: 1.2.11.15 Fix Description: The fix consists on using the diffs already present in master branch to: - replicate the delete operation - generate the entry state indicating attribute has been deleted Platforms tested: rhel6.5 Flag Day: no Doc impact: no --- diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c index 8b7766e..1341296 100644 --- a/ldap/servers/slapd/entry.c +++ b/ldap/servers/slapd/entry.c @@ -1638,6 +1638,9 @@ entry2str_internal_put_attrlist( const Slapi_Attr *attrlist, int attr_state, int else { /* There were no present values on which to place the ADCSN, so we put it on the first deleted value. */ + if ( valueset_isempty(&a->a_deleted_values)) { + valueset_add_string (a,(Slapi_ValueSet *)&a->a_deleted_values, "", CSN_TYPE_VALUE_DELETED, a->a_deletioncsn); + } entry2str_internal_put_valueset(a->a_type, a->a_deletioncsn, CSN_TYPE_ATTRIBUTE_DELETED, attr_state, &a->a_deleted_values, VALUE_DELETED, ecur, typebuf, typebuf_len, entry2str_ctrl); } } diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c index 40fe39b..663d115 100644 --- a/ldap/servers/slapd/entrywsi.c +++ b/ldap/servers/slapd/entrywsi.c @@ -581,7 +581,7 @@ entry_delete_present_values_wsi(Slapi_Entry *e, const char *type, struct berval there are present values with a later CSN - otherwise, even though the value will be updated with a VDCSN which is later than the VUCSN, the attribute will not be deleted */ - if(slapi_attr_flag_is_set(a,SLAPI_ATTR_FLAG_SINGLE) && valueset_isempty(&a->a_present_values)) + if(slapi_attr_flag_is_set(a,SLAPI_ATTR_FLAG_SINGLE) && valuesupdated && *valuesupdated) { attr_set_deletion_csn(a,csn); }