summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustin Mitchell <jumitche@redhat.com>2017-10-26 08:46:43 -0400
committerSteve Dickson <steved@redhat.com>2017-10-26 08:50:08 -0400
commitf821eb7f9624f047a12fbf5c9dce23994eeb50e8 (patch)
treedc7cf0bc359fb6c7b599aa86a33d6f9a17024a81
parent1ea6d9231f839b968adb44eaf98b363f436cb1d5 (diff)
downloadnfs-utils-f821eb7f9624f047a12fbf5c9dce23994eeb50e8.tar.gz
nfs-utils-f821eb7f9624f047a12fbf5c9dce23994eeb50e8.tar.xz
nfs-utils-f821eb7f9624f047a12fbf5c9dce23994eeb50e8.zip
nfs-utils: integrate libnfsidmap code with rest of nfs-utils
Modify libnfsidmap to use the now shared conffile code, adjust the build structure to generate everything correctly, and modify the other utils to use the merged version of libnfsidmap instead of testing for an external dependancy. Signed-off-by: Justin Mitchell <jumitche@redhat.com> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--configure.ac50
-rw-r--r--support/Makefile.am8
-rw-r--r--support/nfsidmap/Makefile.am8
-rw-r--r--support/nfsidmap/libnfsidmap.c5
-rw-r--r--support/nfsidmap/libnfsidmap.pc11
-rw-r--r--support/nfsidmap/nss.c2
-rw-r--r--support/nfsidmap/static.c5
-rw-r--r--support/nfsidmap/umich_ldap.c2
-rw-r--r--utils/Makefile.am2
-rw-r--r--utils/gssd/Makefile.am3
-rw-r--r--utils/idmapd/Makefile.am4
-rw-r--r--utils/nfsidmap/Makefile.am4
12 files changed, 80 insertions, 24 deletions
diff --git a/configure.ac b/configure.ac
index 1ca1603..0513ff7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -304,9 +304,6 @@ if test "$enable_nfsv4" = yes; then
dnl check for libevent libraries and headers
AC_LIBEVENT
- dnl check for nfsidmap libraries and headers
- AC_LIBNFSIDMAP
-
dnl check for the keyutils libraries and headers
AC_KEYUTILS
@@ -339,7 +336,6 @@ fi
dnl enable nfsidmap when its support by libnfsidmap
AM_CONDITIONAL(CONFIG_NFSDCLTRACK, [test "$enable_nfsdcltrack" = "yes" ])
-AM_CONDITIONAL(CONFIG_NFSIDMAP, [test "$ac_cv_header_keyutils_h$ac_cv_lib_nfsidmap_nfs4_owner_to_uid" = "yesyes"])
if test "$knfsd_cv_glibc2" = no; then
@@ -382,9 +378,6 @@ if test "$enable_gss" = yes; then
dnl check for libevent libraries and headers
AC_LIBEVENT
- dnl 'gss' also depends on nfsidmap.h - at least for svcgssd_proc.c
- AC_LIBNFSIDMAP
-
dnl Check for Kerberos V5
AC_KERBEROS_V5
@@ -407,6 +400,47 @@ if test "$enable_gss" = yes; then
fi
fi
+dnl libdnsidmap specific checks
+AC_CHECK_LIB([resolv], [__res_querydomain], , AC_MSG_ERROR(res_querydomain needed))
+
+AC_ARG_ENABLE([ldap],
+ [AS_HELP_STRING([--disable-ldap],[Disable support for LDAP @<:default=detect@:>@])])
+
+dnl will libdnsidmap support LDAP ?
+if test "x$enable_ldap" != "xno" ; then
+ AC_CHECK_HEADER([ldap.h],
+ [AC_CHECK_LIB([ldap], [ldap_initialize],
+ [have_ldap="yes"],[have_ldap="no"])],
+ [have_ldap="no"])
+ if test "x$have_ldap" = "xyes" ; then
+ AC_DEFINE([ENABLE_LDAP], 1, [Enable LDAP Support])
+ elif test "x$enable_ldap$have_ldap" = "xyesno" ; then
+ AC_MSG_ERROR(LDAP support not found!)
+ fi
+fi
+AM_CONDITIONAL(ENABLE_LDAP, test "x$have_ldap" = "xyes")
+
+dnl Should we build gums mapping library?
+AC_ARG_ENABLE([gums],
+ [AS_HELP_STRING([--enable-gums],[Enable support for the GUMS mapping library @<:@default=false@:>@])])
+if test "x$enable_gums" = "xyes" ; then
+ AC_DEFINE([ENABLE_GUMS], 1, [Enable GUMS mapping library support])
+fi
+AM_CONDITIONAL(ENABLE_GUMS, test "x$enable_gums" = "xyes")
+
+dnl Where do the Plugins live
+AC_ARG_WITH(pluginpath,
+ [AS_HELP_STRING([--with-pluginpath=/foo],[Causes the library to look in /foo instead of /usr/lib/libnfsidmap for plugins
+ ])],
+ path_plugins=$withval,
+ path_plugins=""
+ )
+if test -n "$path_plugins" ; then
+ AC_DEFINE_UNQUOTED(PATH_PLUGINS, "$path_plugins",
+ [Define this to change the plugins path])
+fi
+AM_CONDITIONAL(PATH_PLUGINS, test -n "$path_plugins")
+
dnl Check for IPv6 support
AC_IPV6
@@ -537,6 +571,8 @@ AC_CONFIG_FILES([
support/misc/Makefile
support/nfs/Makefile
support/nsm/Makefile
+ support/nfsidmap/Makefile
+ support/nfsidmap/libnfsidmap.pc
tools/Makefile
tools/locktest/Makefile
tools/nlmtest/Makefile
diff --git a/support/Makefile.am b/support/Makefile.am
index cb37733..8365d3b 100644
--- a/support/Makefile.am
+++ b/support/Makefile.am
@@ -1,6 +1,12 @@
## Process this file with automake to produce Makefile.in
-SUBDIRS = export include misc nfs nsm
+OPTDIRS =
+
+if CONFIG_NFSV4
+OPTDIRS += nfsidmap
+endif
+
+SUBDIRS = export include misc nfs nsm $(OPTDIRS)
MAINTAINERCLEANFILES = Makefile.in
diff --git a/support/nfsidmap/Makefile.am b/support/nfsidmap/Makefile.am
index 85f19c8..32eb8cf 100644
--- a/support/nfsidmap/Makefile.am
+++ b/support/nfsidmap/Makefile.am
@@ -1,4 +1,4 @@
-ACLOCAL_AMFLAGS = -I m4
+pkgplugindir=$(libdir)/libnfsidmap
if ENABLE_LDAP
UMICH_LDAP_LIB = umich_ldap.la
@@ -11,7 +11,7 @@ else
GUMS_MAPPING_LIB =
endif
lib_LTLIBRARIES = libnfsidmap.la
-pkglib_LTLIBRARIES = nsswitch.la static.la $(UMICH_LDAP_LIB) $(GUMS_MAPPING_LIB)
+pkgplugin_LTLIBRARIES = nsswitch.la static.la $(UMICH_LDAP_LIB) $(GUMS_MAPPING_LIB)
# Library versioning notes from:
# http://sources.redhat.com/autobook/autobook/autobook_91.html
@@ -25,9 +25,9 @@ pkglib_LTLIBRARIES = nsswitch.la static.la $(UMICH_LDAP_LIB) $(GUMS_MAPPING_LIB)
# <age> The number of previous additional interfaces supported
# by this library.
-libnfsidmap_la_SOURCES = libnfsidmap.c cfg.c strlcpy.c cfg.h nfsidmap_internal.h queue.h
+libnfsidmap_la_SOURCES = libnfsidmap.c nfsidmap_internal.h
libnfsidmap_la_LDFLAGS = -version-info 3:0:3
-libnfsidmap_la_LIBADD = -ldl
+libnfsidmap_la_LIBADD = -ldl ../../support/nfs/libnfsconf.la
nsswitch_la_SOURCES = nss.c
nsswitch_la_LDFLAGS = -module -avoid-version
diff --git a/support/nfsidmap/libnfsidmap.c b/support/nfsidmap/libnfsidmap.c
index d484101..aa368b7 100644
--- a/support/nfsidmap/libnfsidmap.c
+++ b/support/nfsidmap/libnfsidmap.c
@@ -59,7 +59,7 @@
#include "nfsidmap.h"
#include "nfsidmap_internal.h"
-#include "cfg.h"
+#include "conffile.h"
static char *default_domain;
static struct conf_list *local_realms;
@@ -340,6 +340,7 @@ int nfs4_init_name_mapping(char *conffile)
char *nobody_user, *nobody_group;
char *nostrip;
char *reformatgroup;
+ char *conf_path;
/* XXX: need to be able to reload configurations... */
if (nfs4_plugins) /* already succesfully initialized */
@@ -348,7 +349,7 @@ int nfs4_init_name_mapping(char *conffile)
conf_path = conffile;
else
conf_path = PATH_IDMAPDCONF;
- conf_init();
+ conf_init(conf_path);
default_domain = conf_get_str("General", "Domain");
if (default_domain == NULL) {
dflt = 1;
diff --git a/support/nfsidmap/libnfsidmap.pc b/support/nfsidmap/libnfsidmap.pc
new file mode 100644
index 0000000..5ec28ae
--- /dev/null
+++ b/support/nfsidmap/libnfsidmap.pc
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib64
+includedir=${prefix}/include
+
+Name: libnfsidmap
+Description: Library that handles mapping between names and ids for NFSv4.
+Requires:
+Version: 2.1.1
+Libs: -L${exec_prefix}/lib64 -lnfsidmap
+Cflags: -I${prefix}/include
diff --git a/support/nfsidmap/nss.c b/support/nfsidmap/nss.c
index 82799ce..48215ff 100644
--- a/support/nfsidmap/nss.c
+++ b/support/nfsidmap/nss.c
@@ -48,7 +48,7 @@
#include <ctype.h>
#include "nfsidmap.h"
#include "nfsidmap_internal.h"
-#include "cfg.h"
+#include "conffile.h"
#include <syslog.h>
/*
diff --git a/support/nfsidmap/static.c b/support/nfsidmap/static.c
index 9f587af..37b293b 100644
--- a/support/nfsidmap/static.c
+++ b/support/nfsidmap/static.c
@@ -41,8 +41,7 @@
#include <errno.h>
#include <err.h>
-#include "queue.h"
-#include "cfg.h"
+#include "conffile.h"
#include "nfsidmap.h"
#include "nfsidmap_internal.h"
@@ -317,7 +316,7 @@ static int static_init() {
LIST_INIT (&uid_mappings[i]);
//get all principals for which we have mappings
- princ_list = conf_get_tag_list("Static");
+ princ_list = conf_get_tag_list("Static", NULL);
if (!princ_list) {
return -ENOENT;
diff --git a/support/nfsidmap/umich_ldap.c b/support/nfsidmap/umich_ldap.c
index 886fa0c..664f282 100644
--- a/support/nfsidmap/umich_ldap.c
+++ b/support/nfsidmap/umich_ldap.c
@@ -48,7 +48,7 @@
#include <ldap.h>
#include "nfsidmap.h"
#include "nfsidmap_internal.h"
-#include "cfg.h"
+#include "conffile.h"
/* attribute/objectclass default mappings */
#define DEFAULT_UMICH_OBJCLASS_REMOTE_PERSON "NFSv4RemotePerson"
diff --git a/utils/Makefile.am b/utils/Makefile.am
index b892dc8..c75a5a0 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -4,10 +4,8 @@ OPTDIRS =
if CONFIG_NFSV4
OPTDIRS += idmapd
-if CONFIG_NFSIDMAP
OPTDIRS += nfsidmap
endif
-endif
if CONFIG_NFSV41
OPTDIRS += blkmapd
diff --git a/utils/gssd/Makefile.am b/utils/gssd/Makefile.am
index 09a455e..beb3e8e 100644
--- a/utils/gssd/Makefile.am
+++ b/utils/gssd/Makefile.am
@@ -75,7 +75,8 @@ svcgssd_SOURCES = \
svcgssd_LDADD = \
../../support/nfs/libnfs.la \
- $(RPCSECGSS_LIBS) $(LIBNFSIDMAP) \
+ ../../support/nfsidmap/libnfsidmap.la \
+ $(RPCSECGSS_LIBS) \
$(KRBLIBS) $(GSSAPI_LIBS) $(LIBTIRPC)
svcgssd_LDFLAGS = $(KRBLDFLAGS)
diff --git a/utils/idmapd/Makefile.am b/utils/idmapd/Makefile.am
index b4cac93..d768eec 100644
--- a/utils/idmapd/Makefile.am
+++ b/utils/idmapd/Makefile.am
@@ -15,7 +15,9 @@ idmapd_SOURCES = \
nfs_idmap.h \
queue.h
-idmapd_LDADD = ../../support/nfs/libnfs.la $(LIBEVENT) $(LIBNFSIDMAP)
+idmapd_LDADD = ../../support/nfs/libnfs.la \
+ ../../support/nfsidmap/libnfsidmap.la \
+ $(LIBEVENT)
MAINTAINERCLEANFILES = Makefile.in
diff --git a/utils/nfsidmap/Makefile.am b/utils/nfsidmap/Makefile.am
index 8af22d0..49158df 100644
--- a/utils/nfsidmap/Makefile.am
+++ b/utils/nfsidmap/Makefile.am
@@ -4,7 +4,9 @@ man8_MANS = nfsidmap.man
sbin_PROGRAMS = nfsidmap
nfsidmap_SOURCES = nfsidmap.c
-nfsidmap_LDADD = $(LIBNFSIDMAP) -lkeyutils ../../support/nfs/libnfs.la
+nfsidmap_LDADD = -lkeyutils \
+ ../../support/nfs/libnfs.la \
+ ../../support/nfsidmap/libnfsidmap.la
MAINTAINERCLEANFILES = Makefile.in
EXTRA_DIST = id_resolver.conf $(man8_MANS)