ldap/servers/slapd/entry.c | 2 ++ ldap/servers/slapd/entrywsi.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-)
New commits: commit 391539ad412f3ba215c1ebebc465a1adb5b1674d Author: Ludwig Krispenz lkrispen@redhat.com Date: Fri Jan 9 13:28:05 2015 +0100
Ticket 47964 - v2 - Incorrect search result after replacing an empty attribute
Bug Description: when a replace operation for a nonexisting attribute is done without providing new values the entry is stored with incorrect meta data: an empty deleted value without attribute deletion csn.
Fix Description: in the delete phase of the replace operation already create the attribute to set the deletion csn. It would be created anyway in the add part of the replace operation. The function to calculate the required size to write the entry needs also to be adjusted.
https://fedorahosted.org/389/ticket/47964
Reviewed by: Rich, thanks
diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c index 718d78a..203c742 100644 --- a/ldap/servers/slapd/entry.c +++ b/ldap/servers/slapd/entry.c @@ -1554,6 +1554,8 @@ entry2str_internal_size_attrlist( const Slapi_Attr *attrlist, int entry2str_ctrl * We need to add the size for that. */ elen += 1 + LDIF_CSNPREFIX_MAXLENGTH + CSN_STRSIZE; + /* need also space for ";deletedattribute;deleted" */ + elen += DELETED_ATTR_STRSIZE + DELETED_VALUE_STRSIZE; } } } diff --git a/ldap/servers/slapd/entrywsi.c b/ldap/servers/slapd/entrywsi.c index 41afe1a..8931db1 100644 --- a/ldap/servers/slapd/entrywsi.c +++ b/ldap/servers/slapd/entrywsi.c @@ -680,9 +680,13 @@ entry_delete_present_values_wsi(Slapi_Entry *e, const char *type, struct berval } retVal = LDAP_NO_SUCH_ATTRIBUTE; } - if ((LDAP_MOD_REPLACE == mod_op) && replacevals && replacevals[0]) + if ((LDAP_MOD_REPLACE == mod_op)) { - /* Create a new attribute and set the adcsn */ + /* Create a new attribute and set the adcsn + * We need to do this always to set the deletion csn + * The attribute would otherwise be created in the + * entry_add_.. function + */ Slapi_Attr *a = slapi_attr_new(); slapi_attr_init(a, type); attr_set_deletion_csn(a,csn);
389-commits@lists.fedoraproject.org