diff options
Diffstat (limited to 'src/plugin.c')
-rw-r--r-- | src/plugin.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/plugin.c b/src/plugin.c index 330fd02..c554eb1 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -49,13 +49,9 @@ plugin_startup(Slapi_PBlock *pb) const char *pname; int i, protocol; slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &state); - slapi_log_error(SLAPI_LOG_PLUGIN, plugin_description.spd_id, - "plugin starting\n"); - /* Initialize the maps and data. */ - map_init(state); - slapi_log_error(SLAPI_LOG_PLUGIN, - plugin_description.spd_id, - "initialized maps\n"); + slapi_pblock_get(pb, SLAPI_TARGET_DN, &state->plugin_base); + /* Populate the maps and data. */ + map_startup(state); /* Register the listener sockets with the portmapper. */ if (state->pmap_client_socket != -1) { for (i = 0; i < state->n_listeners; i++) { @@ -111,6 +107,7 @@ plugin_shutdown(Slapi_PBlock *pb) portmap_unregister(plugin_description.spd_id, state->pmap_client_socket, YPPROG, YPVERS); } + free(state); return 0; } @@ -134,8 +131,10 @@ plugin_state_init(Slapi_PBlock *pb, struct plugin_state **lstate) goto failed; } state->arena = arena; + state->plugin_base = NULL; state->plugin_desc = &plugin_description; slapi_pblock_get(pb, SLAPI_PLUGIN_IDENTITY, &state->plugin_identity); + slapi_pblock_get(pb, SLAPI_TARGET_DN, &state->plugin_base); /* Create a socket for use in communicating with the portmapper. */ sockfd = socket(PF_INET, SOCK_DGRAM, 0); @@ -264,6 +263,8 @@ nis_plugin_init(Slapi_PBlock *pb) 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); + /* Let the backend do its registration. */ + map_init(pb, state); slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, "registered plugin hooks\n"); return 0; |