andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone
dc8c34
From da061a612d04f23f2382f8fbaf686756ecf476eb Mon Sep 17 00:00:00 2001
dc8c34
From: Noriko Hosoi <nhosoi@redhat.com>
dc8c34
Date: Fri, 16 Jan 2015 16:28:06 -0800
dc8c34
Subject: [PATCH 301/305] Ticket #47989 - Windows Sync accidentally cleared
dc8c34
 raw_entry
dc8c34
dc8c34
Description: raw_entry in the private area in Windows Agreement stores
dc8c34
raw_entry that is un-schema processed last entry read from AD.
dc8c34
The pointer was cleared before it is being accessed by the Plug-ins that
dc8c34
call Windows Sync API, e.g., Posix Sync.  The bug was introduced by
dc8c34
commit f6397113666f06848412bb12f754f04258cfa5fa.
dc8c34
dc8c34
This patch removed the raw_entry cleanup code in windows_search_entry_ext.
dc8c34
And in case the raw_entry is NULL, pass remote_entry for the AD entry.
dc8c34
dc8c34
https://fedorahosted.org/389/ticket/47989
dc8c34
dc8c34
Reviewed by mreynolds@redhat.com (Thank you, Mark!!)
dc8c34
dc8c34
(cherry picked from commit 3305a6b849f79a9684799bec4cc155c7147daea6)
dc8c34
(cherry picked from commit f6d8b2ec3dee5760826892f522c0f1e1989f9fcb)
dc8c34
(cherry picked from commit 19af1afa4012a66fda2bc5e2e70ac315b70444af)
dc8c34
(cherry picked from commit bf55d5ac6547028ebabdcf19df28cfdd4017872f)
dc8c34
(cherry picked from commit a605e94c625cb46715516b7afb83fca719485f49)
dc8c34
---
dc8c34
 ldap/servers/plugins/replication/windows_connection.c    | 4 ----
dc8c34
 ldap/servers/plugins/replication/windows_protocol_util.c | 8 ++++++--
dc8c34
 2 files changed, 6 insertions(+), 6 deletions(-)
dc8c34
dc8c34
diff --git a/ldap/servers/plugins/replication/windows_connection.c b/ldap/servers/plugins/replication/windows_connection.c
dc8c34
index 105c205..b0f9bb3 100644
dc8c34
--- a/ldap/servers/plugins/replication/windows_connection.c
dc8c34
+++ b/ldap/servers/plugins/replication/windows_connection.c
dc8c34
@@ -671,10 +671,6 @@ windows_search_entry_ext(Repl_Connection *conn, char* searchbase, char *filter,
dc8c34
 		attrs = NULL;
dc8c34
 		ldap_controls_free(serverctrls_copy);
dc8c34
 		serverctrls_copy = NULL;
dc8c34
-
dc8c34
-		/* clear it here in case the search fails and
dc8c34
-		   we are left with a bogus old entry */
dc8c34
-		windows_private_set_raw_entry(conn->agmt, NULL);
dc8c34
 		if (LDAP_SUCCESS == ldap_rc)
dc8c34
 		{
dc8c34
 			LDAPMessage *message = ldap_first_entry(conn->ld, res);
dc8c34
diff --git a/ldap/servers/plugins/replication/windows_protocol_util.c b/ldap/servers/plugins/replication/windows_protocol_util.c
dc8c34
index c95bdbb..12acf94 100644
dc8c34
--- a/ldap/servers/plugins/replication/windows_protocol_util.c
dc8c34
+++ b/ldap/servers/plugins/replication/windows_protocol_util.c
dc8c34
@@ -1616,7 +1616,9 @@ windows_replay_update(Private_Repl_Protocol *prp, slapi_operation_parameters *op
dc8c34
 			windows_map_mods_for_replay(prp,op->p.p_modify.modify_mods, &mapped_mods, is_user, &password);
dc8c34
 			if (is_user) {
dc8c34
 				winsync_plugin_call_pre_ad_mod_user_mods_cb(prp->agmt,
dc8c34
-				                                            windows_private_get_raw_entry(prp->agmt),
dc8c34
+				                                            windows_private_get_raw_entry(prp->agmt)?
dc8c34
+				                                            windows_private_get_raw_entry(prp->agmt):
dc8c34
+				                                            remote_entry,
dc8c34
 				                                            local_dn,
dc8c34
 				                                            local_entry,
dc8c34
 				                                            op->p.p_modify.modify_mods,
dc8c34
@@ -1624,7 +1626,9 @@ windows_replay_update(Private_Repl_Protocol *prp, slapi_operation_parameters *op
dc8c34
 				                                            &mapped_mods);
dc8c34
 			} else if (is_group) {
dc8c34
 				winsync_plugin_call_pre_ad_mod_group_mods_cb(prp->agmt,
dc8c34
-				                                            windows_private_get_raw_entry(prp->agmt),
dc8c34
+				                                            windows_private_get_raw_entry(prp->agmt)?
dc8c34
+				                                            windows_private_get_raw_entry(prp->agmt):
dc8c34
+				                                            remote_entry,
dc8c34
 				                                            local_dn,
dc8c34
 				                                            local_entry,
dc8c34
 				                                            op->p.p_modify.modify_mods,
dc8c34
-- 
dc8c34
1.9.3
dc8c34