Linux NFS development
 help / color / mirror / Atom feed
* [PATCH 0/6] Further nfs-utils clean ups
@ 2009-03-05  0:02 Chuck Lever
       [not found] ` <20090304234711.28749.7018.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Chuck Lever @ 2009-03-05  0:02 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

Hi Steve-

Here are six more patches that clean up various issues to prepare for
the widespread use of TI-RPC in nfs-utils.

We discovered a type width mismatch issue between our legacy RPC
headers and the TI-RPC run-time that will be addressed in a subsequent
patch series by using TI-RPC to build all of nfs-utils.  This issue
should be addressed before the next release of nfs-utils is published.

The idea will be to build nfs-utils with either glibc's legacy RPC
implementation and the legacy RPC headers (as it is today in 1.1.3),
or with libtirpc and TI-RPC's headers, based on the setting of
--enable-tirpc (which defaults to --disable-tirpc).

This further insulates ongoing IPv6 work from folks who need to use
today's up-to-date version of nfs-utils, while easily allowing us to
test a version built with complete TI-RPC integration.

---

Chuck Lever (6):
      gssd: include gssapi/gssapi.h before write_bytes.h
      gssd: Use same style for including config.h that rest of nfs-utils uses
      mount.nfs: squelch compiler warning for TI-RPC builds
      nfs-utils: Provide type-checked version of svc_getcaller()
      configure: Remove CPPFLAGS substitution
      nfs-utils: Replace getservbyname(3)


 configure.ac                   |    1 
 support/include/nfsrpc.h       |    6 --
 support/include/rpcmisc.h      |    9 +++
 support/nfs/getport.c          |  105 ++++++++++++++++++++++++----------------
 support/nfs/rpc_socket.c       |   46 ------------------
 utils/gssd/context.c           |    5 ++
 utils/gssd/context_heimdal.c   |    4 +-
 utils/gssd/context_lucid.c     |   10 ++--
 utils/gssd/context_mit.c       |    4 +-
 utils/gssd/context_spkm3.c     |    5 ++
 utils/gssd/err_util.c          |    4 ++
 utils/gssd/gss_clnt_send_err.c |    4 ++
 utils/gssd/gss_oids.c          |    4 ++
 utils/gssd/gss_util.c          |    6 ++
 utils/gssd/gssd.c              |    4 +-
 utils/gssd/gssd_main_loop.c    |    5 ++
 utils/gssd/gssd_proc.c         |    6 ++
 utils/gssd/krb5_util.c         |    6 ++
 utils/gssd/svcgssd.c           |    4 +-
 utils/gssd/svcgssd_main_loop.c |    4 ++
 utils/gssd/svcgssd_mech2file.c |    4 +-
 utils/gssd/svcgssd_proc.c      |    4 ++
 utils/mount/network.c          |    5 +-
 utils/mountd/mount_dispatch.c  |    7 ++-
 utils/mountd/mountd.c          |   20 +++-----
 utils/statd/callback.c         |    9 ++-
 utils/statd/monitor.c          |    5 ++
 utils/statd/simu.c             |   12 ++++-
 utils/statd/statd.c            |    6 ++
 29 files changed, 179 insertions(+), 135 deletions(-)

-- 
Chuck Lever

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/6] nfs-utils: Replace getservbyname(3)
       [not found] ` <20090304234711.28749.7018.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
@ 2009-03-05  0:02   ` Chuck Lever
  2009-03-05  0:02   ` [PATCH 2/6] configure: Remove CPPFLAGS substitution Chuck Lever
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Chuck Lever @ 2009-03-05  0:02 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

The getservbyname(3) function is not re-entrant, and anyway, the man page
says it is obsolete.  Replace it with a call to getaddrinfo(3).

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 support/include/nfsrpc.h |    6 ---
 support/nfs/getport.c    |  105 ++++++++++++++++++++++++++++------------------
 support/nfs/rpc_socket.c |   46 --------------------
 3 files changed, 63 insertions(+), 94 deletions(-)

diff --git a/support/include/nfsrpc.h b/support/include/nfsrpc.h
index 1529d44..097debb 100644
--- a/support/include/nfsrpc.h
+++ b/support/include/nfsrpc.h
@@ -54,12 +54,6 @@
 extern rpcprog_t	nfs_getrpcbyname(const rpcprog_t, const char *table[]);
 
 /*
- * Look up a port number in /etc/services for an RPC program
- */
-extern unsigned short	nfs_getportbynumber(const rpcprog_t program,
-				const unsigned short transport);
-
-/*
  * Acquire an RPC CLIENT *
  */
 extern CLIENT		*nfs_get_rpcclient(const struct sockaddr *,
diff --git a/support/nfs/getport.c b/support/nfs/getport.c
index 023c79a..5da1749 100644
--- a/support/nfs/getport.c
+++ b/support/nfs/getport.c
@@ -65,14 +65,6 @@ const static rpcvers_t default_rpcb_version = RPCBVERS_4;
 const static rpcvers_t default_rpcb_version = PMAPVERS;
 #endif
 
-static const char *nfs_gp_rpcb_pgmtbl[] = {
-	"rpcbind",
-	"portmap",
-	"portmapper",
-	"sunrpc",
-	NULL,
-};
-
 #ifdef HAVE_DECL_AI_ADDRCONFIG
 /*
  * getaddrinfo(3) generates a usable loopback address based on how the
@@ -128,39 +120,6 @@ static int nfs_gp_loopback_address(struct sockaddr *sap, socklen_t *salen)
 #endif
 
 /*
- * Discover the port number that should be used to contact an
- * rpcbind service.  This will detect if the port has a local
- * value that may have been set in /etc/services.
- *
- * NB: s_port is already in network byte order.
- *
- * Returns network byte-order port number of rpcbind service
- * on this system.
- */
-static in_port_t nfs_gp_get_rpcb_port(const unsigned short protocol)
-{
-	struct protoent *proto;
-
-	proto = getprotobynumber((int)protocol);
-	if (proto != NULL) {
-		struct servent *entry;
-
-		entry = getservbyname("rpcbind", proto->p_name);
-		if (entry != NULL)
-			return (in_port_t)entry->s_port;
-
-		entry = getservbyname("portmapper", proto->p_name);
-		if (entry != NULL)
-			return (in_port_t)entry->s_port;
-
-		entry = getservbyname("sunrpc", proto->p_name);
-		if (entry != NULL)
-			return (in_port_t)entry->s_port;
-	}
-	return htons((uint16_t)PMAPPORT);
-}
-
-/*
  * Plant port number in @sap.  @port is already in network byte order.
  */
 static void nfs_gp_set_port(struct sockaddr *sap, const in_port_t port)
@@ -179,6 +138,61 @@ static void nfs_gp_set_port(struct sockaddr *sap, const in_port_t port)
 }
 
 /*
+ * Look up a network service in /etc/services and return the
+ * network-order port number of that service.
+ */
+static in_port_t nfs_gp_getservbyname(const char *service,
+				      const unsigned short protocol)
+{
+	const struct addrinfo gai_hint = {
+		.ai_family	= AF_INET,
+		.ai_protocol	= protocol,
+		.ai_flags	= AI_PASSIVE,
+	};
+	struct addrinfo *gai_results;
+	const struct sockaddr_in *sin;
+	in_port_t port;
+
+	if (getaddrinfo(NULL, service, &gai_hint, &gai_results) != 0)
+		return 0;
+
+	sin = (const struct sockaddr_in *)gai_results->ai_addr;
+	port = sin->sin_port;
+	
+	freeaddrinfo(gai_results);
+	return port;
+}
+
+/*
+ * Discover the port number that should be used to contact an
+ * rpcbind service.  This will detect if the port has a local
+ * value that may have been set in /etc/services.
+ *
+ * Returns network byte-order port number of rpcbind service
+ * on this system.
+ */
+static in_port_t nfs_gp_get_rpcb_port(const unsigned short protocol)
+{
+	static const char *rpcb_netnametbl[] = {
+		"rpcbind",
+		"portmapper",
+		"sunrpc",
+		NULL,
+	};
+	unsigned int i;
+
+	for (i = 0; rpcb_netnametbl[i] != NULL; i++) {
+		in_port_t port;
+
+		port = nfs_gp_getservbyname(rpcb_netnametbl[i], protocol);
+		if (port != 0)
+			return port;
+	}
+
+	return (in_port_t)htons((uint16_t)PMAPPORT);
+}
+
+/*
  * Set up an RPC client for communicating with an rpcbind daemon at
  * @sap over @transport with protocol version @version.
  *
@@ -193,9 +207,16 @@ static CLIENT *nfs_gp_get_rpcbclient(const struct sockaddr *sap,
 				     const rpcvers_t version,
 				     struct timeval *timeout)
 {
+	static const char *rpcb_pgmtbl[] = {
+		"rpcbind",
+		"portmap",
+		"portmapper",
+		"sunrpc",
+		NULL,
+	};
 	struct sockaddr_storage address;
 	struct sockaddr *saddr = (struct sockaddr *)&address;
-	rpcprog_t rpcb_prog = nfs_getrpcbyname(RPCBPROG, nfs_gp_rpcb_pgmtbl);
+	rpcprog_t rpcb_prog = nfs_getrpcbyname(RPCBPROG, rpcb_pgmtbl);
 
 	memcpy(saddr, sap, (size_t)salen);
 	nfs_gp_set_port(saddr, nfs_gp_get_rpcb_port(transport));
diff --git a/support/nfs/rpc_socket.c b/support/nfs/rpc_socket.c
index 82ba818..b7420d1 100644
--- a/support/nfs/rpc_socket.c
+++ b/support/nfs/rpc_socket.c
@@ -480,49 +480,3 @@ rpcprog_t nfs_getrpcbyname(const rpcprog_t program, const char *table[])
 
 	return program;
 }
-
-static unsigned short nfs_tryportbyname(const char *name,
-					const char *protocol)
-{
-	struct servent *servp = NULL;
-
-	servp = getservbyname(name, protocol);
-	if (servp != NULL)
-		return (unsigned short)ntohl((uint32_t)servp->s_port);
-	return 0;
-}
-
-/**
- * nfs_getportbynumber - convert an RPC program number to a port
- * @program: RPC program number to look up
- * @transport: IPPROTO_ value of transport protocol to use
- *
- * Returns a non-zero port number, in host byte order, on success;
- * otherwise zero if some problem occurred.
- */
-unsigned short nfs_getportbynumber(const rpcprog_t program,
-				   const unsigned short transport)
-{
-	char *protocol = (transport == IPPROTO_TCP) ? "tcp" : "udp";
-	struct rpcent *rpcp;
-	unsigned short port = 0;
-
-	rpcp = getrpcbynumber((int)program);
-	if (rpcp == NULL)
-		return port;
-
-	port = nfs_tryportbyname(rpcp->r_name, protocol);
-	if (port != 0)
-		return port;
-
-	if (rpcp->r_aliases) {
-		int i;
-		for (i = 0; rpcp->r_aliases[i] != NULL; i++) {
-			port = nfs_tryportbyname(rpcp->r_aliases[i], protocol);
-			if (port != 0)
-				break;
-		}
-	}
-
-	return port;
-}


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/6] configure: Remove CPPFLAGS substitution
       [not found] ` <20090304234711.28749.7018.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
  2009-03-05  0:02   ` [PATCH 1/6] nfs-utils: Replace getservbyname(3) Chuck Lever
@ 2009-03-05  0:02   ` Chuck Lever
  2009-03-05  0:02   ` [PATCH 3/6] nfs-utils: Provide type-checked version of svc_getcaller() Chuck Lever
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Chuck Lever @ 2009-03-05  0:02 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

At least on my systems, the AM_CPPFLAGS substitution at the end of
configure.ac is not needed.  It adds an extra copy of
"-I../../support/includes" to each compile step.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 configure.ac |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 4fd111f..b2c8190 100644
--- a/configure.ac
+++ b/configure.ac
@@ -382,7 +382,6 @@ esac
 
 my_am_cflags="-Wall -Wstrict-prototypes $ARCHFLAGS -pipe"
 
-AC_SUBST([AM_CPPFLAGS], ["-I\${top_srcdir}/support/include"])
 AC_SUBST([AM_CFLAGS], ["$my_am_cflags"])
 
 # Make sure that $ACLOCAL_FLAGS are used during a rebuild


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/6] nfs-utils: Provide type-checked version of svc_getcaller()
       [not found] ` <20090304234711.28749.7018.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
  2009-03-05  0:02   ` [PATCH 1/6] nfs-utils: Replace getservbyname(3) Chuck Lever
  2009-03-05  0:02   ` [PATCH 2/6] configure: Remove CPPFLAGS substitution Chuck Lever
@ 2009-03-05  0:02   ` Chuck Lever
  2009-03-05  0:02   ` [PATCH 4/6] mount.nfs: squelch compiler warning for TI-RPC builds Chuck Lever
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Chuck Lever @ 2009-03-05  0:02 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

TI-RPC's version of the svc_getcaller() macro points to a sockaddr_in6,
not a sockaddr_in, though for AF_INET callers, an AF_INET address
resides there.  To squelch compiler warnings when the TI-RPC version of
the svc_req structure is used, add inline helpers with appropriate
type casting.

Note that tcp_wrappers support only AF_INET addresses for now.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 support/include/rpcmisc.h     |    9 +++++++++
 utils/mountd/mount_dispatch.c |    7 ++++---
 utils/mountd/mountd.c         |   20 +++++++-------------
 utils/statd/callback.c        |    9 ++++++---
 utils/statd/monitor.c         |    5 ++++-
 utils/statd/simu.c            |   12 ++++++++++--
 utils/statd/statd.c           |    6 ++++--
 7 files changed, 44 insertions(+), 24 deletions(-)

diff --git a/support/include/rpcmisc.h b/support/include/rpcmisc.h
index 5814a63..f551a85 100644
--- a/support/include/rpcmisc.h
+++ b/support/include/rpcmisc.h
@@ -53,5 +53,14 @@ extern int	_rpcpmstart;
 extern int	_rpcfdtype;
 extern int	_rpcsvcdirty;
 
+static inline struct sockaddr_in *nfs_getrpccaller_in(SVCXPRT *xprt)
+{
+	return (struct sockaddr_in *)svc_getcaller(xprt);
+}
+
+static inline struct sockaddr *nfs_getrpccaller(SVCXPRT *xprt)
+{
+	return (struct sockaddr *)svc_getcaller(xprt);
+}
 
 #endif /* RPCMISC_H */
diff --git a/utils/mountd/mount_dispatch.c b/utils/mountd/mount_dispatch.c
index f00c0c5..199fcec 100644
--- a/utils/mountd/mount_dispatch.c
+++ b/utils/mountd/mount_dispatch.c
@@ -70,11 +70,12 @@ mount_dispatch(struct svc_req *rqstp, SVCXPRT *transp)
 {
 	union mountd_arguments 	argument;
 	union mountd_results	result;
-
 #ifdef HAVE_TCP_WRAPPER
+	struct sockaddr_in *sin = nfs_getrpccaller_in(transp);
+
 	/* remote host authorization check */
-	if (!check_default("mountd", svc_getcaller(transp),
-			   rqstp->rq_proc, MOUNTPROG)) {
+	if (sin->sin_family == AF_INET &&
+	    !check_default("mountd", sin, rqstp->rq_proc, MOUNTPROG)) {
 		svcerr_auth (transp, AUTH_FAILED);
 		return;
 	}
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
index deeaa07..8084359 100644
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -202,8 +202,7 @@ mount_mnt_1_svc(struct svc_req *rqstp, dirpath *path, fhstatus *res)
 bool_t
 mount_dump_1_svc(struct svc_req *rqstp, void *argp, mountlist *res)
 {
-	struct sockaddr_in *addr =
-		(struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
+	struct sockaddr_in *addr = nfs_getrpccaller_in(rqstp->rq_xprt);
 
 	xlog(D_CALL, "dump request from %s.", inet_ntoa(addr->sin_addr));
 	*res = mountlist_list();
@@ -214,8 +213,7 @@ mount_dump_1_svc(struct svc_req *rqstp, void *argp, mountlist *res)
 bool_t
 mount_umnt_1_svc(struct svc_req *rqstp, dirpath *argp, void *resp)
 {
-	struct sockaddr_in *sin
-		= (struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
+	struct sockaddr_in *sin = nfs_getrpccaller_in(rqstp->rq_xprt);
 	nfs_export	*exp;
 	char		*p = *argp;
 	char		rpath[MAXPATHLEN+1];
@@ -242,15 +240,14 @@ mount_umntall_1_svc(struct svc_req *rqstp, void *argp, void *resp)
 	/* Reload /etc/xtab if necessary */
 	auth_reload();
 
-	mountlist_del_all((struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt));
+	mountlist_del_all(nfs_getrpccaller_in(rqstp->rq_xprt));
 	return 1;
 }
 
 bool_t
 mount_export_1_svc(struct svc_req *rqstp, void *argp, exports *resp)
 {
-	struct sockaddr_in *addr =
-		(struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
+	struct sockaddr_in *addr = nfs_getrpccaller_in(rqstp->rq_xprt);
 
 	xlog(D_CALL, "export request from %s.", inet_ntoa(addr->sin_addr));
 	*resp = get_exportlist();
@@ -261,8 +258,7 @@ mount_export_1_svc(struct svc_req *rqstp, void *argp, exports *resp)
 bool_t
 mount_exportall_1_svc(struct svc_req *rqstp, void *argp, exports *resp)
 {
-	struct sockaddr_in *addr =
-		(struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
+	struct sockaddr_in *addr = nfs_getrpccaller_in(rqstp->rq_xprt);
 
 	xlog(D_CALL, "exportall request from %s.", inet_ntoa(addr->sin_addr));
 	*resp = get_exportlist();
@@ -284,8 +280,7 @@ mount_exportall_1_svc(struct svc_req *rqstp, void *argp, exports *resp)
 bool_t
 mount_pathconf_2_svc(struct svc_req *rqstp, dirpath *path, ppathcnf *res)
 {
-	struct sockaddr_in *sin
-		= (struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
+	struct sockaddr_in *sin = nfs_getrpccaller_in(rqstp->rq_xprt);
 	struct stat	stb;
 	nfs_export	*exp;
 	char		rpath[MAXPATHLEN+1];
@@ -383,8 +378,7 @@ static struct nfs_fh_len *
 get_rootfh(struct svc_req *rqstp, dirpath *path, nfs_export **expret,
 		mountstat3 *error, int v3)
 {
-	struct sockaddr_in *sin =
-		(struct sockaddr_in *) svc_getcaller(rqstp->rq_xprt);
+	struct sockaddr_in *sin = nfs_getrpccaller_in(rqstp->rq_xprt);
 	struct stat	stb, estb;
 	nfs_export	*exp;
 	struct nfs_fh_len *fh;
diff --git a/utils/statd/callback.c b/utils/statd/callback.c
index 505fdb3..8885238 100644
--- a/utils/statd/callback.c
+++ b/utils/statd/callback.c
@@ -9,10 +9,13 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+
+#include <arpa/inet.h>
+
+#include "rpcmisc.h"
 #include "misc.h"
 #include "statd.h"
 #include "notlist.h"
-#include <arpa/inet.h>
 
 /* Callback notify list. */
 /* notify_list *cbnl = NULL; ... never used */
@@ -29,8 +32,8 @@ sm_notify_1_svc(struct stat_chge *argp, struct svc_req *rqstp)
 {
 	notify_list    *lp, *call;
 	static char    *result = NULL;
-	char *ip_addr = xstrdup(inet_ntoa(svc_getcaller(rqstp->rq_xprt)
-					  ->sin_addr));
+	struct sockaddr_in *sin = nfs_getrpccaller_in(rqstp->rq_xprt);
+	char *ip_addr = xstrdup(inet_ntoa(sin->sin_addr));
 
 	dprintf(N_DEBUG, "Received SM_NOTIFY from %s, state: %d",
 				argp->mon_name, argp->state);
diff --git a/utils/statd/monitor.c b/utils/statd/monitor.c
index 24c2531..169cd78 100644
--- a/utils/statd/monitor.c
+++ b/utils/statd/monitor.c
@@ -20,6 +20,8 @@
 #include <errno.h>
 #include <arpa/inet.h>
 #include <dirent.h>
+
+#include "rpcmisc.h"
 #include "misc.h"
 #include "statd.h"
 #include "notlist.h"
@@ -36,9 +38,10 @@ notify_list *		rtnl = NULL;	/* Run-time notify list. */
 static int
 caller_is_localhost(struct svc_req *rqstp)
 {
+	struct sockaddr_in *sin = nfs_getrpccaller_in(rqstp->rq_xprt);
 	struct in_addr	caller;
 
-	caller = svc_getcaller(rqstp->rq_xprt)->sin_addr;
+	caller = sin->sin_addr;
 	if (caller.s_addr != htonl(INADDR_LOOPBACK)) {
 		note(N_WARNING,
 			"Call to statd from non-local host %s",
diff --git a/utils/statd/simu.c b/utils/statd/simu.c
index 25e8bad..a7ecb85 100644
--- a/utils/statd/simu.c
+++ b/utils/statd/simu.c
@@ -7,8 +7,10 @@
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
+
 #include <arpa/inet.h>
 
+#include "rpcmisc.h"
 #include "statd.h"
 #include "notlist.h"
 
@@ -21,17 +23,23 @@ extern void my_svc_exit (void);
 void *
 sm_simu_crash_1_svc (void *argp, struct svc_req *rqstp)
 {
+  struct sockaddr_in *sin = nfs_getrpccaller_in(rqstp->rq_xprt);
   static char *result = NULL;
   struct in_addr caller;
 
-  caller = svc_getcaller(rqstp->rq_xprt)->sin_addr;
+  if (sin->sin_family != AF_INET) {
+    note(N_WARNING, "Call to statd from non-AF_INET address");
+    goto failure;
+  }
+
+  caller = sin->sin_addr;
   if (caller.s_addr != htonl(INADDR_LOOPBACK)) {
     note(N_WARNING, "Call to statd from non-local host %s",
       inet_ntoa(caller));
     goto failure;
   }
 
-  if (ntohs(svc_getcaller(rqstp->rq_xprt)->sin_port) >= 1024) {
+  if (ntohs(sin->sin_port) >= 1024) {
     note(N_WARNING, "Call to statd-simu-crash from unprivileged port");
     goto failure;
   }
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
index 321f7a9..6da2ab2 100644
--- a/utils/statd/statd.c
+++ b/utils/statd/statd.c
@@ -88,9 +88,11 @@ extern void simulator (int, char **);
 static void 
 sm_prog_1_wrapper (struct svc_req *rqstp, register SVCXPRT *transp)
 {
+	struct sockaddr_in *sin = nfs_getrpccaller_in(transp);
+
 	/* remote host authorization check */
-	if (!check_default("statd", svc_getcaller(transp),
-				 rqstp->rq_proc, SM_PROG)) {
+	if (sin->sin_family == AF_INET &&
+	    !check_default("statd", sin, rqstp->rq_proc, SM_PROG)) {
 		svcerr_auth (transp, AUTH_FAILED);
 		return;
 	}


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/6] mount.nfs: squelch compiler warning for TI-RPC builds
       [not found] ` <20090304234711.28749.7018.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
                     ` (2 preceding siblings ...)
  2009-03-05  0:02   ` [PATCH 3/6] nfs-utils: Provide type-checked version of svc_getcaller() Chuck Lever
@ 2009-03-05  0:02   ` Chuck Lever
  2009-03-05  0:03   ` [PATCH 5/6] gssd: Use same style for including config.h that rest of nfs-utils uses Chuck Lever
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Chuck Lever @ 2009-03-05  0:02 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

The printf format string in nfs_pp_debug() assumes the @program and
@version arguments are unsigned long, because the legacy RPC headers
define both rpcprog_t and rpcvers_t as unsigned long types.

However, the TI-RPC headers define both types as uint32_t, which
requires a different printf format type.  If we replace the legacy
headers with TI-RPC headers, this type mismatch generates compiler
warnings that are nothing but noise.

We are about to provide a switch at ./configure time to allow the use
of either the legacy RPC headers or the TI-RPC headers, so we need
a printf format that works in both cases.

To squelch the compiler warnings that occur when using the TI-RPC
headers, cast both arguments in the fprintf statement to the widest of
the two types ("unsigned long" or "uint32_t").

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/mount/network.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/utils/mount/network.c b/utils/mount/network.c
index b41388e..bcd0c0f 100644
--- a/utils/mount/network.c
+++ b/utils/mount/network.c
@@ -546,8 +546,9 @@ static void nfs_pp_debug(const struct sockaddr *sap, const socklen_t salen,
 		strcat(buf, "unknown host");
 	}
 
-	fprintf(stderr, _("%s: trying %s prog %ld vers %ld prot %s port %d\n"),
-			progname, buf, program, version,
+	fprintf(stderr, _("%s: trying %s prog %lu vers %lu prot %s port %d\n"),
+			progname, buf, (unsigned long)program,
+			(unsigned long)version,
 			(protocol == IPPROTO_UDP ? _("UDP") : _("TCP")),
 			port);
 }


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/6] gssd: Use same style for including config.h that rest of nfs-utils uses
       [not found] ` <20090304234711.28749.7018.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
                     ` (3 preceding siblings ...)
  2009-03-05  0:02   ` [PATCH 4/6] mount.nfs: squelch compiler warning for TI-RPC builds Chuck Lever
@ 2009-03-05  0:03   ` Chuck Lever
  2009-03-05  0:03   ` [PATCH 6/6] gssd: include gssapi/gssapi.h before write_bytes.h Chuck Lever
  2009-03-05 11:26   ` [PATCH 0/6] Further nfs-utils clean ups Steve Dickson
  6 siblings, 0 replies; 8+ messages in thread
From: Chuck Lever @ 2009-03-05  0:03 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

Clean up.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/gssd/context.c           |    5 ++++-
 utils/gssd/context_heimdal.c   |    4 +++-
 utils/gssd/context_lucid.c     |    4 +++-
 utils/gssd/context_mit.c       |    4 +++-
 utils/gssd/context_spkm3.c     |    5 ++++-
 utils/gssd/err_util.c          |    4 ++++
 utils/gssd/gss_clnt_send_err.c |    4 ++++
 utils/gssd/gss_oids.c          |    4 ++++
 utils/gssd/gss_util.c          |    6 +++++-
 utils/gssd/gssd.c              |    4 +++-
 utils/gssd/gssd_main_loop.c    |    5 +++++
 utils/gssd/gssd_proc.c         |    6 +++++-
 utils/gssd/krb5_util.c         |    6 +++++-
 utils/gssd/svcgssd.c           |    4 +++-
 utils/gssd/svcgssd_main_loop.c |    4 ++++
 utils/gssd/svcgssd_mech2file.c |    4 +++-
 utils/gssd/svcgssd_proc.c      |    4 ++++
 17 files changed, 66 insertions(+), 11 deletions(-)

diff --git a/utils/gssd/context.c b/utils/gssd/context.c
index 0ca7079..1e50bbf 100644
--- a/utils/gssd/context.c
+++ b/utils/gssd/context.c
@@ -28,7 +28,10 @@
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
+
 #include <stdio.h>
 #include <syslog.h>
 #include <string.h>
diff --git a/utils/gssd/context_heimdal.c b/utils/gssd/context_heimdal.c
index fc241e3..ddf064d 100644
--- a/utils/gssd/context_heimdal.c
+++ b/utils/gssd/context_heimdal.c
@@ -28,7 +28,9 @@
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
 
 #ifndef HAVE_LUCID_CONTEXT_SUPPORT
 #ifdef HAVE_HEIMDAL
diff --git a/utils/gssd/context_lucid.c b/utils/gssd/context_lucid.c
index 94403af..3243d53 100644
--- a/utils/gssd/context_lucid.c
+++ b/utils/gssd/context_lucid.c
@@ -28,7 +28,9 @@
  * SUCH DAMAGES.
  */
 
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
 
 #ifdef HAVE_LUCID_CONTEXT_SUPPORT
 
diff --git a/utils/gssd/context_mit.c b/utils/gssd/context_mit.c
index e76a8b1..709a903 100644
--- a/utils/gssd/context_mit.c
+++ b/utils/gssd/context_mit.c
@@ -28,7 +28,9 @@
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
 
 #ifndef HAVE_LUCID_CONTEXT_SUPPORT
 #ifdef HAVE_KRB5
diff --git a/utils/gssd/context_spkm3.c b/utils/gssd/context_spkm3.c
index 5b387bd..b927475 100644
--- a/utils/gssd/context_spkm3.c
+++ b/utils/gssd/context_spkm3.c
@@ -28,7 +28,10 @@
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
+
 #include <stdio.h>
 #include <syslog.h>
 #include <string.h>
diff --git a/utils/gssd/err_util.c b/utils/gssd/err_util.c
index 2583e06..fe09eda 100644
--- a/utils/gssd/err_util.c
+++ b/utils/gssd/err_util.c
@@ -28,6 +28,10 @@
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
+
 #include <stdio.h>
 #include <stdarg.h>
 #include <string.h>
diff --git a/utils/gssd/gss_clnt_send_err.c b/utils/gssd/gss_clnt_send_err.c
index 5260b53..4800a01 100644
--- a/utils/gssd/gss_clnt_send_err.c
+++ b/utils/gssd/gss_clnt_send_err.c
@@ -30,6 +30,10 @@
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
+
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/types.h>
diff --git a/utils/gssd/gss_oids.c b/utils/gssd/gss_oids.c
index c569b0c..a59c4a6 100644
--- a/utils/gssd/gss_oids.c
+++ b/utils/gssd/gss_oids.c
@@ -28,6 +28,10 @@
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
+
 #include <sys/types.h>
 #include <gssapi/gssapi.h>
 
diff --git a/utils/gssd/gss_util.c b/utils/gssd/gss_util.c
index 2d66be9..99aceb3 100644
--- a/utils/gssd/gss_util.c
+++ b/utils/gssd/gss_util.c
@@ -57,7 +57,11 @@
  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  * PERFORMANCE OF THIS SOFTWARE.
  */
-#include "config.h"
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
+
 #include <errno.h>
 #include <stdio.h>
 #include <ctype.h>
diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
index 6d8f3b9..f6949db 100644
--- a/utils/gssd/gssd.c
+++ b/utils/gssd/gssd.c
@@ -36,7 +36,9 @@
 
 */
 
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
 
 #include <sys/param.h>
 #include <sys/socket.h>
diff --git a/utils/gssd/gssd_main_loop.c b/utils/gssd/gssd_main_loop.c
index b9f3a06..917b662 100644
--- a/utils/gssd/gssd_main_loop.c
+++ b/utils/gssd/gssd_main_loop.c
@@ -28,9 +28,14 @@
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
+
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
+
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/poll.h>
diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c
index 91fc8d2..d0d3f7f 100644
--- a/utils/gssd/gssd_proc.c
+++ b/utils/gssd/gssd_proc.c
@@ -38,10 +38,14 @@
 
 */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
+
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
-#include "config.h"
+
 #include <sys/param.h>
 #include <rpc/rpc.h>
 #include <sys/stat.h>
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
index d4ee631..8923b3b 100644
--- a/utils/gssd/krb5_util.c
+++ b/utils/gssd/krb5_util.c
@@ -91,10 +91,14 @@
 
 */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
+
 #ifndef _GNU_SOURCE
 #define _GNU_SOURCE
 #endif
-#include "config.h"
+
 #include <sys/param.h>
 #include <rpc/rpc.h>
 #include <sys/stat.h>
diff --git a/utils/gssd/svcgssd.c b/utils/gssd/svcgssd.c
index 4aa157d..f97dcd3 100644
--- a/utils/gssd/svcgssd.c
+++ b/utils/gssd/svcgssd.c
@@ -37,7 +37,9 @@
 
 */
 
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
 
 #include <sys/param.h>
 #include <sys/types.h>
diff --git a/utils/gssd/svcgssd_main_loop.c b/utils/gssd/svcgssd_main_loop.c
index 280816d..2b4111c 100644
--- a/utils/gssd/svcgssd_main_loop.c
+++ b/utils/gssd/svcgssd_main_loop.c
@@ -28,6 +28,10 @@
   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
+
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <sys/poll.h>
diff --git a/utils/gssd/svcgssd_mech2file.c b/utils/gssd/svcgssd_mech2file.c
index 22c3ed8..65de8d0 100644
--- a/utils/gssd/svcgssd_mech2file.c
+++ b/utils/gssd/svcgssd_mech2file.c
@@ -34,7 +34,9 @@
 
 */
 
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
 
 #include <gssapi/gssapi.h>
 #include <string.h>
diff --git a/utils/gssd/svcgssd_proc.c b/utils/gssd/svcgssd_proc.c
index 1d13532..b390bea 100644
--- a/utils/gssd/svcgssd_proc.c
+++ b/utils/gssd/svcgssd_proc.c
@@ -33,6 +33,10 @@
 
 */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif	/* HAVE_CONFIG_H */
+
 #include <sys/param.h>
 #include <sys/stat.h>
 #include <rpc/rpc.h>


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/6] gssd: include gssapi/gssapi.h before write_bytes.h
       [not found] ` <20090304234711.28749.7018.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
                     ` (4 preceding siblings ...)
  2009-03-05  0:03   ` [PATCH 5/6] gssd: Use same style for including config.h that rest of nfs-utils uses Chuck Lever
@ 2009-03-05  0:03   ` Chuck Lever
  2009-03-05 11:26   ` [PATCH 0/6] Further nfs-utils clean ups Steve Dickson
  6 siblings, 0 replies; 8+ messages in thread
From: Chuck Lever @ 2009-03-05  0:03 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

In gssd/context_lucid.c, ensure that gss_buffer_desc and gss_OID_desc
are defined before write_bytes.h, which uses these definitions, is
included.  With TI-RPC, these definitions are not provided by
rpc/rpc.h.

It appears that <gssapi/gssapi_krb5.h> already includes krb5.h and
gssapi.h (on my system, anyway) so let's drop those includes.

Ideally write_bytes.h itself should include the needed headers, but
some source files that use Heimdal include a different, Heimdal-
compatible, header to get these definitions.

Pointed-out-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 utils/gssd/context_lucid.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/utils/gssd/context_lucid.c b/utils/gssd/context_lucid.c
index 3243d53..af7de58 100644
--- a/utils/gssd/context_lucid.c
+++ b/utils/gssd/context_lucid.c
@@ -42,17 +42,17 @@
 #include <stdio.h>
 #include <syslog.h>
 #include <string.h>
+
+#include <gssapi/gssapi_krb5.h>
+
 #include "gss_util.h"
 #include "gss_oids.h"
 #include "err_util.h"
 #include "context.h"
 
-#include <krb5.h>
-#include <gssapi/gssapi.h>
 #ifndef OM_uint64
 typedef uint64_t OM_uint64;
 #endif
-#include <gssapi/gssapi_krb5.h>
 
 static int
 write_lucid_keyblock(char **p, char *end, gss_krb5_lucid_key_t *key)


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/6] Further nfs-utils clean ups
       [not found] ` <20090304234711.28749.7018.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
                     ` (5 preceding siblings ...)
  2009-03-05  0:03   ` [PATCH 6/6] gssd: include gssapi/gssapi.h before write_bytes.h Chuck Lever
@ 2009-03-05 11:26   ` Steve Dickson
  6 siblings, 0 replies; 8+ messages in thread
From: Steve Dickson @ 2009-03-05 11:26 UTC (permalink / raw)
  To: Chuck Lever; +Cc: linux-nfs



Chuck Lever wrote:
> Hi Steve-
> 
> Here are six more patches that clean up various issues to prepare for
> the widespread use of TI-RPC in nfs-utils.
> 
> We discovered a type width mismatch issue between our legacy RPC
> headers and the TI-RPC run-time that will be addressed in a subsequent
> patch series by using TI-RPC to build all of nfs-utils.  This issue
> should be addressed before the next release of nfs-utils is published.
> 
> The idea will be to build nfs-utils with either glibc's legacy RPC
> implementation and the legacy RPC headers (as it is today in 1.1.3),
> or with libtirpc and TI-RPC's headers, based on the setting of
> --enable-tirpc (which defaults to --disable-tirpc).
> 
> This further insulates ongoing IPv6 work from folks who need to use
> today's up-to-date version of nfs-utils, while easily allowing us to
> test a version built with complete TI-RPC integration.
> 
Committed...

steved.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2009-03-05 11:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-05  0:02 [PATCH 0/6] Further nfs-utils clean ups Chuck Lever
     [not found] ` <20090304234711.28749.7018.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2009-03-05  0:02   ` [PATCH 1/6] nfs-utils: Replace getservbyname(3) Chuck Lever
2009-03-05  0:02   ` [PATCH 2/6] configure: Remove CPPFLAGS substitution Chuck Lever
2009-03-05  0:02   ` [PATCH 3/6] nfs-utils: Provide type-checked version of svc_getcaller() Chuck Lever
2009-03-05  0:02   ` [PATCH 4/6] mount.nfs: squelch compiler warning for TI-RPC builds Chuck Lever
2009-03-05  0:03   ` [PATCH 5/6] gssd: Use same style for including config.h that rest of nfs-utils uses Chuck Lever
2009-03-05  0:03   ` [PATCH 6/6] gssd: include gssapi/gssapi.h before write_bytes.h Chuck Lever
2009-03-05 11:26   ` [PATCH 0/6] Further nfs-utils clean ups Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox