summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-06-30 18:51:42 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-06-30 18:51:42 -0400
commit3e813914dd169339e282cd86cca50dffefef6cd6 (patch)
treed67f923d68a5402b08bc6449426325e475a9a5d7 /src
parente8efda9238041ffcec0acf1e42fc9011342950c6 (diff)
downloadslapi-nis-3e813914dd169339e282cd86cca50dffefef6cd6.tar.gz
slapi-nis-3e813914dd169339e282cd86cca50dffefef6cd6.tar.xz
slapi-nis-3e813914dd169339e282cd86cca50dffefef6cd6.zip
- have the plugin call backend initialization directly
Diffstat (limited to 'src')
-rw-r--r--src/back-sch.c25
-rw-r--r--src/map.c8
-rw-r--r--src/plug-nis.c5
-rw-r--r--src/plug-sch.c4
4 files changed, 30 insertions, 12 deletions
diff --git a/src/back-sch.c b/src/back-sch.c
index ead2861..0459f8c 100644
--- a/src/back-sch.c
+++ b/src/back-sch.c
@@ -577,6 +577,12 @@ backend_update_params(struct plugin_state *state)
{
}
+static int
+backend_search_cb(Slapi_PBlock *pb)
+{
+ return 0;
+}
+
/* Populate our data. */
void
backend_startup(struct plugin_state *state)
@@ -584,9 +590,24 @@ backend_startup(struct plugin_state *state)
backend_shr_startup(state, SCH_CONTAINER_CONFIGURATION_FILTER);
}
-/* Set up our post-op callbacks. */
+static void
+backend_preop_init(Slapi_PBlock *pb, struct plugin_state *state)
+{
+ if (slapi_pblock_set(pb, SLAPI_PLUGIN_PRE_SEARCH_FN,
+ backend_search_cb) != 0) {
+ slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
+ "error hooking up search callback\n");
+ }
+}
+static void
+backend_postop_init(Slapi_PBlock *pb, struct plugin_state *state)
+{
+ backend_shr_postop_init(pb, state);
+}
+/* Set up our callbacks. */
void
backend_init(Slapi_PBlock *pb, struct plugin_state *state)
{
- backend_shr_postop_init(pb, state);
+ backend_preop_init(pb, state);
+ backend_postop_init(pb, state);
}
diff --git a/src/map.c b/src/map.c
index 5494886..6f95e61 100644
--- a/src/map.c
+++ b/src/map.c
@@ -1003,13 +1003,6 @@ map_data_set_entry(struct plugin_state *state,
}
int
-map_startup(struct plugin_state *state)
-{
- backend_startup(state);
- return 0;
-}
-
-int
map_init(struct slapi_pblock *pb, struct plugin_state *state)
{
memset(&map_data, 0, sizeof(map_data));
@@ -1017,7 +1010,6 @@ map_init(struct slapi_pblock *pb, struct plugin_state *state)
if (map_data.lock == NULL) {
return -1;
}
- backend_init(pb, state);
return 0;
}
diff --git a/src/plug-nis.c b/src/plug-nis.c
index 60acc08..50bec98 100644
--- a/src/plug-nis.c
+++ b/src/plug-nis.c
@@ -52,12 +52,13 @@
#include <slapi-plugin.h>
#endif
-#include "wrap.h"
+#include "backend.h"
#include "disp-nis.h"
#include "map.h"
#include "nis.h"
#include "plugin.h"
#include "portmap.h"
+#include "wrap.h"
/* the module initialization function */
static Slapi_PluginDesc
@@ -79,6 +80,7 @@ plugin_startup(Slapi_PBlock *pb)
slapi_pblock_get(pb, SLAPI_TARGET_DN, &state->plugin_base);
/* Populate the maps and data. */
map_startup(state);
+ backend_startup(state);
/* Register the listener sockets with the portmapper. */
if (state->pmap_client_socket != -1) {
/* kick off any other NIS servers */
@@ -359,6 +361,7 @@ nis_plugin_init(Slapi_PBlock *pb)
slapi_pblock_set(pb, SLAPI_PLUGIN_PRIVATE, state);
/* Let the backend do its registration. */
map_init(pb, state);
+ backend_init(pb, state);
slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
"registered plugin hooks\n");
return 0;
diff --git a/src/plug-sch.c b/src/plug-sch.c
index b406893..21d792e 100644
--- a/src/plug-sch.c
+++ b/src/plug-sch.c
@@ -52,10 +52,11 @@
#include <slapi-plugin.h>
#endif
-#include "wrap.h"
+#include "backend.h"
#include "map.h"
#include "plugin.h"
#include "portmap.h"
+#include "wrap.h"
/* the module initialization function */
static Slapi_PluginDesc
@@ -107,6 +108,7 @@ schema_compat_plugin_init(Slapi_PBlock *pb)
slapi_pblock_set(pb, SLAPI_PLUGIN_PRIVATE, state);
/* Let the backend do its setup. */
map_init(pb, state);
+ backend_init(pb, state);
slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id,
"registered plugin hooks\n");
return 0;