summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Makefile2
-rw-r--r--src/dispatch.c1
-rw-r--r--src/plugin.c23
3 files changed, 7 insertions, 19 deletions
diff --git a/src/Makefile b/src/Makefile
index 5bd715f..0a544eb 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -3,7 +3,7 @@ LDFLAGS = -lnsl -lpthread
all:: plugin.so portmap
-plugin.so: dispatch.c plugin.c portmap.c nis.c
+plugin.so: dispatch.c map.c nis.c plugin.c portmap.c
$(CC) $(CFLAGS) -shared -o $@ $^ $(LDFLAGS)
portmap: portmap.c
$(CC) $(CFLAGS) -o $@ -DPORTMAP_MAIN $^ $(LDFLAGS)
diff --git a/src/dispatch.c b/src/dispatch.c
index 6e1999a..728137b 100644
--- a/src/dispatch.c
+++ b/src/dispatch.c
@@ -24,7 +24,6 @@
#include "nis.h"
#include "plugin.h"
#include "portmap.h"
-#include "schema.h"
#define MAX_CLIENT_IDLE (60 * 1000)
diff --git a/src/plugin.c b/src/plugin.c
index 5ada3e4..3890070 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -28,7 +28,6 @@
#include "nis.h"
#include "plugin.h"
#include "portmap.h"
-#include "schema.h"
#define PACKAGE_VERSION "0.0"
@@ -127,24 +126,10 @@ plugin_state_init(struct plugin_state **lstate)
}
state->arena = arena;
- /* Bind to a privileged port now so that the portmapper will let us
- * register after the server's dropped privileges. */
- state->pmap_client_socket = socket(PF_INET, SOCK_DGRAM, 0);
- memset(&sin, 0, sizeof(sin));
- if (bindresvport(state->pmap_client_socket, &sin) != 0) {
- slapi_log_error(SLAPI_LOG_PLUGIN,
- plugin_description.spd_id,
- "error setting up portmap client socket, %ld\n",
- (long) getuid());
- close(state->pmap_client_socket);
- state->pmap_client_socket = -1;
- goto failed;
- }
-
/* We need to bind on privileged ports for both datagram and connected
* listeners, over both IPv4 and IPv6. */
state->n_listeners = 0;
- for (i = 0; i < 4; i++) {
+ for (i = 0; i < 2; i++) {
int pf, type, fd, one, port, ret;
const char *sock_desc;
/* Before we do anything else, on our second trip through, make
@@ -181,7 +166,11 @@ plugin_state_init(struct plugin_state **lstate)
sock_desc);
}
/* Bind to a reserved port. */
- ret = (pf == PF_INET6) ? bindresvport6(sockfd, &sin6) :
+ memset(&sin, 0, sizeof(sin));
+ memset(&sin6, 0, sizeof(sin6));
+ sin.sin_family = AF_INET;
+ sin6.sin6_family = AF_INET6;
+ ret = (pf == PF_INET6) ? bindresvport(sockfd, (struct sockaddr_in*) &sin6) :
bindresvport(sockfd, &sin);
if (ret != 0) {
slapi_log_error(SLAPI_LOG_PLUGIN,