amoralej / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 years ago
Clone

Blame SOURCES/0049-Ticket-47451-Running-a-plugin-task-can-crash-the-ser.patch

f92ce9
From 511ee2b326c8110678c34f66d1d043770afc5900 Mon Sep 17 00:00:00 2001
f92ce9
From: Mark Reynolds <mreynolds@redhat.com>
f92ce9
Date: Wed, 26 Nov 2014 16:23:00 -0500
f92ce9
Subject: [PATCH 49/53] Ticket 47451 - Running a plugin task can crash the
f92ce9
 server
f92ce9
f92ce9
Bug Description:  When a plugin task completes it attempts to update a counter,
f92ce9
                  but the wrong structure is accessed which can lead to a crash.
f92ce9
f92ce9
Fix Description:  When creating a new task, make sure to store the plugin structure,
f92ce9
                  not the pblock in the task structure.
f92ce9
f92ce9
https://fedorahosted.org/389/ticket/47451
f92ce9
f92ce9
Reviewed by: rmeggins(Thanks!)
f92ce9
f92ce9
(cherry picked from commit 0e0848a8385463532d53db94c0c8cae912c30eb4)
f92ce9
(cherry picked from commit d34b0ced2ed3ed81c6c487e90d4c372939da4677)
f92ce9
---
f92ce9
 ldap/servers/slapd/task.c | 8 +++++---
f92ce9
 1 file changed, 5 insertions(+), 3 deletions(-)
f92ce9
f92ce9
diff --git a/ldap/servers/slapd/task.c b/ldap/servers/slapd/task.c
f92ce9
index 006ae53..b1f7652 100644
f92ce9
--- a/ldap/servers/slapd/task.c
f92ce9
+++ b/ldap/servers/slapd/task.c
f92ce9
@@ -131,9 +131,9 @@ slapi_new_task(const char *dn)
f92ce9
 }
f92ce9
 
f92ce9
 Slapi_Task *
f92ce9
-slapi_plugin_new_task(const char *dn, void *plugin)
f92ce9
+slapi_plugin_new_task(const char *dn, void *plugin_pb)
f92ce9
 {
f92ce9
-    return new_task(dn, plugin);
f92ce9
+    return new_task(dn, plugin_pb);
f92ce9
 }
f92ce9
 
f92ce9
 /* slapi_destroy_task: destroy a task
f92ce9
@@ -583,9 +583,11 @@ void slapi_task_set_cancel_fn(Slapi_Task *task, TaskCallbackFn func)
f92ce9
  ***********************************/
f92ce9
 /* create a new task, fill in DN, and setup modify callback */
f92ce9
 static Slapi_Task *
f92ce9
-new_task(const char *rawdn, void *plugin)
f92ce9
+new_task(const char *rawdn, void *plugin_pb)
f92ce9
 {
f92ce9
     Slapi_Task *task = NULL;
f92ce9
+    Slapi_PBlock *pb = (Slapi_PBlock *)plugin_pb;
f92ce9
+    void *plugin = pb ? pb->pb_plugin : NULL;
f92ce9
     char *dn = NULL;
f92ce9
 
f92ce9
     if (rawdn == NULL) {
f92ce9
-- 
f92ce9
1.9.3
f92ce9