Browse Source

Ticket 47451 - Running a plugin task can crash the server

Bug Description:  When a plugin task completes it attempts to update a counter,
                  but the wrong structure is accessed which can lead to a crash.

Fix Description:  When creating a new task, make sure to store the plugin structure,
                  not the pblock in the task structure.

https://fedorahosted.org/389/ticket/47451

Reviewed by: rmeggins(Thanks!)
Mark Reynolds 11 years ago
parent
commit
0e0848a838
1 changed files with 5 additions and 3 deletions
  1. 5 3
      ldap/servers/slapd/task.c

+ 5 - 3
ldap/servers/slapd/task.c

@@ -131,9 +131,9 @@ slapi_new_task(const char *dn)
 }
 
 Slapi_Task *
-slapi_plugin_new_task(const char *dn, void *plugin)
+slapi_plugin_new_task(const char *dn, void *plugin_pb)
 {
-    return new_task(dn, plugin);
+    return new_task(dn, plugin_pb);
 }
 
 /* slapi_destroy_task: destroy a task
@@ -583,9 +583,11 @@ void slapi_task_set_cancel_fn(Slapi_Task *task, TaskCallbackFn func)
  ***********************************/
 /* create a new task, fill in DN, and setup modify callback */
 static Slapi_Task *
-new_task(const char *rawdn, void *plugin)
+new_task(const char *rawdn, void *plugin_pb)
 {
     Slapi_Task *task = NULL;
+    Slapi_PBlock *pb = (Slapi_PBlock *)plugin_pb;
+    void *plugin = pb ? pb->pb_plugin : NULL;
     char *dn = NULL;
 
     if (rawdn == NULL) {