andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
Blob Blame History Raw
From 86d41abf1a34e91668eeb6b594d3649e89c9caca Mon Sep 17 00:00:00 2001
From: Ludwig Krispenz <lkrispen@redhat.com>
Date: Wed, 13 Mar 2013 10:53:44 +0100
Subject: [PATCH] Ticket #621 - modify operations without values do not get
 replicated

Description: This was introduced by the fix for ticket 561 where in the
_cl5WriteMod the mods were checked if the values need to be encrypted
and only mods with values were written to the changelog

reviewed by Mark, Thanks

(cherry picked from commit 5a5ff2640d6e66c925550498211743a8f78a8477)
(cherry picked from commit 439ed95bfc4e892b256a71448838954d15decf9c)
---
 ldap/servers/plugins/replication/cl5_api.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/ldap/servers/plugins/replication/cl5_api.c b/ldap/servers/plugins/replication/cl5_api.c
index 0618d9b..dd3168a 100644
--- a/ldap/servers/plugins/replication/cl5_api.c
+++ b/ldap/servers/plugins/replication/cl5_api.c
@@ -2537,11 +2537,15 @@ _cl5WriteMod (LDAPMod *mod, char **buff)
 	memcpy (pos, &count, sizeof (count));
 	pos += sizeof (PRInt32);
 
+	/* if the mod has no values, eg delete attr or replace attr without values 
+	 * do not reset buffer
+	 */
+	rc = 0; 
+
 	bv = slapi_mod_get_first_value (&smod);
 	while (bv)
 	{
 		encbv = NULL;
-		rc = 0;
 		rc = clcrypt_encrypt_value(s_cl5Desc.clcrypt_handle, 
 		                           bv, &encbv);
 		if (rc > 0) {
-- 
1.9.3