summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/back-sch.c13
-rw-r--r--src/back-shr.c16
-rw-r--r--src/plug-nis.c54
-rw-r--r--src/plug-sch.c73
4 files changed, 90 insertions, 66 deletions
diff --git a/src/back-sch.c b/src/back-sch.c
index fec439a..39a5efd 100644
--- a/src/back-sch.c
+++ b/src/back-sch.c
@@ -870,6 +870,10 @@ backend_search_cb(Slapi_PBlock *pb)
memset(&cbdata, 0, sizeof(cbdata));
cbdata.pb = pb;
slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state);
+ if (cbdata.state->plugin_base == NULL) {
+ /* The plugin was not actually started. */
+ return 0;
+ }
slapi_pblock_get(pb, SLAPI_SEARCH_TARGET, &cbdata.target);
slapi_pblock_get(pb, SLAPI_SEARCH_SCOPE, &cbdata.scope);
slapi_pblock_get(pb, SLAPI_SEARCH_SIZELIMIT, &cbdata.sizelimit);
@@ -985,6 +989,11 @@ backend_locate(Slapi_PBlock *pb, struct backend_entry_data **data)
struct backend_locate_cbdata cbdata;
slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state);
+ if (cbdata.state->plugin_base == NULL) {
+ /* The plugin was not actually started. */
+ *data = NULL;
+ return;
+ }
slapi_pblock_get(pb, SLAPI_TARGET_DN, &cbdata.target);
cbdata.target_dn = slapi_sdn_new_dn_byval(cbdata.target);
cbdata.entry_data = NULL;
@@ -1024,6 +1033,10 @@ backend_check_scope_pb(Slapi_PBlock *pb)
struct backend_group_check_scope_cbdata cbdata;
slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state);
+ if (cbdata.state->plugin_base == NULL) {
+ /* The plugin was not actually started. */
+ return FALSE;
+ }
slapi_pblock_get(pb, SLAPI_TARGET_DN, &cbdata.target);
cbdata.target_dn = slapi_sdn_new_dn_byval(cbdata.target);
cbdata.ours = FALSE;
diff --git a/src/back-shr.c b/src/back-shr.c
index 553de55..8380046 100644
--- a/src/back-shr.c
+++ b/src/back-shr.c
@@ -1298,6 +1298,10 @@ backend_shr_add_cb(Slapi_PBlock *pb)
/* Read parameters from the pblock. */
slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state);
+ if (cbdata.state->plugin_base == NULL) {
+ /* The plugin was not actually started. */
+ return 0;
+ }
slapi_pblock_get(pb, SLAPI_ADD_TARGET, &cbdata.ndn);
slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &cbdata.e);
cbdata.pb = pb;
@@ -1401,6 +1405,10 @@ backend_shr_modify_cb(Slapi_PBlock *pb)
/* Read parameters from the pblock. */
slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state);
+ if (cbdata.state->plugin_base == NULL) {
+ /* The plugin was not actually started. */
+ return 0;
+ }
slapi_pblock_get(pb, SLAPI_MODIFY_TARGET, &cbdata.ndn);
slapi_pblock_get(pb, SLAPI_MODIFY_MODS, &cbdata.mods);
slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &cbdata.e_pre);
@@ -1529,6 +1537,10 @@ backend_shr_modrdn_cb(Slapi_PBlock *pb)
/* Read parameters from the pblock. */
slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state);
+ if (cbdata.state->plugin_base == NULL) {
+ /* The plugin was not actually started. */
+ return 0;
+ }
slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &cbdata.e_pre);
slapi_pblock_get(pb, SLAPI_ENTRY_POST_OP, &cbdata.e_post);
@@ -1628,6 +1640,10 @@ backend_shr_delete_cb(Slapi_PBlock *pb)
/* Read parameters from the pblock. */
slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &cbdata.state);
+ if (cbdata.state->plugin_base == NULL) {
+ /* The plugin was not actually started. */
+ return 0;
+ }
slapi_pblock_get(pb, SLAPI_DELETE_TARGET, &cbdata.ndn);
slapi_pblock_get(pb, SLAPI_ENTRY_PRE_OP, &cbdata.e);
cbdata.pb = pb;
diff --git a/src/plug-nis.c b/src/plug-nis.c
index 05af0a1..16f640b 100644
--- a/src/plug-nis.c
+++ b/src/plug-nis.c
@@ -72,9 +72,6 @@ plugin_description = {
};
static struct plugin_state *global_plugin_state;
-static int nis_plugin_init_postop(Slapi_PBlock *pb);
-static int nis_plugin_init_internal_postop(Slapi_PBlock *pb);
-
/* Populate the map cache, register with the local portmapper, and then start
* the plugin's work thread to answer requests using the cache. */
static int
@@ -91,7 +88,6 @@ plugin_startup(Slapi_PBlock *pb)
state->plugin_base ? state->plugin_base : "NULL",
state->plugin_base ? "\"" : "");
/* Populate the maps and data. */
- map_init(pb, state);
backend_startup(state);
/* Start a new listening thread to handle incoming traffic. */
state->tid = wrap_start_thread(&dispatch_thread, state);
@@ -165,30 +161,7 @@ plugin_startup(Slapi_PBlock *pb)
}
}
}
- /* Register the sub-plugins. */
- global_plugin_state = state;
- if (slapi_register_plugin("postoperation", TRUE,
- "nis_plugin_init_postop",
- nis_plugin_init_postop,
- PLUGIN_POSTOP_ID, NULL,
- state->plugin_identity) != 0) {
- slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "error registering postoperation plugin\n");
- return -1;
- }
- if (slapi_register_plugin("internalpostoperation", TRUE,
- "nis_plugin_init_internal_postop",
- nis_plugin_init_internal_postop,
- PLUGIN_INTERNAL_POSTOP_ID, NULL,
- state->plugin_identity) != 0) {
- slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "error registering internal postoperation plugin\n");
- return -1;
- }
- slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "registered plugin hooks\n");
- global_plugin_state = NULL;
-
+ /* Note that the plugin is ready to go. */
slapi_log_error(SLAPI_LOG_PLUGIN, plugin_description.spd_id,
"plugin startup completed\n");
return 0;
@@ -498,12 +471,37 @@ nis_plugin_init(Slapi_PBlock *pb)
"error setting up plugin\n");
return -1;
}
+ /* Minimally set up our cache. */
+ map_init(pb, state);
/* Register the plugin with the server. */
slapi_pblock_set(pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_03);
slapi_pblock_set(pb, SLAPI_PLUGIN_DESCRIPTION, &plugin_description);
slapi_pblock_set(pb, SLAPI_PLUGIN_START_FN, &plugin_startup);
slapi_pblock_set(pb, SLAPI_PLUGIN_CLOSE_FN, &plugin_shutdown);
slapi_pblock_set(pb, SLAPI_PLUGIN_PRIVATE, state);
+ /* Register the sub-plugins. */
+ global_plugin_state = state;
+ if (slapi_register_plugin("postoperation", TRUE,
+ "nis_plugin_init_postop",
+ nis_plugin_init_postop,
+ PLUGIN_POSTOP_ID, NULL,
+ state->plugin_identity) != 0) {
+ slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
+ "error registering postoperation plugin\n");
+ return -1;
+ }
+ if (slapi_register_plugin("internalpostoperation", TRUE,
+ "nis_plugin_init_internal_postop",
+ nis_plugin_init_internal_postop,
+ PLUGIN_INTERNAL_POSTOP_ID, NULL,
+ state->plugin_identity) != 0) {
+ slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
+ "error registering internal postoperation plugin\n");
+ return -1;
+ }
+ slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
+ "registered plugin hooks\n");
+ global_plugin_state = NULL;
/* Note that the plugin was successfully loaded. */
slapi_log_error(SLAPI_LOG_PLUGIN, plugin_description.spd_id,
"plugin initialized\n");
diff --git a/src/plug-sch.c b/src/plug-sch.c
index 3aaed35..3418516 100644
--- a/src/plug-sch.c
+++ b/src/plug-sch.c
@@ -72,10 +72,6 @@ plugin_description = {
};
static struct plugin_state *global_plugin_state;
-static int schema_compat_plugin_init_preop(Slapi_PBlock *pb);
-static int schema_compat_plugin_init_postop(Slapi_PBlock *pb);
-static int schema_compat_plugin_init_internal_postop(Slapi_PBlock *pb);
-
/* Handle the part of startup that needs to be done before we drop privileges,
* which for this plugin isn't much at all. */
static int
@@ -109,41 +105,8 @@ plugin_startup(Slapi_PBlock *pb)
state->plugin_base ? state->plugin_base : "NULL",
state->plugin_base ? "\"" : "");
/* Populate the tree of fake entries. */
- map_init(pb, state);
backend_startup(state);
- /* Register the sub-plugins. */
- global_plugin_state = state;
- if (slapi_register_plugin("preoperation", TRUE,
- "schema_compat_plugin_init_preop",
- schema_compat_plugin_init_preop,
- PLUGIN_PREOP_ID, NULL,
- state->plugin_identity) != 0) {
- slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "error registering preoperation plugin\n");
- return -1;
- }
- if (slapi_register_plugin("postoperation", TRUE,
- "schema_compat_plugin_init_postop",
- schema_compat_plugin_init_postop,
- PLUGIN_POSTOP_ID, NULL,
- state->plugin_identity) != 0) {
- slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "error registering postoperation plugin\n");
- return -1;
- }
- if (slapi_register_plugin("internalpostoperation", TRUE,
- "schema_compat_plugin_init_internal_postop",
- schema_compat_plugin_init_internal_postop,
- PLUGIN_INTERNAL_POSTOP_ID, NULL,
- state->plugin_identity) != 0) {
- slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "error registering internal postoperation plugin\n");
- return -1;
- }
- slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
- "registered plugin hooks\n");
- global_plugin_state = NULL;
-
+ /* Note that the plugin is ready to go. */
slapi_log_error(SLAPI_LOG_PLUGIN, plugin_description.spd_id,
"plugin startup completed\n");
return 0;
@@ -214,12 +177,46 @@ schema_compat_plugin_init(Slapi_PBlock *pb)
"error setting up plugin\n");
return -1;
}
+ /* Minimally set up our cache. */
+ map_init(pb, state);
/* Register the plugin with the server. */
slapi_pblock_set(pb, SLAPI_PLUGIN_VERSION, SLAPI_PLUGIN_VERSION_03);
slapi_pblock_set(pb, SLAPI_PLUGIN_DESCRIPTION, &plugin_description);
slapi_pblock_set(pb, SLAPI_PLUGIN_START_FN, &plugin_startup);
slapi_pblock_set(pb, SLAPI_PLUGIN_CLOSE_FN, &plugin_shutdown);
slapi_pblock_set(pb, SLAPI_PLUGIN_PRIVATE, state);
+ /* Register the sub-plugins. */
+ global_plugin_state = state;
+ if (slapi_register_plugin("preoperation", TRUE,
+ "schema_compat_plugin_init_preop",
+ schema_compat_plugin_init_preop,
+ PLUGIN_PREOP_ID, NULL,
+ state->plugin_identity) != 0) {
+ slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
+ "error registering preoperation plugin\n");
+ return -1;
+ }
+ if (slapi_register_plugin("postoperation", TRUE,
+ "schema_compat_plugin_init_postop",
+ schema_compat_plugin_init_postop,
+ PLUGIN_POSTOP_ID, NULL,
+ state->plugin_identity) != 0) {
+ slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
+ "error registering postoperation plugin\n");
+ return -1;
+ }
+ if (slapi_register_plugin("internalpostoperation", TRUE,
+ "schema_compat_plugin_init_internal_postop",
+ schema_compat_plugin_init_internal_postop,
+ PLUGIN_INTERNAL_POSTOP_ID, NULL,
+ state->plugin_identity) != 0) {
+ slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
+ "error registering internal postoperation plugin\n");
+ return -1;
+ }
+ slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
+ "registered plugin hooks\n");
+ global_plugin_state = NULL;
/* Note that the plugin was successfully loaded. */
slapi_log_error(SLAPI_LOG_PLUGIN, plugin_description.spd_id,
"plugin initialized\n");