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