Skip to contentSkip to conversation

Address type width mismatches between TI-RPC and glibc

PATCH In review Chuck Lever 2 participants 11 messages Mar 5, 2009 – Mar 16, 2009 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Address type width mismatches between TI-RPC and glibc

Steve-

Now that the clean up is finished, here are the patches that actually fix the type width mismatch problem between glibc headers and the TI-RPC run-time.

This patch set implements a full switch between TI-RPC run-time and headers and legacy glibc RPC run-time and headers via --enable-tirpc.

In addition there are a number of configure.ac clean ups.

These are the final patches needed to support TI-RPC and IPv6 properly in mount.nfs, umount.nfs, and showmount.

---

Chuck Lever (7):
nfs-utils: Include legacy or TI-RPC headers, not both
configure: move IPv6 feature checks into aclocal/
configure: Move rpcsecgss checking into aclocal
configure: pull common nfsidmap and event checks into aclocal/
nfs-utils: replace function-specific switches with HAVE_LIBTIRPC
configure: move TI-RPC checks into aclocal/
configure: add defensive quoting in some function checks

Jeff Layton (2):
nfs-utils: clean up handling of libgssglue in gssd Makefile
nfs-utils: don't need extra libs to do AC_CHECK_LIBS for librpcsecgss

 Makefile.am              |    7 +++
 aclocal/ipv6.m4          |   29 ++++++++++++
 aclocal/libevent.m4      |   11 +++++
 aclocal/libnfsidmap.m4   |   17 +++++++
 aclocal/librpcsecgss.m4  |   19 ++++++++
 aclocal/libtirpc.m4      |   28 ++++++++++++
 aclocal/rpcsec_vers.m4   |   12 +++++
 configure.ac             |  107 +++++++++++++++++-----------------------------
 support/nfs/getport.c    |   40 +++++++++--------
 support/nfs/rpc_socket.c |   95 ++++++++++++-----------------------------
 utils/gssd/Makefile.am   |   10 ++--
 utils/gssd/gssd_proc.c   |    3 +
 utils/gssd/krb5_util.c   |    1 
 utils/gssd/krb5_util.h   |    6 +++
 utils/mountd/svc_run.c   |    4 ++
 15 files changed, 226 insertions(+), 163 deletions(-)
 create mode 100644 aclocal/ipv6.m4
 create mode 100644 aclocal/libevent.m4
 create mode 100644 aclocal/libnfsidmap.m4
 create mode 100644 aclocal/librpcsecgss.m4
 create mode 100644 aclocal/libtirpc.m4
 create mode 100644 aclocal/rpcsec_vers.m4
Signature · 1 line
Chuck Lever

A message that is not in the archive (sent off-list or not yet received): 20090305173533.30471.41413.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org

#2 lore raw

PATCH 1/9 configure: add defensive quoting in some function checks

Clean up: Add proper m4 quoting in macros that check for the presence of some functions in configure.ac.

---

 configure.ac |   25 ++++++++++++++-----------
 1 files changed, 14 insertions(+), 11 deletions(-)
configure.ac +14 -11
index 5db4417..97b084b 100644
@@ -176,23 +176,26 @@ AC_BSD_SIGNALS
 dnl *************************************************************
 dnl * Check for required libraries
 dnl *************************************************************
-AC_CHECK_FUNC(gethostbyname, , [AC_CHECK_LIB(nsl, gethostbyname, [LIBNSL="-lnsl"])])
+
+AC_CHECK_FUNC([gethostbyname], ,
+              [AC_CHECK_LIB([nsl], [gethostbyname], [LIBNSL="-lnsl"])])
 AC_SUBST(LIBNSL)
 
-AC_CHECK_FUNC(connect, ,
-      AC_CHECK_LIB(socket, connect, [LIBSOCKET="-lsocket"],
-                AC_MSG_ERROR(Function 'socket' not found.), $LIBNSL))
+AC_CHECK_FUNC([connect], ,
+              [AC_CHECK_LIB([socket], [connect], [LIBSOCKET="-lsocket"],
+                    [AC_MSG_ERROR([Function 'socket' not found.])], [$LIBNSL])])
+
+AC_CHECK_FUNC([getaddrinfo], , ,
+              [AC_MSG_ERROR([Function 'getaddrinfo' not found.])])
 
-AC_CHECK_FUNC(getaddrinfo, , ,
-                AC_MSG_ERROR(Function 'getaddrinfo' not found.))
+AC_CHECK_FUNC([getrpcbynumber], , ,
+              [AC_MSG_ERROR([Function 'getrpcbynumber' not found.])])
 
-AC_CHECK_FUNC(getrpcbynumber, , ,
-                AC_MSG_ERROR(Function 'getrpcbynumber' not found.))
+AC_CHECK_FUNC([getservbyname], , ,
+              [AC_MSG_ERROR([Function 'getservbyname' not found.])])
 
-AC_CHECK_FUNC(getservbyname, , ,
-                AC_MSG_ERROR(Function 'getservbyname' not found.))
+AC_CHECK_LIB([crypt], [crypt], [LIBCRYPT="-lcrypt"])
 
-AC_CHECK_LIB(crypt, crypt, [LIBCRYPT="-lcrypt"])
 if test "$enable_nfsv4" = yes; then
     AC_CHECK_LIB(event, event_dispatch, [libevent=1], AC_MSG_ERROR([libevent needed for nfsv4 support]))
     AC_CHECK_LIB(nfsidmap, nfs4_init_name_mapping, [libnfsidmap=1], AC_MSG_ERROR([libnfsidmap needed for nfsv4 support]))
#3 lore raw

PATCH 2/9 configure: move TI-RPC checks into aclocal/

In reply to a message not in the archive

Define an aclocal test for TI-RPC headers and library, and move the TI-RPC checks earlier in our configure script so other feature checks can use the availability of TI-RPC to decide what to do.

Since bindresvport_sa is required just for IPv6 support, move that check to the IPv6 feature tests.

---

 Makefile.am         |    3 ++-
 aclocal/libtirpc.m4 |   25 +++++++++++++++++++++++++
 configure.ac        |   28 +++++++++-------------------
 3 files changed, 36 insertions(+), 20 deletions(-)
 create mode 100644 aclocal/libtirpc.m4
Makefile.am +2 -1
index 88ae210..cfe2d37 100644
@@ -40,7 +40,8 @@ EXTRA_DIST = \
 	aclocal/bsdsignals.m4 \
 	aclocal/nfs-utils.m4 \
 	aclocal/kerberos5.m4 \
-	aclocal/tcp-wrappers.m4
+	aclocal/tcp-wrappers.m4 \
+	aclocal/libtirpc.m4
 
 ACLOCAL_AMFLAGS = -I aclocal
 
aclocal/libtirpc.m4 new file +25 -0
new file mode 100644
index 0000000..67c4012
@@ -0,0 +1,25 @@
+dnl Checks for TI-RPC library and headers
+dnl
+AC_DEFUN([AC_LIBTIRPC], [
+
+  dnl if --enable-tirpc was specifed, the following components
+  dnl must be present, and we set up HAVE_ macros for them.
+
+  if test "$enable_tirpc" = yes; then
+
+    dnl look for the library; add to LIBS if found
+    AC_CHECK_LIB([tirpc], [clnt_tli_create], ,
+                 [AC_MSG_ERROR([libtirpc not found.])])
+
+    dnl also must have the headers installed where we expect
+    AC_CHECK_HEADERS([tirpc/netconfig.h], ,
+                     [AC_MSG_ERROR([libtirpc headers not found.])])
+
+    dnl set up HAVE_FOO for various functions
+    AC_CHECK_FUNCS([getnetconfig \
+                    clnt_create clnt_create_timed \
+                    clnt_vc_create clnt_dg_create xdr_rpcb])
+
+  fi
+
+])dnl
configure.ac +9 -19
index 97b084b..becbb7c 100644
@@ -118,6 +118,11 @@ AC_ARG_ENABLE(mount,
 	enable_mount=$enableval,
 	enable_mount=yes)
 	AM_CONDITIONAL(CONFIG_MOUNT, [test "$enable_mount" = "yes"])
+AC_ARG_ENABLE(tirpc,
+	[AC_HELP_STRING([--enable-tirpc],
+			[enable use of TI-RPC @<:@default=no@:>@])],
+	enable_tirpc=$enableval,
+	enable_tirpc=no)
 AC_ARG_ENABLE(ipv6,
 	[AC_HELP_STRING([--enable-ipv6],
                         [enable support for IPv6 @<:@default=no@:>@])],
@@ -131,13 +136,8 @@ AC_ARG_ENABLE(ipv6,
 	AC_SUBST(enable_ipv6)
 	AM_CONDITIONAL(CONFIG_IPV6, [test "$enable_ipv6" = "yes"])
 
-AC_ARG_ENABLE(tirpc,
-	[AC_HELP_STRING([--enable-tirpc],
-                        [enable use of TI-RPC @<:@default=no@:>@])],
-	enable_tirpc=$enableval,
-	enable_tirpc=no)
-	AC_SUBST(enable_tirpc)
-	AM_CONDITIONAL(CONFIG_TIRPC, [test "$enable_tirpc" = "yes"])
+dnl Check for TI-RPC library and headers
+AC_LIBTIRPC
 
 # Check whether user wants TCP wrappers support
 AC_TCP_WRAPPERS
@@ -262,22 +262,12 @@ AC_CHECK_DECL([AI_ADDRCONFIG],
                          [Define this to 1 if AI_ADDRCONFIG macro is defined]), ,
               [ #include <netdb.h> ] )
 
-if test "$enable_tirpc" = yes; then
-  AC_CHECK_LIB(tirpc, clnt_tli_create, ,
-           AC_MSG_ERROR([libtirpc not found.]))
-  AC_CHECK_HEADERS(tirpc/netconfig.h, ,
-                   AC_MSG_ERROR([libtirpc headers not found.]))
-  AC_CHECK_FUNCS([bindresvport_sa getnetconfig \
-                  clnt_create clnt_create_timed \
-                  clnt_vc_create clnt_dg_create xdr_rpcb])
-fi
-
 if test "$enable_ipv6" = yes; then
   if test "$enable_tirpc" = no; then
     AC_MSG_ERROR('--enable-ipv6' requires '--enable-tirpc'.)
   fi
-  AC_CHECK_FUNC(getnameinfo, , ,
-               AC_MSG_ERROR(Function 'getnameinfo' not found.))
+  AC_CHECK_FUNCS([getnameinfo bindresvport_sa], , ,
+                 [AC_MSG_ERROR([Missing functions needed for IPv6.])])
   AC_CHECK_DECL([AI_ADDRCONFIG], ,
                AC_MSG_ERROR([full getaddrinfo(3) implementation needed for IPv6 support]),
                [ #include <netdb.h> ] )
#4 lore raw

PATCH 3/9 nfs-utils: replace function-specific switches with HAVE_LIBTIRPC

In reply to a message not in the archive

Instead of switching in TI-RPC-specific logic with a function-specific switch like HAVE_CLNT_VG_CREATE, let's use the more generic HAVE_LIBTIRPC macro everywhere.

This simplifies ./configure (always a good thing), and makes it more clear in the source code exactly what the extra conditionally compiled code is for.

---

 aclocal/libtirpc.m4      |    5 -----
 support/nfs/getport.c    |   36 +++++++++++++++++----------------
 support/nfs/rpc_socket.c |   50 +++++++++++++++++++++++-----------------------
 3 files changed, 43 insertions(+), 48 deletions(-)
aclocal/libtirpc.m4 +0 -5
index 67c4012..b1f3669 100644
@@ -15,11 +15,6 @@ AC_DEFUN([AC_LIBTIRPC], [
     AC_CHECK_HEADERS([tirpc/netconfig.h], ,
                      [AC_MSG_ERROR([libtirpc headers not found.])])
 
-    dnl set up HAVE_FOO for various functions
-    AC_CHECK_FUNCS([getnetconfig \
-                    clnt_create clnt_create_timed \
-                    clnt_vc_create clnt_dg_create xdr_rpcb])
-
   fi
 
 ])dnl
support/nfs/getport.c +18 -18
index 5da1749..2255b7d 100644
@@ -40,7 +40,7 @@
 #include <rpc/rpc.h>
 #include <rpc/pmap_prot.h>
 
-#ifdef HAVE_TIRPC_NETCONFIG_H
+#ifdef HAVE_LIBTIRPC
 #include <tirpc/netconfig.h>
 #include <tirpc/rpc/rpcb_prot.h>
 #endif
@@ -53,17 +53,17 @@
  * Rpcbind's local socket service does not seem to be working.
  * Disable this logic for now.
  */
-#ifdef HAVE_XDR_RPCB
+#ifdef HAVE_LIBTIRPC
 #undef NFS_GP_LOCAL
-#else	/* HAVE_XDR_RPCB */
+#else	/* !HAVE_LIBTIRPC */
 #undef NFS_GP_LOCAL
-#endif	/* HAVE_XDR_RPCB */
+#endif	/* !HAVE_LIBTIRPC */
 
-#ifdef HAVE_XDR_RPCB
+#ifdef HAVE_LIBTIRPC
 const static rpcvers_t default_rpcb_version = RPCBVERS_4;
-#else
+#else	/* !HAVE_LIBTIRPC */
 const static rpcvers_t default_rpcb_version = PMAPVERS;
-#endif
+#endif	/* !HAVE_LIBTIRPC */
 
 #ifdef HAVE_DECL_AI_ADDRCONFIG
 /*
@@ -242,7 +242,7 @@ static CLIENT *nfs_gp_get_rpcbclient(const struct sockaddr *sap,
  * Returns a '\0'-terminated string if successful; otherwise NULL.
  * rpc_createerr.cf_stat is set to reflect the error.
  */
-#ifdef HAVE_XDR_RPCB
+#ifdef HAVE_LIBTIRPC
 
 static char *nfs_gp_get_netid(const sa_family_t family,
 			      const unsigned short protocol)
@@ -290,7 +290,7 @@ out:
 	return NULL;
 }
 
-#endif	/* HAVE_XDR_RPCB */
+#endif	/* HAVE_LIBTIRPC */
 
 /*
  * Extract a port number from a universal address, and terminate the
@@ -453,7 +453,7 @@ static int nfs_gp_ping(CLIENT *client, struct timeval timeout)
 	return (int)(status == RPC_SUCCESS);
 }
 
-#ifdef HAVE_XDR_RPCB
+#ifdef HAVE_LIBTIRPC
 
 /*
  * Initialize the rpcb argument for a GETADDR request.
@@ -565,7 +565,7 @@ static unsigned short nfs_gp_rpcb_getaddr(CLIENT *client,
 	return port;
 }
 
-#endif	/* HAVE_XDR_RPCB */
+#endif	/* HAVE_LIBTIRPC */
 
 /*
  * Try GETPORT request via rpcbind version 2.
@@ -595,7 +595,7 @@ static unsigned long nfs_gp_pmap_getport(CLIENT *client,
 	return port;
 }
 
-#ifdef HAVE_XDR_RPCB
+#ifdef HAVE_LIBTIRPC
 
 static unsigned short nfs_gp_getport_rpcb(CLIENT *client,
 					  const struct sockaddr *sap,
@@ -617,7 +617,7 @@ static unsigned short nfs_gp_getport_rpcb(CLIENT *client,
 	return port;
 }
 
-#endif	/* HAVE_XDR_RPCB */
+#endif	/* HAVE_LIBTIRPC */
 
 static unsigned long nfs_gp_getport_pmap(CLIENT *client,
 					 const rpcprog_t program,
@@ -652,11 +652,11 @@ static unsigned short nfs_gp_getport(CLIENT *client,
 				     struct timeval timeout)
 {
 	switch (sap->sa_family) {
-#ifdef HAVE_XDR_RPCB
+#ifdef HAVE_LIBTIRPC
 	case AF_INET6:
 		return nfs_gp_getport_rpcb(client, sap, salen, program,
 						version, protocol, timeout);
-#endif	/* HAVE_XDR_RPCB */
+#endif	/* HAVE_LIBTIRPC */
 	case AF_INET:
 		return nfs_gp_getport_pmap(client, program, version,
 							protocol, timeout);
@@ -922,7 +922,7 @@ unsigned short nfs_getlocalport(const rpcprot_t program,
  * address of the same address family.  In this way an RPC server can
  * advertise via rpcbind that it does not support AF_INET6.
  */
-#ifdef HAVE_XDR_RPCB
+#ifdef HAVE_LIBTIRPC
 
 unsigned short nfs_rpcb_getaddr(const struct sockaddr *sap,
 				const socklen_t salen,
@@ -955,7 +955,7 @@ unsigned short nfs_rpcb_getaddr(const struct sockaddr *sap,
 	return port;
 }
 
-#else	/* HAVE_XDR_RPCB */
+#else	/* !HAVE_LIBTIRPC */
 
 unsigned short nfs_rpcb_getaddr(const struct sockaddr *sap,
 				const socklen_t salen,
@@ -971,7 +971,7 @@ unsigned short nfs_rpcb_getaddr(const struct sockaddr *sap,
 	return 0;
 }
 
-#endif	/* HAVE_XDR_RPCB */
+#endif	/* !HAVE_LIBTIRPC */
 
 /**
  * nfs_pmap_getport - query rpcbind via the portmap protocol (rpcbindv2)
support/nfs/rpc_socket.c +25 -25

138 lines not on this page · raw message

#5 lore raw

PATCH 4/9 configure: pull common nfsidmap and event checks into aclocal/

In reply to a message not in the archive

Clean up: Create an aclocal script for the nfsidmap library and headers checks used for both --enable-gss and --enable-nfsv4. Move libevent checks out too.

---

 Makefile.am            |    4 +++-
 aclocal/libevent.m4    |   11 +++++++++++
 aclocal/libnfsidmap.m4 |   17 +++++++++++++++++
 configure.ac           |   20 ++++++++++----------
 4 files changed, 41 insertions(+), 11 deletions(-)
 create mode 100644 aclocal/libevent.m4
 create mode 100644 aclocal/libnfsidmap.m4
Makefile.am +3 -1
index cfe2d37..6541fb7 100644
@@ -41,7 +41,9 @@ EXTRA_DIST = \
 	aclocal/nfs-utils.m4 \
 	aclocal/kerberos5.m4 \
 	aclocal/tcp-wrappers.m4 \
-	aclocal/libtirpc.m4
+	aclocal/libtirpc.m4 \
+	aclocal/libevent.m4 \
+	aclocal/libnfsidmap.m4
 
 ACLOCAL_AMFLAGS = -I aclocal
 
aclocal/libevent.m4 new file +11 -0
new file mode 100644
index 0000000..3c962b3
@@ -0,0 +1,11 @@
+dnl Checks for libevent
+AC_DEFUN([AC_LIBEVENT], [
+
+  dnl Check for libevent, but do not add -levent to LIBS
+  AC_CHECK_LIB([event], [event_dispatch], [libevent=1],
+               [AC_MSG_ERROR([libevent not found.])])
+
+  AC_CHECK_HEADERS([event.h], ,
+                   [AC_MSG_ERROR([libevent headers not found.])])
+
+])dnl
aclocal/libnfsidmap.m4 new file +17 -0
new file mode 100644
index 0000000..cfcde2f
@@ -0,0 +1,17 @@
+dnl Checks for libnfsidmap
+dnl
+AC_DEFUN([AC_LIBNFSIDMAP], [
+
+  dnl Check for libnfsidmap, but do not add -lnfsidmap to LIBS
+  AC_CHECK_LIB([nfsidmap], [nfs4_init_name_mapping], [libnfsidmap=1],
+               [AC_MSG_ERROR([libnfsidmap not found.])])
+
+  AC_CHECK_HEADERS([nfsidmap.h], ,
+                   [AC_MSG_ERROR([libnfsidmap headers not found.])])
+
+  dnl nfs4_set_debug() doesn't appear in all versions of libnfsidmap
+  AC_CHECK_LIB([nfsidmap], [nfs4_set_debug],
+               [AC_DEFINE([HAVE_NFS4_SET_DEBUG], 1,
+                          [Define to 1 if you have the `nfs4_set_debug' function.])])
+
+])dnl
configure.ac +10 -10
index becbb7c..0d5f5a6 100644
@@ -197,10 +197,12 @@ AC_CHECK_FUNC([getservbyname], , ,
 AC_CHECK_LIB([crypt], [crypt], [LIBCRYPT="-lcrypt"])
 
 if test "$enable_nfsv4" = yes; then
-    AC_CHECK_LIB(event, event_dispatch, [libevent=1], AC_MSG_ERROR([libevent needed for nfsv4 support]))
-    AC_CHECK_LIB(nfsidmap, nfs4_init_name_mapping, [libnfsidmap=1], AC_MSG_ERROR([libnfsidmap needed for nfsv4 support]))
-    AC_CHECK_HEADERS(event.h, ,AC_MSG_ERROR([libevent needed for nfsv4 support]))
-    AC_CHECK_HEADERS(nfsidmap.h, ,AC_MSG_ERROR([libnfsidmap needed for nfsv4 support]))
+  dnl check for libevent libraries and headers
+  AC_LIBEVENT
+
+  dnl check for nfsidmap libraries and headers
+  AC_LIBNFSIDMAP
+
     dnl librpcsecgss already has a dependency on libgssapi,
     dnl but we need to make sure we get the right version
     if test "$enable_gss" = yes; then
@@ -239,12 +241,10 @@ AC_SUBST(LIBBLKID)
 
 if test "$enable_gss" = yes; then
   dnl 'gss' also depends on nfsidmap.h - at least for svcgssd_proc.c
-  AC_CHECK_HEADERS(nfsidmap.h, ,AC_MSG_ERROR([libnfsidmap needed for gss support]))
-  AC_CHECK_HEADERS(spkm3.h, ,AC_MSG_WARN([could not locate SPKM3 header; will not have SPKM3 support]))
-  dnl the nfs4_set_debug function doesn't appear in all version of the library
-  AC_CHECK_LIB(nfsidmap, nfs4_set_debug,
-	       AC_DEFINE(HAVE_NFS4_SET_DEBUG,1,
-			 [Whether nfs4_set_debug() is present in libnfsidmap]),)
+  AC_LIBNFSIDMAP
+
+  AC_CHECK_HEADERS([spkm3.h], ,
+                   [AC_MSG_WARN([Could not locate SPKM3 header; will not have SPKM3 support])])
 
   dnl Check for Kerberos V5
   AC_KERBEROS_V5
#6 lore raw

PATCH 5/9 configure: Move rpcsecgss checking into aclocal

In reply to a message not in the archive

Clean up: Introduce two more aclocal scripts for handling rpcsecgss dependency checking.

---

 Makefile.am             |    3 ++-
 aclocal/librpcsecgss.m4 |   16 ++++++++++++++++
 aclocal/rpcsec_vers.m4  |    9 +++++++++
 configure.ac            |   23 ++++++++---------------
 4 files changed, 35 insertions(+), 16 deletions(-)
 create mode 100644 aclocal/librpcsecgss.m4
 create mode 100644 aclocal/rpcsec_vers.m4
Makefile.am +2 -1
index 6541fb7..098446b 100644
@@ -43,7 +43,8 @@ EXTRA_DIST = \
 	aclocal/tcp-wrappers.m4 \
 	aclocal/libtirpc.m4 \
 	aclocal/libevent.m4 \
-	aclocal/libnfsidmap.m4
+	aclocal/libnfsidmap.m4 \
+	aclocal/rpcsec_vers.m4
 
 ACLOCAL_AMFLAGS = -I aclocal
 
aclocal/librpcsecgss.m4 new file +16 -0
new file mode 100644
index 0000000..a81819e
@@ -0,0 +1,16 @@
+dnl Checks for rpcsecgss library and headers
+dnl KRB5LIBS must be set before this function is invoked.
+dnl
+AC_DEFUN([AC_LIBRPCSECGSS], [
+
+  dnl Check for library, but do not add -lrpcsecgss to LIBS
+  AC_CHECK_LIB([rpcsecgss], [authgss_create_default], [librpcsecgss=1],
+               [AC_MSG_ERROR([librpcsecgss not found.])],
+               [-lgssglue -ldl])
+
+  AC_CHECK_LIB([rpcsecgss], [authgss_set_debug_level],
+  	       [AC_DEFINE([HAVE_AUTHGSS_SET_DEBUG_LEVEL], 1,
+               [Define to 1 if you have the `authgss_set_debug_level' function.])],,
+               [-lgssglue -ldl])
+
+])dnl
aclocal/rpcsec_vers.m4 new file +9 -0
new file mode 100644
index 0000000..df7cfb9
@@ -0,0 +1,9 @@
+dnl Checks librpcsec version
+AC_DEFUN([AC_RPCSEC_VERSION], [
+
+  PKG_CHECK_MODULES([RPCSECGSS], [librpcsecgss >= 0.16], ,
+                    [AC_MSG_ERROR([Unable to locate information required to use librpcsecgss.  If you have pkgconfig installed, you might try setting environment variable PKG_CONFIG_PATH to /usr/local/lib/pkgconfig])])
+
+  PKG_CHECK_MODULES([GSSGLUE], [libgssglue >= 0.1])
+
+])dnl
configure.ac +8 -15
index 0d5f5a6..7d25384 100644
@@ -203,17 +203,13 @@ if test "$enable_nfsv4" = yes; then
   dnl check for nfsidmap libraries and headers
   AC_LIBNFSIDMAP
 
-    dnl librpcsecgss already has a dependency on libgssapi,
-    dnl but we need to make sure we get the right version
-    if test "$enable_gss" = yes; then
-     PKG_CHECK_MODULES(RPCSECGSS, librpcsecgss >= 0.16, ,
-      [AC_MSG_ERROR([Unable to locate information required to use librpcsecgss.  If you have pkgconfig installed, you might try setting environment variable PKG_CONFIG_PATH to /usr/local/lib/pkgconfig])
-      ]
-     )
-    PKG_CHECK_MODULES(GSSGLUE, libgssglue >= 0.1)
-    fi
-
+  dnl librpcsecgss already has a dependency on libgssapi,
+  dnl but we need to make sure we get the right version
+  if test "$enable_gss" = yes; then
+    AC_RPCSEC_VERSION
+  fi
 fi
+
 if test "$knfsd_cv_glibc2" = no; then
     AC_CHECK_LIB(bsd, daemon, [LIBBSD="-lbsd"])
 fi
@@ -249,11 +245,8 @@ if test "$enable_gss" = yes; then
   dnl Check for Kerberos V5
   AC_KERBEROS_V5
 
-  dnl This is not done until here because we need to have KRBLIBS set
-  dnl ("librpcsecgss=1" is so that it doesn't get added to LIBS)
-  AC_CHECK_LIB(rpcsecgss, authgss_create_default, [librpcsecgss=1], AC_MSG_ERROR([librpcsecgss needed for nfsv4 support]), -lgssglue -ldl)
-  AC_CHECK_LIB(rpcsecgss, authgss_set_debug_level,
-  	       AC_DEFINE(HAVE_AUTHGSS_SET_DEBUG_LEVEL, 1, [Define this if the rpcsec_gss library has the function authgss_set_debug_level]),, -lgssglue -ldl)
+  dnl Invoked after AC_KERBEROS_V5; AC_LIBRPCSECGSS needs to have KRBLIBS set
+  AC_LIBRPCSECGSS
 
 fi
 
#7 lore raw

PATCH 6/9 nfs-utils: don't need extra libs to do AC_CHECK_LIBS for librpcsecgss

In reply to a message not in the archive

From: Jeff Layton <[email protected]>

The conftest should work without these extra libs being included.

---

 aclocal/librpcsecgss.m4 |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
aclocal/librpcsecgss.m4 +3 -5
index a81819e..5791260 100644
@@ -5,12 +5,10 @@ AC_DEFUN([AC_LIBRPCSECGSS], [
 
   dnl Check for library, but do not add -lrpcsecgss to LIBS
   AC_CHECK_LIB([rpcsecgss], [authgss_create_default], [librpcsecgss=1],
-               [AC_MSG_ERROR([librpcsecgss not found.])],
-               [-lgssglue -ldl])
+               [AC_MSG_ERROR([librpcsecgss not found.])])
 
   AC_CHECK_LIB([rpcsecgss], [authgss_set_debug_level],
-  	       [AC_DEFINE([HAVE_AUTHGSS_SET_DEBUG_LEVEL], 1,
-               [Define to 1 if you have the `authgss_set_debug_level' function.])],,
-               [-lgssglue -ldl])
+               [AC_DEFINE([HAVE_AUTHGSS_SET_DEBUG_LEVEL], 1,
+               [Define to 1 if you have the `authgss_set_debug_level' function.])])
 
 ])dnl
#8 lore raw

PATCH 7/9 configure: move IPv6 feature checks into aclocal/

In reply to a message not in the archive

Clean up: for consistency with other local feature checks, move IPv6 feature checks into aclocal/

---

 Makefile.am     |    3 ++-
 aclocal/ipv6.m4 |   29 +++++++++++++++++++++++++++++
 configure.ac    |   17 ++---------------
 3 files changed, 33 insertions(+), 16 deletions(-)
 create mode 100644 aclocal/ipv6.m4
Makefile.am +2 -1
index 098446b..b3a6e91 100644
@@ -44,7 +44,8 @@ EXTRA_DIST = \
 	aclocal/libtirpc.m4 \
 	aclocal/libevent.m4 \
 	aclocal/libnfsidmap.m4 \
-	aclocal/rpcsec_vers.m4
+	aclocal/rpcsec_vers.m4 \
+	aclocal/ipv6.m4
 
 ACLOCAL_AMFLAGS = -I aclocal
 
aclocal/ipv6.m4 new file +29 -0
new file mode 100644
index 0000000..0564b3e
@@ -0,0 +1,29 @@
+dnl Checks for IPv6 support
+dnl
+AC_DEFUN([AC_IPV6], [
+
+  AC_CHECK_DECL([AI_ADDRCONFIG],
+                [AC_DEFINE([HAVE_DECL_AI_ADDRCONFIG], 1,
+                           [Define this to 1 if AI_ADDRCONFIG macro is defined])], ,
+                [ #include <netdb.h> ])
+
+  if test "$enable_ipv6" = yes; then
+
+    dnl TI-RPC required for IPv6
+    if test "$enable_tirpc" = no; then
+      AC_MSG_ERROR(['--enable-ipv6' requires '--enable-tirpc'.])
+    fi
+
+    dnl IPv6-enabled networking functions required for IPv6
+    AC_CHECK_FUNCS([getnameinfo bindresvport_sa], , ,
+                   [AC_MSG_ERROR([Missing functions needed for IPv6.])])
+
+    dnl Need to detect presence of IPv6 networking at run time via
+    dnl getaddrinfo(3); old versions of glibc do not support ADDRCONFIG
+    AC_CHECK_DECL([AI_ADDRCONFIG], ,
+                  [AC_MSG_ERROR([full getaddrinfo(3) implementation needed for IPv6 support])],
+                  [ #include <netdb.h> ])
+
+  fi
+
+])dnl
configure.ac +2 -15
index 7d25384..e34b7e2 100644
@@ -250,21 +250,8 @@ if test "$enable_gss" = yes; then
 
 fi
 
-AC_CHECK_DECL([AI_ADDRCONFIG],
-              AC_DEFINE([HAVE_DECL_AI_ADDRCONFIG], 1,
-                         [Define this to 1 if AI_ADDRCONFIG macro is defined]), ,
-              [ #include <netdb.h> ] )
-
-if test "$enable_ipv6" = yes; then
-  if test "$enable_tirpc" = no; then
-    AC_MSG_ERROR('--enable-ipv6' requires '--enable-tirpc'.)
-  fi
-  AC_CHECK_FUNCS([getnameinfo bindresvport_sa], , ,
-                 [AC_MSG_ERROR([Missing functions needed for IPv6.])])
-  AC_CHECK_DECL([AI_ADDRCONFIG], ,
-               AC_MSG_ERROR([full getaddrinfo(3) implementation needed for IPv6 support]),
-               [ #include <netdb.h> ] )
-fi
+dnl Check for IPv6 support
+AC_IPV6
 
 dnl *************************************************************
 dnl Check for headers
#9 lore raw

PATCH 8/9 nfs-utils: Include legacy or TI-RPC headers, not both

In reply to a message not in the archive

Data type incompatibilities between the legacy RPC headers and the TI-RPC headers mean we can't use libtirpc with code that was compiled against the legacy RPC headers. The definition of rpcprog_t for example is "unsigned long" in the legacy library, but it's "uint32_t" for TI-RPC. On 32-bit systems, these types happen to have the same width, but on 64-bit systems they don't, making more complex data structures that use these types in fields ABI incompatible.

Adopt a new strategy to deal with this issue. When --enable-tirpc is set, append "-I/usr/include/tirpc" to the compilation steps. This should cause the compiler to grab the tirpc/ headers instead of the legacy headers. Now, for TI-RPC builds, the TI-RPC legacy functions and the TI-RPC headers will be used. On legacy systems, the legacy headers and legacy glibc RPC implementation will be used.

A new ./configure option is introduced to allow system integrators to use TI-RPC headers in some other location than /usr/include/tirpc. /usr/include/tirpc remains the default setting for this new option.

The gssd implementation presents a few challenges, but it turns out the gssglue library is similar to the auth_gss pieces of TI-RPC. To avoid similar header incompatibility issues, gssd now uses libtirpc instead of libgssglue if --enable-tirpc is specified. There may be other issues to tackle with gssd, but for now, we just make sure it builds with --enable-tirpc.

Note also: svc_getcaller() is a macro in both cases that points to a sockaddr field in the svc_req structure. The legacy version points to a sockaddr_in type field, but the TI-RPC version points to a sockaddr_in6 type field.

rpc.mountd unconditionally casts the result of svc_getcaller() to a sockaddr_in *. This should be OK for TI-RPC as well, since rpc.mountd still uses legacy RPC calls (provided by glibc, or emulated by TI-RPC) to set up its listeners, and therefore rpc.mountd callers will always be from AF_INET addresses for now.

---

 aclocal/librpcsecgss.m4  |   17 +++++++++++------
 aclocal/libtirpc.m4      |   10 +++++++++-
 aclocal/rpcsec_vers.m4   |    7 +++++--
 support/nfs/getport.c    |    4 ++--
 support/nfs/rpc_socket.c |   45 ++-------------------------------------------
 utils/gssd/gssd_proc.c   |    3 ++-
 utils/gssd/krb5_util.c   |    1 -
 utils/gssd/krb5_util.h   |    6 ++++++
 utils/mountd/svc_run.c   |    4 ++++
 9 files changed, 41 insertions(+), 56 deletions(-)
aclocal/librpcsecgss.m4 +11 -6
index 5791260..d1dd25e 100644
@@ -3,12 +3,17 @@ dnl KRB5LIBS must be set before this function is invoked.
 dnl
 AC_DEFUN([AC_LIBRPCSECGSS], [
 
-  dnl Check for library, but do not add -lrpcsecgss to LIBS
-  AC_CHECK_LIB([rpcsecgss], [authgss_create_default], [librpcsecgss=1],
-               [AC_MSG_ERROR([librpcsecgss not found.])])
+  dnl libtirpc provides an rpcsecgss API
+  if test "$enable_tirpc" = no; then
 
-  AC_CHECK_LIB([rpcsecgss], [authgss_set_debug_level],
-               [AC_DEFINE([HAVE_AUTHGSS_SET_DEBUG_LEVEL], 1,
-               [Define to 1 if you have the `authgss_set_debug_level' function.])])
+    dnl Check for library, but do not add -lrpcsecgss to LIBS
+    AC_CHECK_LIB([rpcsecgss], [authgss_create_default], [librpcsecgss=1],
+                 [AC_MSG_ERROR([librpcsecgss not found.])])
+
+    AC_CHECK_LIB([rpcsecgss], [authgss_set_debug_level],
+                 [AC_DEFINE([HAVE_AUTHGSS_SET_DEBUG_LEVEL], 1,
+                 [Define to 1 if you have the `authgss_set_debug_level' function.])])
+
+  fi
 
 ])dnl
aclocal/libtirpc.m4 +9 -1
index b1f3669..af4c7d3 100644
@@ -2,6 +2,12 @@ dnl Checks for TI-RPC library and headers
 dnl
 AC_DEFUN([AC_LIBTIRPC], [
 
+  AC_ARG_WITH([tirpcinclude],
+              [AC_HELP_STRING([--with-tirpcinclude=DIR],
+                              [use TI-RPC headers in DIR])],
+              [tirpc_header_dir=$withval],
+              [tirpc_header_dir=/usr/include/tirpc])
+
   dnl if --enable-tirpc was specifed, the following components
   dnl must be present, and we set up HAVE_ macros for them.
 
@@ -12,8 +18,10 @@ AC_DEFUN([AC_LIBTIRPC], [
                  [AC_MSG_ERROR([libtirpc not found.])])
 
     dnl also must have the headers installed where we expect
-    AC_CHECK_HEADERS([tirpc/netconfig.h], ,
+    dnl look for headers; add -I compiler option if found
+    AC_CHECK_HEADERS([${tirpc_header_dir}/netconfig.h], ,
                      [AC_MSG_ERROR([libtirpc headers not found.])])
+    AC_SUBST([AM_CPPFLAGS], ["-I${tirpc_header_dir}"])
 
   fi
 
aclocal/rpcsec_vers.m4 +5 -2
index df7cfb9..5d13db3 100644
@@ -1,8 +1,11 @@
 dnl Checks librpcsec version
 AC_DEFUN([AC_RPCSEC_VERSION], [
 
-  PKG_CHECK_MODULES([RPCSECGSS], [librpcsecgss >= 0.16], ,
-                    [AC_MSG_ERROR([Unable to locate information required to use librpcsecgss.  If you have pkgconfig installed, you might try setting environment variable PKG_CONFIG_PATH to /usr/local/lib/pkgconfig])])
+  dnl TI-RPC replaces librpcsecgss
+  if test "$enable_tirpc" = no; then
+    PKG_CHECK_MODULES([RPCSECGSS], [librpcsecgss >= 0.16], ,
+                      [AC_MSG_ERROR([Unable to locate information required to use librpcsecgss.  If you have pkgconfig installed, you might try setting environment variable PKG_CONFIG_PATH to /usr/local/lib/pkgconfig])])
+  fi
 
   PKG_CHECK_MODULES([GSSGLUE], [libgssglue >= 0.1])
 
support/nfs/getport.c +2 -2
index 2255b7d..734d21a 100644
@@ -41,8 +41,8 @@
 #include <rpc/pmap_prot.h>
 
 #ifdef HAVE_LIBTIRPC
-#include <tirpc/netconfig.h>
-#include <tirpc/rpc/rpcb_prot.h>
+#include <netconfig.h>
+#include <rpc/rpcb_prot.h>
 #endif
 
 #include "nfsrpc.h"
support/nfs/rpc_socket.c +2 -43

51 lines not on this page · raw message

utils/gssd/gssd_proc.c +2 -1
index d0d3f7f..295c37d 100644
@@ -70,7 +70,6 @@
 #include "gssd.h"
 #include "err_util.h"
 #include "gss_util.h"
-#include "gss_oids.h"
 #include "krb5_util.h"
 #include "context.h"
 
@@ -778,8 +777,10 @@ handle_krb5_upcall(struct clnt_info *clp)
 out:
 	if (token.value)
 		free(token.value);
+#ifndef HAVE_LIBTIRPC
 	if (pd.pd_ctx_hndl.length != 0)
 		authgss_free_private_data(&pd);
+#endif
 	if (auth)
 		AUTH_DESTROY(auth);
 	if (rpc_clnt)
utils/gssd/krb5_util.c +0 -1
index 8923b3b..e3c6f5e 100644
@@ -124,7 +124,6 @@
 #include "gssd.h"
 #include "err_util.h"
 #include "gss_util.h"
-#include "gss_oids.h"
 #include "krb5_util.h"
 
 /* Global list of principals/cache file names for machine credentials */
utils/gssd/krb5_util.h +6 -0
index 4b2da6b..7d808f5 100644
@@ -3,6 +3,12 @@
 
 #include <krb5.h>
 
+#ifdef HAVE_LIBTIRPC
+#include <rpc/auth_gss.h>
+#else
+#include "gss_oids.h"
+#endif
+
 /*
  * List of principals from our keytab that we
  * will try to use to obtain credentials
utils/mountd/svc_run.c +4 -0
index 422e839..5ba5af6 100644
@@ -54,6 +54,10 @@
 #include <errno.h>
 #include <time.h>
 
+#ifdef HAVE_LIBTIRPC
+#include <rpc/rpc_com.h>
+#endif
+
 void cache_set_fds(fd_set *fdset);
 int cache_process_req(fd_set *readfds);
 
#10 lore raw

PATCH 9/9 nfs-utils: clean up handling of libgssglue in gssd Makefile

In reply to a message not in the archive

From: Jeff Layton <[email protected]>

Make the pkgconfig check for libgssglue conditional on tirpc being enabled. When it's disabled, the pkgconfig check for librpcsecgss will pull in the gssglue lib and include dir automatically.

Also, make sure we include GSSGLUE_CFLAGS and the GSSGLUE_LIBS to the appropriate places in utils/gssd/Makefile.am so that we pick up the gssglue libs when tirpc is enabled.

---

 aclocal/rpcsec_vers.m4 |    6 +++---
 utils/gssd/Makefile.am |   10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)
aclocal/rpcsec_vers.m4 +3 -3
index 5d13db3..e59c0aa 100644
@@ -1,12 +1,12 @@
 dnl Checks librpcsec version
 AC_DEFUN([AC_RPCSEC_VERSION], [
 
-  dnl TI-RPC replaces librpcsecgss
+  dnl TI-RPC replaces librpcsecgss, but we still need libgssglue
   if test "$enable_tirpc" = no; then
     PKG_CHECK_MODULES([RPCSECGSS], [librpcsecgss >= 0.16], ,
                       [AC_MSG_ERROR([Unable to locate information required to use librpcsecgss.  If you have pkgconfig installed, you might try setting environment variable PKG_CONFIG_PATH to /usr/local/lib/pkgconfig])])
+  else
+    PKG_CHECK_MODULES([GSSGLUE], [libgssglue >= 0.1])
   fi
 
-  PKG_CHECK_MODULES([GSSGLUE], [libgssglue >= 0.1])
-
 ])dnl
utils/gssd/Makefile.am +5 -5
index e42b339..95a2bd0 100644
@@ -39,11 +39,11 @@ gssd_SOURCES = \
 	write_bytes.h
 
 gssd_LDADD =	../../support/nfs/libnfs.a \
-		$(RPCSECGSS_LIBS) $(KRBLIBS)
+		$(RPCSECGSS_LIBS) $(GSSGLUE_LIBS) $(KRBLIBS)
 gssd_LDFLAGS = $(KRBLDFLAGS)
 
 gssd_CFLAGS = $(AM_CFLAGS) $(CFLAGS) \
-	      $(RPCSECGSS_CFLAGS) $(KRBCFLAGS)
+	      $(RPCSECGSS_CFLAGS) $(GSSGLUE_CFLAGS) $(KRBCFLAGS)
 
 svcgssd_SOURCES = \
 	$(COMMON_SRCS) \
@@ -56,18 +56,18 @@ svcgssd_SOURCES = \
 
 svcgssd_LDADD = \
 	../../support/nfs/libnfs.a \
-	$(RPCSECGSS_LIBS) -lnfsidmap \
+	$(RPCSECGSS_LIBS) $(GSSGLUE_LIBS) -lnfsidmap \
 	$(KRBLIBS)
 
 svcgssd_LDFLAGS = $(KRBLDFLAGS)
 
 svcgssd_CFLAGS = $(AM_CFLAGS) $(CFLAGS) \
-		 $(RPCSECGSS_CFLAGS) $(KRBCFLAGS)
+		 $(RPCSECGSS_CFLAGS) $(GSSGLUE_CFLAGS) $(KRBCFLAGS)
 
 gss_clnt_send_err_SOURCES = gss_clnt_send_err.c
 
 gss_clnt_send_err_CFLAGS = $(AM_CFLAGS) $(CFLAGS) \
-		 $(RPCSECGSS_CFLAGS) $(KRBCFLAGS)
+		 $(RPCSECGSS_CFLAGS) $(GSSGLUE_CFLAGS) $(KRBCFLAGS)
 
 MAINTAINERCLEANFILES = Makefile.in
 
#11 lore raw
In reply to a message not in the archive
Quoted 25 lines · Chuck Lever

Steve-

Now that the clean up is finished, here are the patches that actually fix the type width mismatch problem between glibc headers and the TI-RPC run-time.

This patch set implements a full switch between TI-RPC run-time and headers and legacy glibc RPC run-time and headers via --enable-tirpc.

In addition there are a number of configure.ac clean ups.

These are the final patches needed to support TI-RPC and IPv6 properly in mount.nfs, umount.nfs, and showmount.

---

Chuck Lever (7):
nfs-utils: Include legacy or TI-RPC headers, not both
configure: move IPv6 feature checks into aclocal/
configure: Move rpcsecgss checking into aclocal
configure: pull common nfsidmap and event checks into aclocal/
nfs-utils: replace function-specific switches with HAVE_LIBTIRPC
configure: move TI-RPC checks into aclocal/
configure: add defensive quoting in some function checks

Quoted 4 lines

Jeff Layton (2):
nfs-utils: clean up handling of libgssglue in gssd Makefile
nfs-utils: don't need extra libs to do AC_CHECK_LIBS for librpcsecgss

committed...

steved.