summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.am1
-rw-r--r--configure.ac7
-rw-r--r--src/rpcbind.c10
3 files changed, 16 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index b732555..8715082 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -8,6 +8,7 @@ AM_CPPFLAGS = \
-DINET6 \
-DRPCBIND_STATEDIR="\"$(statedir)\"" \
-DRPCBIND_USER="\"$(rpcuser)\"" \
+ -DNSS_MODULES="\"$(nss_modules)\"" \
-D_GNU_SOURCE \
$(TIRPC_CFLAGS)
diff --git a/configure.ac b/configure.ac
index 39181f0..5a88cc7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -27,6 +27,13 @@ AC_ARG_WITH([rpcuser],
,, [with_rpcuser=root])
AC_SUBST([rpcuser], [$with_rpcuser])
+AC_ARG_WITH([nss_modules],
+ AS_HELP_STRING([--with-nss-modules=NSS_MODULES]
+ , [Sets the nss module search list to the given space-delimited string.
+ For example --with-nss-modules="files altfiles" @<:@default=files@:>@])
+ ,, [with_nss_modules=files])
+AC_SUBST([nss_modules], [$with_nss_modules])
+
PKG_CHECK_MODULES([TIRPC], [libtirpc])
AS_IF([test x$enable_libwrap = xyes], [
diff --git a/src/rpcbind.c b/src/rpcbind.c
index 924aca1..e3462e3 100644
--- a/src/rpcbind.c
+++ b/src/rpcbind.c
@@ -91,6 +91,12 @@ char *rpcbinduser = RPCBIND_USER;
char *rpcbinduser = NULL;
#endif
+#ifdef NSS_MODULES
+char *nss_modules = NSS_MODULES;
+#else
+char *nss_modules = "files";
+#endif
+
/* who to suid to if -s is given */
#define RUN_AS "daemon"
@@ -165,7 +171,7 @@ main(int argc, char *argv[])
* Make sure we use the local service file
* for service lookkups
*/
- __nss_configure_lookup("services", "files");
+ __nss_configure_lookup("services", nss_modules);
nc_handle = setnetconfig(); /* open netconfig file */
if (nc_handle == NULL) {
@@ -231,7 +237,7 @@ main(int argc, char *argv[])
* Make sure we use the local password file
* for these lookups.
*/
- __nss_configure_lookup("passwd", "files");
+ __nss_configure_lookup("passwd", nss_modules);
if((p = getpwnam(id)) == NULL) {
syslog(LOG_ERR, "cannot get uid of '%s': %m", id);