On (16/01/14 11:02), Noam Meltzer wrote:
---
Makefile.am | 21 +++++++++++++++++++++
configure.ac | 10 ++++++++++
src/conf_macros.m4 | 30 ++++++++++++++++++++++++++++++
src/external/libnfsidmap.m4 | 17 +++++++++++++++++
4 files changed, 78 insertions(+)
create mode 100644 src/external/libnfsidmap.m4
diff --git a/Makefile.am b/Makefile.am
index 9c155d6..62ad89e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -43,6 +43,7 @@ localedir = @localedir@
nsslibdir = @nsslibdir@
pamlibdir = @pammoddir@
autofslibdir = @appmodpath@
+nfslibdir = @nfsidmaplibdir@
dbpath = @dbpath@
pluginpath = @pluginpath@
@@ -509,6 +510,9 @@ dist_noinst_HEADERS = \
src/tests/cmocka/common_mock_resp.h \
src/sss_client/ssh/sss_ssh_client.h \
src/sss_client/sudo/sss_sudo.h \
+ src/sss_client/nfs/nfsidmap_internal.h \
+ src/sss_client/nfs/cfg.h \
+ src/sss_client/nfs/queue.h \
src/lib/idmap/sss_idmap_private.h
@@ -1543,6 +1547,23 @@ libnss_sss_la_LDFLAGS = \
-version-info 2:0:0 \
-Wl,--version-script,$(srcdir)/src/sss_client/sss_nss.exports
+
+if BUILD_NFS
+nfslib_LTLIBRARIES = sss_nfs.la
+sss_nfs_la_SOURCES = \
+ src/sss_client/common.c \
+ src/sss_client/nss_mc_common.c \
+ src/util/io.c \
+ src/util/murmurhash3.c \
+ src/sss_client/nss_mc_passwd.c \
+ src/sss_client/nss_mc_group.c \
+ src/sss_client/nfs/sss_nfs_client.c \
+ $(NULL)
+sss_nfs_la_CFLAGS = $(AM_CFLAGS)
+sss_nfs_la_LIBADD = $(CLIENT_LIBS) $(NFSIDMAP_LIBS)
+sss_nfs_la_LDFLAGS = -module -avoid-version
+endif
+
pamlib_LTLIBRARIES = pam_sss.la
pam_sss_la_SOURCES = \
src/sss_client/pam_sss.c \
diff --git a/configure.ac b/configure.ac
index 9303820..6e41f5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,6 +91,13 @@ AC_ARG_ENABLE([pammoddir], [AS_HELP_STRING([--enable-pammoddir],
[pammoddir=$libdir/security])
AC_SUBST(pammoddir)
+#Set the NFSv4 idmapd library install path
+AC_ARG_ENABLE([nfsidmaplibdir], [AS_HELP_STRING([--enable-nfsidmaplibdir],
+ [Where to install libnfsidmap libraries
($libdir/libnfsidmap)])],
+ [nfsidmaplibdir=$enableval],
+ [nfsidmaplibdir=$libdir/libnfsidmap])
+AC_SUBST(nfsidmaplibdir)
+
#Include here cause WITH_INIT_DIR requires $osname set in platform.m4
m4_include([src/external/platform.m4])
@@ -127,6 +134,8 @@ WITH_AUTOFS
WITH_SSH
WITH_CRYPTO
WITH_SYSLOG
+WITH_NFS
+WITH_NFS_LIB_PATH
m4_include([src/external/pkg.m4])
m4_include([src/external/libpopt.m4])
@@ -159,6 +168,7 @@ m4_include([src/external/signal.m4])
m4_include([src/external/inotify.m4])
m4_include([src/external/libndr_nbt.m4])
m4_include([src/external/sasl.m4])
+m4_include([src/external/libnfsidmap.m4])
Even if I call configure with argument
--without-nfs, ./configure will fail
with message:
checking for NFSIDMAP... no
checking nfsidmap.h usability... no
checking nfsidmap.h presence... no
checking for nfsidmap.h... no
configure: error: libnfsidmap header files are not installed
I will write reason in the comment to the file libnfsidmap.m4
WITH_UNICODE_LIB
if test x$unicode_lib = xlibunistring; then
diff --git a/src/conf_macros.m4 b/src/conf_macros.m4
index 4be819d..bb6a2f2 100644
--- a/src/conf_macros.m4
+++ b/src/conf_macros.m4
@@ -626,3 +626,33 @@ AC_DEFUN([WITH_SSH],
fi
AM_CONDITIONAL([BUILD_SSH], [test x"$with_ssh" = xyes])
])
+
+ AC_DEFUN([WITH_NFS],
+ [ AC_ARG_WITH([nfs],
+ [AC_HELP_STRING([--with-nfs],
+ [Whether to build with NFSv4 IDMAP support [yes]]
+ )
+ ],
+ [with_nfs=$withval],
+ with_nfs=yes
+ )
+
+ if test x"$with_nfs" = xyes; then
+ AC_DEFINE(BUILD_NFS, 1, [whether to build with NFSv4 IDMAP support])
+ fi
+ AM_CONDITIONAL([BUILD_NFS], [test x"$with_nfs" = xyes])
+ ])
+
+AC_DEFUN([WITH_NFS_LIB_PATH],
+ [ AC_ARG_WITH([nfs-lib-path],
+ [AC_HELP_STRING([--with-nfs-lib-path=<path>],
+ [Path to the nfs library [${libdir}]]
+ )
+ ]
+ )
+ nfslibpath="${libdir}"
+ if test x"$with_nfs_lib_path" != x; then
+ nfslibpath=$with_nfs_lib_path
+ fi
+ AC_SUBST(nfslibpath)
+ ])
\ No newline at end of file
diff --git a/src/external/libnfsidmap.m4 b/src/external/libnfsidmap.m4
new file mode 100644
index 0000000..88ba8e6
--- /dev/null
+++ b/src/external/libnfsidmap.m4
@@ -0,0 +1,17 @@
+AC_SUBST(NFSIDMAP_OBJ)
+AC_SUBST(NFSIDMAP_CFLAGS)
+AC_SUBST(NFSIDMAP_LIBS)
+
+PKG_CHECK_MODULES([NFSIDMAP], [libnfsidmap], [found_nfsidmap=yes],
+ [found_nfsidmap=no])
+
+SSS_AC_EXPAND_LIB_DIR()
+AS_IF([test x"$found_nfsidmap" != xyes],
We should skip detection, if
configure script was called with argument
--without-nfs.
For example:
-AS_IF([test x"$found_nfsidmap" != xyes],
+AS_IF([test x"$with_nfs" = xyes -a x"$found_nfsidmap" != xyes],
+ [AC_CHECK_HEADER([nfsidmap.h],
+ [AC_CHECK_LIB([nfsidmap],
+ [nfs4_init_name_mapping],
+ [NFSIDMAP_LIBS="-L$sss_extra_libdir -lnfsidmap"],
+ [AC_MSG_ERROR([libnfsidmap missing nfs4_init_name_mapping])],
+ [-L$sss_extra_libdir])],
+ [AC_MSG_ERROR([libnfsidmap header files are not installed])])]
If header file could not be found, it is possible that user do not need(want)
to build plugin for nfs. nfsidmap plugin is enabled by default. We should be
more verbose and propose to run configure with argument "--without-nfs".
The similar message message is in the file src/external/cifsidmap.m4
I don't know how to test patches, so I let this for others (simo :-)
https://lists.fedorahosted.org/pipermail/sssd-devel/2014-January/018080.html
Thank you very much for patches.
LS