summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-06-06 19:28:05 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-06-06 19:28:05 -0400
commit817cbf9aeec553b11cf20a51cc0d79e126ecb43f (patch)
treeb2865e6da70dba2dfe4a2c05333d04cd8465bea6
parentf6f243bda9f23a750c8b5622a5df70d445aaaf9a (diff)
- make more configuration attributes compile-time defines
-rw-r--r--configure.ac35
-rw-r--r--src/backend.c22
2 files changed, 49 insertions, 8 deletions
diff --git a/configure.ac b/configure.ac
index 784aff2..137b561 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,6 +23,13 @@ else
LIBS="$saved_LIBS"
fi
AC_SUBST(LIBWRAP)
+AC_ARG_WITH(tcp-wrappers-name,
+ AS_HELP_STRING([--with-tcp-wrappers-name=nis-plugin]
+ [tcp-wrappers server name]),
+ tcpwrapname=$withval,tcpwrapname=nis-plugin)
+AC_DEFINE_UNQUOTED(DEFAULT_TCPWRAPNAME,"tcpwrapname",
+ [Define to the default application name to use when evaluating hosts.allow and hosts.deny.])
+AC_SUBST(tcpwrapname)
AC_ARG_WITH(domain,
AS_HELP_STRING([--with-domain=[[example.com]]],
@@ -114,22 +121,42 @@ AC_DEFINE_UNQUOTED(MAP_CONFIGURATION_FILTER_ATTR,"$filterattr",
[Define to name of the attribute which holds the filter for selecting entries for a given map.])
keyformatattr=keyFormat
AC_DEFINE_UNQUOTED(MAP_CONFIGURATION_KEY_ATTR,"$keyformatattr",
- [Define to name of the attribute which holds the format specifier for the key for a map entry.])
+ [Define to name of the map configuration attribute which holds the format specifier for the key for a map entry.])
valueformatattr=valueFormat
AC_DEFINE_UNQUOTED(MAP_CONFIGURATION_VALUE_ATTR,"$valueformatattr",
- [Define to name of the attribute which holds the format specifier for the value for a map entry.])
+ [Define to name of the map configuration attribute which holds the format specifier for the value for a map entry.])
domainattr=domain
AC_DEFINE_UNQUOTED(MAP_CONFIGURATION_DOMAIN_ATTR,"$domainattr",
- [Define to name of the attribute which holds the name of the domain of the map.])
+ [Define to name of the map configuration attribute which holds the name of the domain of the map.])
mapattr=map
AC_DEFINE_UNQUOTED(MAP_CONFIGURATION_MAP_ATTR,"$mapattr",
- [Define to name of the attribute which holds the name of the map.])
+ [Define to name of the map configuration attribute which holds the name of the map.])
+maxvalue_attr=nis-plugin-max-value-size
+AC_DEFINE_UNQUOTED(PLUGIN_CONFIGURATION_MAXVALUE_ATTR,"$maxvalue_attr",
+ [Define to the name of the plugin configuration attribute which holds the maximum size for a NIS entry value.])
+maxdgram_attr=nis-plugin-max-dgram-size
+AC_DEFINE_UNQUOTED(PLUGIN_CONFIGURATION_MAXDGRAM_ATTR,"$maxdgram_attr",
+ [Define to the name of the plugin configuration attribute which holds the maximum size for a NIS datagram response.])
+securenet_attr=nis-plugin-securenet
+AC_DEFINE_UNQUOTED(PLUGIN_CONFIGURATION_SECURENET_ATTR,"$securenet_attr",
+ [Define to the name of the plugin configuration attribute which holds a securenets entry.])
+tcpwrapname_attr=nis-plugin-tcp-wrappers-name
+AC_DEFINE_UNQUOTED(PLUGIN_CONFIGURATION_TCPWRAPNAME_ATTR,"$tcpwrapname_attr",
+ [Define to the name of the plugin configuration attribute which holds service name that will be used when evaluating hosts.allow and hosts.deny.])
+port_attr=nis-plugin-port
+AC_DEFINE_UNQUOTED(PLUGIN_CONFIGURATION_PORT_ATTR,"$port_attr",
+ [Define to the name of the plugin configuration attribute which holds the port which the server should use by default. If none is specified, the server will attempt to use any available port.])
AC_SUBST(domainattr)
AC_SUBST(mapattr)
AC_SUBST(baseattr)
AC_SUBST(filterattr)
AC_SUBST(keyformatattr)
AC_SUBST(valueformatattr)
+AC_SUBST(maxvalue_attr)
+AC_SUBST(maxdgram_attr)
+AC_SUBST(securenet_attr)
+AC_SUBST(tcpwrapname)
+AC_SUBST(port_attr)
AC_CONFIG_HEADER(config.h)
AC_OUTPUT(Makefile src/Makefile plugin.ldif)
diff --git a/src/backend.c b/src/backend.c
index bcaa64c..2f87b2d 100644
--- a/src/backend.c
+++ b/src/backend.c
@@ -39,6 +39,10 @@
#include <rpc/xdr.h>
#include <rpcsvc/yp_prot.h>
+#ifdef HAVE_TCPD_H
+#include <tcpd.h>
+#endif
+
#include "backend.h"
#include "defaults.h"
#include "format.h"
@@ -603,13 +607,15 @@ backend_read_params(struct plugin_state *state)
Slapi_Entry *our_entry;
Slapi_ValueSet *values;
Slapi_Value *value;
- char *actual_attr, *cvalue;
+ char *actual_attr;
+ const char *cvalue;
int disposition, buffer_flags, ivalue, i, j;
unsigned int uvalue;
char *attrs[] = {
- "nis-plugin-max-value-size",
- "nis-plugin-max-dgram-size",
- "nis-plugin-securenet",
+ PLUGIN_CONFIGURATION_MAXVALUE_ATTR,
+ PLUGIN_CONFIGURATION_MAXDGRAM_ATTR,
+ PLUGIN_CONFIGURATION_SECURENET_ATTR,
+ PLUGIN_CONFIGURATION_TCPWRAPNAME_ATTR,
NULL,
};
/* Try to read our name from the top-level configuration node. */
@@ -673,9 +679,17 @@ backend_read_params(struct plugin_state *state)
break;
case 2: /* securenet entry */
while (j != -1) {
+ /* XXX */
j = slapi_valueset_next_value(values, j, &value);
}
break;
+ case 3: /* tcp-wrappers name */
+#ifdef HAVE_TCPD_H
+ cvalue = slapi_value_get_string(value);
+ request_set(state->request_info,
+ RQ_DAEMON, cvalue);
+#endif
+ break;
default:
break;
}