From 9fe18a0d9f5ed00295b5601b22bf2143b8012f5b Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Tue, 8 Jul 2008 14:32:34 -0400 Subject: - add framework for adding a test suite - provide a way to get the nis plugin to run more or less unprivileged --- src/plug-nis.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/plug-nis.c') diff --git a/src/plug-nis.c b/src/plug-nis.c index e0f1707..1c43a03 100644 --- a/src/plug-nis.c +++ b/src/plug-nis.c @@ -224,13 +224,23 @@ plugin_state_init(Slapi_PBlock *pb, struct plugin_state **lstate) /* Create a socket for use in communicating with the portmapper. */ sockfd = socket(PF_INET, SOCK_DGRAM, 0); if (sockfd == -1) { + slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, + "error allocating portmap client socket\n"); goto failed; } memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; if (bindresvport(sockfd, &sin) != 0) { + slapi_log_error(SLAPI_LOG_PLUGIN, state->plugin_desc->spd_id, + "error binding portmap client socket to a " + "privileged port\n"); + if ((getenv(NIS_PLUGIN_CONTINUE_WITHOUT_PORTMAP_ENV) == NULL) || + !atol(getenv(NIS_PLUGIN_CONTINUE_WITHOUT_PORTMAP_ENV))) { + close(sockfd); + goto failed; + } close(sockfd); - goto failed; + sockfd = -1; } state->pmap_client_socket = sockfd; -- cgit