andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
Blob Blame History Raw
From 5fc975a783e50339890789a75e2cc1a33594aae0 Mon Sep 17 00:00:00 2001
From: Ludwig Krispenz <lkrispen@redhat.com>
Date: Fri, 9 Jan 2015 13:28:05 +0100
Subject: [PATCH 376/378] Ticket 47964 - 1.2.11 - 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

Note for 389-ds-base-1.2.11: applying the patch just to entry2str_internal_size_attrlist (entry.c).

(cherry picked from commit 3182d2e8524c319393ab37ffcf6a8aefb9b92b54)
(cherry picked from commit d1cf785b82235c2468002274f020efc1d8f3fcc3)
---
 ldap/servers/slapd/entry.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ldap/servers/slapd/entry.c b/ldap/servers/slapd/entry.c
index 340844d..f3d9c86 100644
--- a/ldap/servers/slapd/entry.c
+++ b/ldap/servers/slapd/entry.c
@@ -1487,6 +1487,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;
 			}
 		}
 	}
-- 
2.4.3