summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2007-11-15 16:59:42 -0500
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2007-11-15 16:59:42 -0500
commit89b87092358c5f144fec29d16207b77664ff6880 (patch)
treec555ae5a9d79650a634179017a45615a65187e06 /src
parent6b56f05e2616725f8438e544350f72d077e56321 (diff)
downloadslapi-nis-89b87092358c5f144fec29d16207b77664ff6880.tar.gz
slapi-nis-89b87092358c5f144fec29d16207b77664ff6880.tar.xz
slapi-nis-89b87092358c5f144fec29d16207b77664ff6880.zip
- more with pmap registration
Diffstat (limited to 'src')
-rw-r--r--src/Makefile2
-rw-r--r--src/plugin.c20
2 files changed, 18 insertions, 4 deletions
diff --git a/src/Makefile b/src/Makefile
index 94ad3f3..5fa7dfa 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1,5 +1,5 @@
CFLAGS = -g3 -Wall -fPIC -D_REENTRANT $(shell pkg-config --cflags nspr nss)
-LDFLAGS = -lpthread
+LDFLAGS = -lnsl -lpthread
plugin.so: plugin.c
$(CC) $(CFLAGS) -shared -o $@ $^ $(LDFLAGS)
diff --git a/src/plugin.c b/src/plugin.c
index f5dcc1e..1f19e93 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -13,6 +13,10 @@
#include <syslog.h>
#include <unistd.h>
+#include <rpc/rpc.h>
+#include <rpc/pmap_clnt.h>
+#include <rpcsvc/yp.h>
+
#include <nspr.h>
#include <secport.h>
#include <plarenas.h>
@@ -244,7 +248,7 @@ plugin_start(Slapi_PBlock *pb)
{
struct state *state;
slapi_pblock_get(pb, SLAPI_PLUGIN_PRIVATE, &state);
- slapi_log_error(SLAPI_LOG_PLUGIN, "my_init_function",
+ slapi_log_error(SLAPI_LOG_PLUGIN, "plugin_start",
"plugin starting\n");
if (pthread_create(&state->tid, NULL, &process_requests, state) != 0) {
slapi_log_error(SLAPI_LOG_PLUGIN, plugin_description.spd_id,
@@ -259,6 +263,10 @@ plugin_start(Slapi_PBlock *pb)
static int
plugin_close(Slapi_PBlock *pb)
{
+ if (pmap_unset(YPPROG, YPVERS) != 1) {
+ slapi_log_error(SLAPI_LOG_PLUGIN, "plugin_start",
+ "error unregistering ports, continuing\n");
+ }
slapi_log_error(SLAPI_LOG_PLUGIN, "my_init_function",
"plugin closing\n");
return 0;
@@ -279,8 +287,14 @@ my_init_function(Slapi_PBlock *pb)
slapi_pblock_set(pb, SLAPI_PLUGIN_CLOSE_FN, &plugin_close);
slapi_pblock_get(pb, SLAPI_PLUGIN_IDENTITY, &state->plugin_identity);
slapi_pblock_set(pb, SLAPI_PLUGIN_PRIVATE, state);
- slapi_log_error(SLAPI_LOG_PLUGIN, plugin_description.spd_id,
- "plugin identity %lx\n", state->plugin_identity);
+ if (pmap_set(YPPROG, YPVERS, IPPROTO_TCP, PORT) != 1) {
+ slapi_log_error(SLAPI_LOG_PLUGIN, "plugin_start",
+ "error registering TCP port, continuing\n");
+ }
+ if (pmap_set(YPPROG, YPVERS, IPPROTO_UDP, PORT) != 1) {
+ slapi_log_error(SLAPI_LOG_PLUGIN, "plugin_start",
+ "error registering UDP port, continuing\n");
+ }
slapi_log_error(SLAPI_LOG_PLUGIN, plugin_description.spd_id,
"registering plugin hooks\n");
return 0;