|
|
f92ce9 |
From d9e460db38763e81f1065777dd54f95efd108017 Mon Sep 17 00:00:00 2001
|
|
|
f92ce9 |
From: Mark Reynolds <mreynolds@redhat.com>
|
|
|
f92ce9 |
Date: Thu, 13 Nov 2014 17:22:24 -0500
|
|
|
f92ce9 |
Subject: [PATCH 48/53] Ticket 47451 - Need to unregister tasks created by
|
|
|
f92ce9 |
plugins
|
|
|
f92ce9 |
|
|
|
f92ce9 |
Bug Description: Tasks created by plugins are not unregistered when a plugin
|
|
|
f92ce9 |
is stopped or deleted. Repeated stopping/starting a plugin
|
|
|
f92ce9 |
that registers tasks will corrupt the dse callback linked list
|
|
|
f92ce9 |
and will crash the server if a task is invoked.
|
|
|
f92ce9 |
|
|
|
f92ce9 |
Fix Description: Create a plugin task unregister function, and call it in the
|
|
|
f92ce9 |
clsoe functions of plugins that register functions.
|
|
|
f92ce9 |
|
|
|
f92ce9 |
https://fedorahosted.org/389/ticket/47451
|
|
|
f92ce9 |
|
|
|
f92ce9 |
Reviewed by: nhosoi(Thanks!)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
(cherry picked from commit 005c4c9be360a7ebba38b61f934ace94224eef3f)
|
|
|
f92ce9 |
(cherry picked from commit fb7eef1c08a2d15c94eaedaabec2b07e970ffb3a)
|
|
|
f92ce9 |
---
|
|
|
f92ce9 |
ldap/servers/plugins/automember/automember.c | 8 ++++++++
|
|
|
f92ce9 |
ldap/servers/plugins/linkedattrs/linked_attrs.c | 2 ++
|
|
|
f92ce9 |
ldap/servers/plugins/memberof/memberof.c | 1 +
|
|
|
f92ce9 |
.../plugins/posix-winsync/posix-winsync-config.c | 1 +
|
|
|
f92ce9 |
ldap/servers/plugins/schema_reload/schema_reload.c | 2 ++
|
|
|
f92ce9 |
ldap/servers/plugins/usn/usn.c | 1 +
|
|
|
f92ce9 |
ldap/servers/plugins/usn/usn.h | 1 +
|
|
|
f92ce9 |
ldap/servers/plugins/usn/usn_cleanup.c | 8 ++++++++
|
|
|
f92ce9 |
ldap/servers/slapd/slapi-plugin.h | 1 +
|
|
|
f92ce9 |
ldap/servers/slapd/task.c | 19 +++++++++++++++++++
|
|
|
f92ce9 |
10 files changed, 44 insertions(+)
|
|
|
f92ce9 |
|
|
|
f92ce9 |
diff --git a/ldap/servers/plugins/automember/automember.c b/ldap/servers/plugins/automember/automember.c
|
|
|
f92ce9 |
index c5bb0ae..c443a65 100644
|
|
|
f92ce9 |
--- a/ldap/servers/plugins/automember/automember.c
|
|
|
f92ce9 |
+++ b/ldap/servers/plugins/automember/automember.c
|
|
|
f92ce9 |
@@ -397,6 +397,14 @@ automember_close(Slapi_PBlock * pb)
|
|
|
f92ce9 |
slapi_log_error(SLAPI_LOG_TRACE, AUTOMEMBER_PLUGIN_SUBSYSTEM,
|
|
|
f92ce9 |
"--> automember_close\n");
|
|
|
f92ce9 |
|
|
|
f92ce9 |
+ /* unregister the tasks */
|
|
|
f92ce9 |
+ slapi_plugin_task_unregister_handler("automember rebuild membership",
|
|
|
f92ce9 |
+ automember_task_add);
|
|
|
f92ce9 |
+ slapi_plugin_task_unregister_handler("automember export updates",
|
|
|
f92ce9 |
+ automember_task_add_export_updates);
|
|
|
f92ce9 |
+ slapi_plugin_task_unregister_handler("automember map updates",
|
|
|
f92ce9 |
+ automember_task_add_map_entries);
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
automember_delete_config();
|
|
|
f92ce9 |
slapi_ch_free((void **)&g_automember_config);
|
|
|
f92ce9 |
slapi_sdn_free(&_PluginDN);
|
|
|
f92ce9 |
diff --git a/ldap/servers/plugins/linkedattrs/linked_attrs.c b/ldap/servers/plugins/linkedattrs/linked_attrs.c
|
|
|
f92ce9 |
index 20bb9fa..e302867 100644
|
|
|
f92ce9 |
--- a/ldap/servers/plugins/linkedattrs/linked_attrs.c
|
|
|
f92ce9 |
+++ b/ldap/servers/plugins/linkedattrs/linked_attrs.c
|
|
|
f92ce9 |
@@ -383,6 +383,8 @@ linked_attrs_close(Slapi_PBlock * pb)
|
|
|
f92ce9 |
slapi_log_error(SLAPI_LOG_TRACE, LINK_PLUGIN_SUBSYSTEM,
|
|
|
f92ce9 |
"--> linked_attrs_close\n");
|
|
|
f92ce9 |
|
|
|
f92ce9 |
+ slapi_plugin_task_unregister_handler("fixup linked attributes", linked_attrs_fixup_task_add);
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
linked_attrs_delete_config();
|
|
|
f92ce9 |
slapi_destroy_rwlock(g_config_lock);
|
|
|
f92ce9 |
g_config_lock = NULL;
|
|
|
f92ce9 |
diff --git a/ldap/servers/plugins/memberof/memberof.c b/ldap/servers/plugins/memberof/memberof.c
|
|
|
f92ce9 |
index ce48f01..cb4ef75 100644
|
|
|
f92ce9 |
--- a/ldap/servers/plugins/memberof/memberof.c
|
|
|
f92ce9 |
+++ b/ldap/servers/plugins/memberof/memberof.c
|
|
|
f92ce9 |
@@ -454,6 +454,7 @@ int memberof_postop_close(Slapi_PBlock *pb)
|
|
|
f92ce9 |
slapi_log_error( SLAPI_LOG_TRACE, MEMBEROF_PLUGIN_SUBSYSTEM,
|
|
|
f92ce9 |
"--> memberof_postop_close\n" );
|
|
|
f92ce9 |
|
|
|
f92ce9 |
+ slapi_plugin_task_unregister_handler("memberof task", memberof_task_add);
|
|
|
f92ce9 |
memberof_release_config();
|
|
|
f92ce9 |
slapi_sdn_free(&_ConfigAreaDN);
|
|
|
f92ce9 |
slapi_sdn_free(&_pluginDN);
|
|
|
f92ce9 |
diff --git a/ldap/servers/plugins/posix-winsync/posix-winsync-config.c b/ldap/servers/plugins/posix-winsync/posix-winsync-config.c
|
|
|
f92ce9 |
index 4234080..50e3a61 100644
|
|
|
f92ce9 |
--- a/ldap/servers/plugins/posix-winsync/posix-winsync-config.c
|
|
|
f92ce9 |
+++ b/ldap/servers/plugins/posix-winsync/posix-winsync-config.c
|
|
|
f92ce9 |
@@ -237,6 +237,7 @@ posix_winsync_config(Slapi_Entry *config_e)
|
|
|
f92ce9 |
void
|
|
|
f92ce9 |
posix_winsync_config_free()
|
|
|
f92ce9 |
{
|
|
|
f92ce9 |
+ slapi_plugin_task_unregister_handler("memberuid task", posix_group_task_add);
|
|
|
f92ce9 |
slapi_entry_free(theConfig.config_e);
|
|
|
f92ce9 |
theConfig.config_e = NULL;
|
|
|
f92ce9 |
slapi_destroy_mutex(theConfig.lock);
|
|
|
f92ce9 |
diff --git a/ldap/servers/plugins/schema_reload/schema_reload.c b/ldap/servers/plugins/schema_reload/schema_reload.c
|
|
|
f92ce9 |
index 6cf1181..3ff4c4d 100644
|
|
|
f92ce9 |
--- a/ldap/servers/plugins/schema_reload/schema_reload.c
|
|
|
f92ce9 |
+++ b/ldap/servers/plugins/schema_reload/schema_reload.c
|
|
|
f92ce9 |
@@ -131,6 +131,8 @@ schemareload_start(Slapi_PBlock *pb)
|
|
|
f92ce9 |
static int
|
|
|
f92ce9 |
schemareload_close(Slapi_PBlock *pb)
|
|
|
f92ce9 |
{
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ slapi_plugin_task_unregister_handler("schema reload task", schemareload_add);
|
|
|
f92ce9 |
PR_DestroyLock(schemareload_lock);
|
|
|
f92ce9 |
|
|
|
f92ce9 |
return 0;
|
|
|
f92ce9 |
diff --git a/ldap/servers/plugins/usn/usn.c b/ldap/servers/plugins/usn/usn.c
|
|
|
f92ce9 |
index 837dc2e..6b34bf4 100644
|
|
|
f92ce9 |
--- a/ldap/servers/plugins/usn/usn.c
|
|
|
f92ce9 |
+++ b/ldap/servers/plugins/usn/usn.c
|
|
|
f92ce9 |
@@ -300,6 +300,7 @@ usn_close(Slapi_PBlock *pb)
|
|
|
f92ce9 |
{
|
|
|
f92ce9 |
slapi_log_error(SLAPI_LOG_TRACE, USN_PLUGIN_SUBSYSTEM, "--> usn_close\n");
|
|
|
f92ce9 |
|
|
|
f92ce9 |
+ usn_cleanup_close();
|
|
|
f92ce9 |
slapi_config_remove_callback(SLAPI_OPERATION_SEARCH, DSE_FLAG_PREOP,
|
|
|
f92ce9 |
"", LDAP_SCOPE_BASE, "(objectclass=*)", usn_rootdse_search);
|
|
|
f92ce9 |
|
|
|
f92ce9 |
diff --git a/ldap/servers/plugins/usn/usn.h b/ldap/servers/plugins/usn/usn.h
|
|
|
f92ce9 |
index 8e6c5c8..4bc9e97 100644
|
|
|
f92ce9 |
--- a/ldap/servers/plugins/usn/usn.h
|
|
|
f92ce9 |
+++ b/ldap/servers/plugins/usn/usn.h
|
|
|
f92ce9 |
@@ -54,4 +54,5 @@ void *usn_get_identity();
|
|
|
f92ce9 |
|
|
|
f92ce9 |
/* usn_cleanup.c */
|
|
|
f92ce9 |
int usn_cleanup_start(Slapi_PBlock *pb);
|
|
|
f92ce9 |
+int usn_cleanup_close();
|
|
|
f92ce9 |
|
|
|
f92ce9 |
diff --git a/ldap/servers/plugins/usn/usn_cleanup.c b/ldap/servers/plugins/usn/usn_cleanup.c
|
|
|
f92ce9 |
index 2b1371d..c12dfd2 100644
|
|
|
f92ce9 |
--- a/ldap/servers/plugins/usn/usn_cleanup.c
|
|
|
f92ce9 |
+++ b/ldap/servers/plugins/usn/usn_cleanup.c
|
|
|
f92ce9 |
@@ -58,6 +58,14 @@ usn_cleanup_start(Slapi_PBlock *pb)
|
|
|
f92ce9 |
return rc;
|
|
|
f92ce9 |
}
|
|
|
f92ce9 |
|
|
|
f92ce9 |
+int
|
|
|
f92ce9 |
+usn_cleanup_close()
|
|
|
f92ce9 |
+{
|
|
|
f92ce9 |
+ int rc = slapi_plugin_task_unregister_handler("USN tombstone cleanup task",
|
|
|
f92ce9 |
+ usn_cleanup_add);
|
|
|
f92ce9 |
+ return rc;
|
|
|
f92ce9 |
+}
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
/*
|
|
|
f92ce9 |
* Task thread
|
|
|
f92ce9 |
*/
|
|
|
f92ce9 |
diff --git a/ldap/servers/slapd/slapi-plugin.h b/ldap/servers/slapd/slapi-plugin.h
|
|
|
f92ce9 |
index 8ffc582..0ae3601 100644
|
|
|
f92ce9 |
--- a/ldap/servers/slapd/slapi-plugin.h
|
|
|
f92ce9 |
+++ b/ldap/servers/slapd/slapi-plugin.h
|
|
|
f92ce9 |
@@ -6604,6 +6604,7 @@ int slapi_config_remove_callback(int operation, int flags, const char *base, int
|
|
|
f92ce9 |
|
|
|
f92ce9 |
int slapi_task_register_handler(const char *name, dseCallbackFn func);
|
|
|
f92ce9 |
int slapi_plugin_task_register_handler(const char *name, dseCallbackFn func, Slapi_PBlock *plugin_pb);
|
|
|
f92ce9 |
+int slapi_plugin_task_unregister_handler(const char *name, dseCallbackFn func);
|
|
|
f92ce9 |
void slapi_task_begin(Slapi_Task *task, int total_work);
|
|
|
f92ce9 |
void slapi_task_inc_progress(Slapi_Task *task);
|
|
|
f92ce9 |
void slapi_task_finish(Slapi_Task *task, int rc);
|
|
|
f92ce9 |
diff --git a/ldap/servers/slapd/task.c b/ldap/servers/slapd/task.c
|
|
|
f92ce9 |
index 2a0cb82..006ae53 100644
|
|
|
f92ce9 |
--- a/ldap/servers/slapd/task.c
|
|
|
f92ce9 |
+++ b/ldap/servers/slapd/task.c
|
|
|
f92ce9 |
@@ -461,6 +461,25 @@ int slapi_task_get_refcount(Slapi_Task *task)
|
|
|
f92ce9 |
}
|
|
|
f92ce9 |
|
|
|
f92ce9 |
int
|
|
|
f92ce9 |
+slapi_plugin_task_unregister_handler(const char *name, dseCallbackFn func)
|
|
|
f92ce9 |
+{
|
|
|
f92ce9 |
+ char *base = NULL;
|
|
|
f92ce9 |
+ int rc = 0;
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ base = slapi_create_dn_string("cn=%s,%s", name, TASK_BASE_DN);
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ slapi_config_remove_callback(SLAPI_OPERATION_ADD, DSE_FLAG_PREOP, base,
|
|
|
f92ce9 |
+ LDAP_SCOPE_SUBTREE, "(objectclass=*)", func);
|
|
|
f92ce9 |
+ slapi_config_remove_callback(SLAPI_OPERATION_MODIFY, DSE_FLAG_PREOP,
|
|
|
f92ce9 |
+ base, LDAP_SCOPE_BASE, "(objectclass=*)", task_deny);
|
|
|
f92ce9 |
+ slapi_config_remove_callback(SLAPI_OPERATION_DELETE, DSE_FLAG_PREOP,
|
|
|
f92ce9 |
+ base, LDAP_SCOPE_BASE, "(objectclass=*)", task_deny);
|
|
|
f92ce9 |
+ slapi_ch_free_string(&base);
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+ return rc;
|
|
|
f92ce9 |
+}
|
|
|
f92ce9 |
+
|
|
|
f92ce9 |
+int
|
|
|
f92ce9 |
slapi_plugin_task_register_handler(const char *name, dseCallbackFn func, Slapi_PBlock *plugin_pb)
|
|
|
f92ce9 |
{
|
|
|
f92ce9 |
Slapi_PBlock *add_pb = NULL;
|
|
|
f92ce9 |
--
|
|
|
f92ce9 |
1.9.3
|
|
|
f92ce9 |
|