summaryrefslogtreecommitdiffstats
path: root/src/plugin.c
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-03-27 17:28:15 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-03-27 17:28:15 -0400
commit5f8a2c836e4f76442f8a633960ed8a11b7303077 (patch)
tree0e13b3e99d592ba4789f4692ea9339aa1b51d64f /src/plugin.c
parent50726269dc73676b82ef442914f9cf479e044872 (diff)
downloadslapi-nis-5f8a2c836e4f76442f8a633960ed8a11b7303077.tar.gz
slapi-nis-5f8a2c836e4f76442f8a633960ed8a11b7303077.tar.xz
slapi-nis-5f8a2c836e4f76442f8a633960ed8a11b7303077.zip
separate the searching bits out from the nis protocol bits
Diffstat (limited to 'src/plugin.c')
-rw-r--r--src/plugin.c23
1 files changed, 6 insertions, 17 deletions
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,