Blame SOURCES/0057-Ticket-47989-Windows-Sync-accidentally-cleared-raw_e.patch

f92ce9
From 5907e7902b3d586d6ce534c542728bd9d153f575 Mon Sep 17 00:00:00 2001
f92ce9
From: Noriko Hosoi <nhosoi@redhat.com>
f92ce9
Date: Fri, 16 Jan 2015 16:28:06 -0800
f92ce9
Subject: [PATCH 57/59] Ticket #47989 - Windows Sync accidentally cleared
f92ce9
 raw_entry
f92ce9
f92ce9
Description: raw_entry in the private area in Windows Agreement stores
f92ce9
raw_entry that is un-schema processed last entry read from AD.
f92ce9
The pointer was cleared before it is being accessed by the Plug-ins that
f92ce9
call Windows Sync API, e.g., Posix Sync.  The bug was introduced by
f92ce9
commit f6397113666f06848412bb12f754f04258cfa5fa.
f92ce9
f92ce9
This patch removed the raw_entry cleanup code in windows_search_entry_ext.
f92ce9
And in case the raw_entry is NULL, pass remote_entry for the AD entry.
f92ce9
f92ce9
https://fedorahosted.org/389/ticket/47989
f92ce9
f92ce9
Reviewed by mreynolds@redhat.com (Thank you, Mark!!)
f92ce9
f92ce9
(cherry picked from commit 3305a6b849f79a9684799bec4cc155c7147daea6)
f92ce9
(cherry picked from commit f6d8b2ec3dee5760826892f522c0f1e1989f9fcb)
f92ce9
---
f92ce9
 ldap/servers/plugins/replication/windows_connection.c    | 4 ----
f92ce9
 ldap/servers/plugins/replication/windows_protocol_util.c | 8 ++++++--
f92ce9
 2 files changed, 6 insertions(+), 6 deletions(-)
f92ce9
f92ce9
diff --git a/ldap/servers/plugins/replication/windows_connection.c b/ldap/servers/plugins/replication/windows_connection.c
f92ce9
index e78c367..317386b 100644
f92ce9
--- a/ldap/servers/plugins/replication/windows_connection.c
f92ce9
+++ b/ldap/servers/plugins/replication/windows_connection.c
f92ce9
@@ -814,10 +814,6 @@ next:
f92ce9
 		slapi_ch_free_string(&filter_copy);
f92ce9
 		ldap_controls_free(serverctrls_copy);
f92ce9
 		serverctrls_copy = NULL;
f92ce9
-
f92ce9
-		/* clear it here in case the search fails and
f92ce9
-		   we are left with a bogus old entry */
f92ce9
-		windows_private_set_raw_entry(conn->agmt, NULL);
f92ce9
 		conn->last_ldap_error = ldap_rc;
f92ce9
 		if (NULL != res)
f92ce9
 		{
f92ce9
diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c
f92ce9
index c424590..dabc936 100644
f92ce9
--- a/ldap/servers/plugins/replication/windows_protocol_util.c
f92ce9
+++ b/ldap/servers/plugins/replication/windows_protocol_util.c
f92ce9
@@ -1689,7 +1689,9 @@ windows_replay_update(Private_Repl_Protocol *prp, slapi_operation_parameters *op
f92ce9
 			windows_map_mods_for_replay(prp,op->p.p_modify.modify_mods, &mapped_mods, is_user, &password);
f92ce9
 			if (is_user) {
f92ce9
 				winsync_plugin_call_pre_ad_mod_user_mods_cb(prp->agmt,
f92ce9
-				                                            windows_private_get_raw_entry(prp->agmt),
f92ce9
+				                                            windows_private_get_raw_entry(prp->agmt)?
f92ce9
+				                                            windows_private_get_raw_entry(prp->agmt):
f92ce9
+				                                            remote_entry,
f92ce9
 				                                            local_dn,
f92ce9
 				                                            local_entry,
f92ce9
 				                                            op->p.p_modify.modify_mods,
f92ce9
@@ -1697,7 +1699,9 @@ windows_replay_update(Private_Repl_Protocol *prp, slapi_operation_parameters *op
f92ce9
 				                                            &mapped_mods);
f92ce9
 			} else if (is_group) {
f92ce9
 				winsync_plugin_call_pre_ad_mod_group_mods_cb(prp->agmt,
f92ce9
-				                                            windows_private_get_raw_entry(prp->agmt),
f92ce9
+				                                            windows_private_get_raw_entry(prp->agmt)?
f92ce9
+				                                            windows_private_get_raw_entry(prp->agmt):
f92ce9
+				                                            remote_entry,
f92ce9
 				                                            local_dn,
f92ce9
 				                                            local_entry,
f92ce9
 				                                            op->p.p_modify.modify_mods,
f92ce9
-- 
f92ce9
1.9.3
f92ce9