f41a2e1
diff --git a/configure.ac b/configure.ac
f41a2e1
index a594a7b..d3ad854 100644
f41a2e1
--- a/configure.ac
f41a2e1
+++ b/configure.ac
f41a2e1
@@ -1,6 +1,6 @@
f41a2e1
 dnl Process this file with autoconf to produce a configure script.
f41a2e1
 dnl
f41a2e1
-AC_INIT([linux nfs-utils],[1.2.7],[linux-nfs@vger.kernel.org],[nfs-utils])
f41a2e1
+AC_INIT([linux nfs-utils],[1.2.8],[linux-nfs@vger.kernel.org],[nfs-utils])
f41a2e1
 AC_CANONICAL_BUILD([])
f41a2e1
 AC_CANONICAL_HOST([])
f41a2e1
 AC_CONFIG_MACRO_DIR(aclocal)
f41a2e1
diff --git a/support/include/nfsrpc.h b/support/include/nfsrpc.h
f41a2e1
index a0b80e1..1bfae7a 100644
f41a2e1
--- a/support/include/nfsrpc.h
f41a2e1
+++ b/support/include/nfsrpc.h
f41a2e1
@@ -156,6 +156,11 @@ extern unsigned long	nfs_pmap_getport(const struct sockaddr_in *,
f41a2e1
 				const struct timeval *);
f41a2e1
 
f41a2e1
 /*
f41a2e1
+ * Use nfs_pmap_getport to see if statd is running locally
f41a2e1
+ */
f41a2e1
+extern int nfs_probe_statd(void);
f41a2e1
+
f41a2e1
+/*
f41a2e1
  * Contact a remote RPC service to discover whether it is responding
f41a2e1
  * to requests.
f41a2e1
  */
f41a2e1
diff --git a/support/nfs/getport.c b/support/nfs/getport.c
f41a2e1
index 3331ad4..081594c 100644
f41a2e1
--- a/support/nfs/getport.c
f41a2e1
+++ b/support/nfs/getport.c
f41a2e1
@@ -1102,3 +1102,25 @@ unsigned long nfs_pmap_getport(const struct sockaddr_in *sin,
f41a2e1
 
f41a2e1
 	return port;
f41a2e1
 }
f41a2e1
+
f41a2e1
+static const char *nfs_ns_pgmtbl[] = {
f41a2e1
+        "status",
f41a2e1
+        NULL,
f41a2e1
+};
f41a2e1
+
f41a2e1
+/*
f41a2e1
+ * nfs_probe_statd - use nfs_pmap_getport to see if statd is running locally
f41a2e1
+ *
f41a2e1
+ * Returns non-zero if statd is running locally.
f41a2e1
+ */
f41a2e1
+int nfs_probe_statd(void)
f41a2e1
+{
f41a2e1
+        struct sockaddr_in addr = {
f41a2e1
+                .sin_family             = AF_INET,
f41a2e1
+                .sin_addr.s_addr        = htonl(INADDR_LOOPBACK),
f41a2e1
+        };
f41a2e1
+        rpcprog_t program = nfs_getrpcbyname(NSMPROG, nfs_ns_pgmtbl);
f41a2e1
+
f41a2e1
+        return nfs_getport_ping((struct sockaddr *)(char *)&addr, sizeof(addr),
f41a2e1
+                                program, (rpcvers_t)1, IPPROTO_UDP);
f41a2e1
+}
f41a2e1
diff --git a/tools/nfs-iostat/nfs-iostat.py b/tools/nfs-iostat/nfs-iostat.py
f41a2e1
index dfbef87..c035537 100644
f41a2e1
--- a/tools/nfs-iostat/nfs-iostat.py
f41a2e1
+++ b/tools/nfs-iostat/nfs-iostat.py
f41a2e1
@@ -353,14 +353,14 @@ class DeviceData:
f41a2e1
             exe_per_op = 0.0
f41a2e1
 
f41a2e1
         op += ':'
f41a2e1
-        print('%s' % op.lower().ljust(15))
f41a2e1
+        print('%s' % op.lower().ljust(15), end='')
f41a2e1
         print('  ops/s\t\t   kB/s\t\t  kB/op\t\tretrans\t\tavg RTT (ms)\tavg exe (ms)')
f41a2e1
 
f41a2e1
-        print('\t\t%7.3f' % (ops / sample_time))
f41a2e1
-        print('\t%7.3f' % (kilobytes / sample_time))
f41a2e1
-        print('\t%7.3f' % kb_per_op)
f41a2e1
-        print(' %7d (%3.1f%%)' % (retrans, retrans_percent))
f41a2e1
-        print('\t%7.3f' % rtt_per_op)
f41a2e1
+        print('\t\t%7.3f' % (ops / sample_time), end='')
f41a2e1
+        print('\t%7.3f' % (kilobytes / sample_time), end='')
f41a2e1
+        print('\t%7.3f' % kb_per_op, end='')
f41a2e1
+        print(' %7d (%3.1f%%)' % (retrans, retrans_percent), end='')
f41a2e1
+        print('\t%7.3f' % rtt_per_op, end='')
f41a2e1
         print('\t%7.3f' % exe_per_op)
f41a2e1
 
f41a2e1
     def ops(self, sample_time):
f41a2e1
@@ -392,7 +392,7 @@ class DeviceData:
f41a2e1
         print()
f41a2e1
 
f41a2e1
         print('   op/s\t\trpc bklog')
f41a2e1
-        print('%7.2f' % (sends / sample_time))
f41a2e1
+        print('%7.2f' % (sends / sample_time), end='')
f41a2e1
         print('\t%7.2f' % backlog)
f41a2e1
 
f41a2e1
         if which == 0:
f41a2e1
diff --git a/utils/gssd/gssd.man b/utils/gssd/gssd.man
f41a2e1
index 1df75c5..ac13fd4 100644
f41a2e1
--- a/utils/gssd/gssd.man
f41a2e1
+++ b/utils/gssd/gssd.man
f41a2e1
@@ -195,11 +195,28 @@ option when starting
f41a2e1
 .BR rpc.gssd .
f41a2e1
 .SH OPTIONS
f41a2e1
 .TP
f41a2e1
-.B -D
f41a2e1
-DNS Reverse lookups are not used for determining the
f41a2e1
-server names pass to GSSAPI. This option will reverses that and forces 
f41a2e1
-the use of DNS Reverse resolution of the server's IP address to 
f41a2e1
-retrieve the server name to use in GSAPI authentication.
f41a2e1
+.B \-D
f41a2e1
+The server name passed to GSSAPI for authentication is normally the
f41a2e1
+name exactly as requested.  e.g. for NFS
f41a2e1
+it is the server name in the "servername:/path" mount request.  Only if this
f41a2e1
+servername appears to be an IP address (IPv4 or IPv6) or an
f41a2e1
+unqualified name (no dots) will a reverse DNS lookup
f41a2e1
+will be performed to get the canoncial server name.
f41a2e1
+
f41a2e1
+If
f41a2e1
+.B \-D
f41a2e1
+is present, a reverse DNS lookup will
f41a2e1
+.I always
f41a2e1
+be used, even if the server name looks like a canonical name.  So it
f41a2e1
+is needed if partially qualified, or non canonical names are regularly
f41a2e1
+used.
f41a2e1
+
f41a2e1
+Using
f41a2e1
+.B \-D
f41a2e1
+can introduce a security vulnerability, so it is recommended that
f41a2e1
+.B \-D
f41a2e1
+not be used, and that canonical names always be used when requesting
f41a2e1
+services.
f41a2e1
 .TP
f41a2e1
 .B -f
f41a2e1
 Runs
f41a2e1
diff --git a/utils/gssd/gssd_proc.c b/utils/gssd/gssd_proc.c
f41a2e1
index af1844c..b7e2bbb 100644
f41a2e1
--- a/utils/gssd/gssd_proc.c
f41a2e1
+++ b/utils/gssd/gssd_proc.c
f41a2e1
@@ -67,7 +67,6 @@
f41a2e1
 #include <errno.h>
f41a2e1
 #include <gssapi/gssapi.h>
f41a2e1
 #include <netdb.h>
f41a2e1
-#include <ctype.h>
f41a2e1
 
f41a2e1
 #include "gssd.h"
f41a2e1
 #include "err_util.h"
f41a2e1
@@ -176,7 +175,6 @@ get_servername(const char *name, const struct sockaddr *sa, const char *addr)
f41a2e1
 	char			*hostname;
f41a2e1
 	char			hbuf[NI_MAXHOST];
f41a2e1
 	unsigned char		buf[sizeof(struct in6_addr)];
f41a2e1
-	int			servername = 0;
f41a2e1
 
f41a2e1
 	if (avoid_dns) {
f41a2e1
 		/*
f41a2e1
@@ -184,15 +182,18 @@ get_servername(const char *name, const struct sockaddr *sa, const char *addr)
f41a2e1
 		 * If it is an IP address, do the DNS lookup otherwise
f41a2e1
 		 * skip the DNS lookup.
f41a2e1
 		 */
f41a2e1
-		servername = 0;
f41a2e1
-		if (strchr(name, '.') && inet_pton(AF_INET, name, buf) == 1)
f41a2e1
-			servername = 1; /* IPv4 */
f41a2e1
-		else if (strchr(name, ':') && inet_pton(AF_INET6, name, buf) == 1)
f41a2e1
-			servername = 1; /* or IPv6 */
f41a2e1
-
f41a2e1
-		if (servername) {
f41a2e1
+		int is_fqdn = 1;
f41a2e1
+		if (strchr(name, '.') == NULL)
f41a2e1
+			is_fqdn = 0; /* local name */
f41a2e1
+		else if (inet_pton(AF_INET, name, buf) == 1)
f41a2e1
+			is_fqdn = 0; /* IPv4 address */
f41a2e1
+		else if (inet_pton(AF_INET6, name, buf) == 1)
f41a2e1
+			is_fqdn = 0; /* IPv6 addrss */
f41a2e1
+
f41a2e1
+		if (is_fqdn) {
f41a2e1
 			return strdup(name);
f41a2e1
 		}
f41a2e1
+		/* Sorry, cannot avoid dns after all */
f41a2e1
 	}
f41a2e1
 
f41a2e1
 	switch (sa->sa_family) {
f41a2e1
diff --git a/utils/gssd/krb5_util.c b/utils/gssd/krb5_util.c
f41a2e1
index 6275dd8..83b9651 100644
f41a2e1
--- a/utils/gssd/krb5_util.c
f41a2e1
+++ b/utils/gssd/krb5_util.c
f41a2e1
@@ -231,7 +231,7 @@ gssd_find_existing_krb5_ccache(uid_t uid, char *dirname,
f41a2e1
 				continue;
f41a2e1
 			}
f41a2e1
 			if (uid == 0 && !root_uses_machine_creds && 
f41a2e1
-				strstr(namelist[i]->d_name, "_machine_")) {
f41a2e1
+				strstr(namelist[i]->d_name, "machine_")) {
f41a2e1
 				printerr(3, "CC '%s' not available to root\n",
f41a2e1
 					 statname);
f41a2e1
 				free(namelist[i]);
f41a2e1
@@ -825,8 +825,10 @@ find_keytab_entry(krb5_context context, krb5_keytab kt, const char *tgtname,
f41a2e1
 	myhostad[i+1] = 0;
f41a2e1
 
f41a2e1
 	retval = get_full_hostname(myhostname, myhostname, sizeof(myhostname));
f41a2e1
-	if (retval)
f41a2e1
-		goto out;
f41a2e1
+	if (retval) {
f41a2e1
+		/* Don't use myhostname */
f41a2e1
+		myhostname[0] = 0;
f41a2e1
+	}
f41a2e1
 
f41a2e1
 	code = krb5_get_default_realm(context, &default_realm);
f41a2e1
 	if (code) {
f41a2e1
@@ -852,11 +854,19 @@ find_keytab_entry(krb5_context context, krb5_keytab kt, const char *tgtname,
f41a2e1
 	}
f41a2e1
 
f41a2e1
 	/*
f41a2e1
-	 * Try the "appropriate" realm first, and if nothing found for that
f41a2e1
-	 * realm, try the default realm (if it hasn't already been tried).
f41a2e1
+	 * Make sure the preferred_realm, which may have been explicitly set
f41a2e1
+	 * on the command line, is tried first. If nothing is found go on with
f41a2e1
+	 * the host and local default realm (if that hasn't already been tried).
f41a2e1
 	 */
f41a2e1
 	i = 0;
f41a2e1
 	realm = realmnames[i];
f41a2e1
+
f41a2e1
+	if (strcmp (realm, preferred_realm) != 0) {
f41a2e1
+		realm = preferred_realm;
f41a2e1
+		/* resetting the realmnames index */
f41a2e1
+		i = -1;
f41a2e1
+	}
f41a2e1
+
f41a2e1
 	while (1) {
f41a2e1
 		if (realm == NULL) {
f41a2e1
 			tried_all = 1;
f41a2e1
@@ -883,6 +893,8 @@ find_keytab_entry(krb5_context context, krb5_keytab kt, const char *tgtname,
f41a2e1
 								myhostad,
f41a2e1
 								NULL);
f41a2e1
 			} else {
f41a2e1
+				if (!myhostname[0])
f41a2e1
+					continue;
f41a2e1
 				snprintf(spn, sizeof(spn), "%s/%s@%s",
f41a2e1
 					 svcnames[j], myhostname, realm);
f41a2e1
 				code = krb5_build_principal_ext(context, &princ,
f41a2e1
@@ -1236,7 +1248,7 @@ gssd_refresh_krb5_machine_credential(char *hostname,
f41a2e1
 	krb5_keytab kt = NULL;;
f41a2e1
 	int retval = 0;
f41a2e1
 	char *k5err = NULL;
f41a2e1
-	const char *svcnames[5] = { "$", "root", "nfs", "host", NULL };
f41a2e1
+	const char *svcnames[] = { "$", "root", "nfs", "host", NULL };
f41a2e1
 
f41a2e1
 	/*
f41a2e1
 	 * If a specific service name was specified, use it.
f41a2e1
diff --git a/utils/mount/network.c b/utils/mount/network.c
f41a2e1
index 4be48cd..e2cdcaf 100644
f41a2e1
--- a/utils/mount/network.c
f41a2e1
+++ b/utils/mount/network.c
f41a2e1
@@ -65,11 +65,6 @@ extern int nfs_mount_data_version;
f41a2e1
 extern char *progname;
f41a2e1
 extern int verbose;
f41a2e1
 
f41a2e1
-static const char *nfs_ns_pgmtbl[] = {
f41a2e1
-	"status",
f41a2e1
-	NULL,
f41a2e1
-};
f41a2e1
-
f41a2e1
 static const char *nfs_mnt_pgmtbl[] = {
f41a2e1
 	"mount",
f41a2e1
 	"mountd",
f41a2e1
@@ -761,18 +756,6 @@ int probe_bothports(clnt_addr_t *mnt_server, clnt_addr_t *nfs_server)
f41a2e1
 					&nfs_server->pmap);
f41a2e1
 }
f41a2e1
 
f41a2e1
-static int nfs_probe_statd(void)
f41a2e1
-{
f41a2e1
-	struct sockaddr_in addr = {
f41a2e1
-		.sin_family		= AF_INET,
f41a2e1
-		.sin_addr.s_addr	= htonl(INADDR_LOOPBACK),
f41a2e1
-	};
f41a2e1
-	rpcprog_t program = nfs_getrpcbyname(NSMPROG, nfs_ns_pgmtbl);
f41a2e1
-
f41a2e1
-	return nfs_getport_ping(SAFE_SOCKADDR(&addr), sizeof(addr),
f41a2e1
-				program, (rpcvers_t)1, IPPROTO_UDP);
f41a2e1
-}
f41a2e1
-
f41a2e1
 /**
f41a2e1
  * start_statd - attempt to start rpc.statd
f41a2e1
  *
f41a2e1
diff --git a/utils/mount/nfs.man b/utils/mount/nfs.man
f41a2e1
index a8ec46c..2a42b93 100644
f41a2e1
--- a/utils/mount/nfs.man
f41a2e1
+++ b/utils/mount/nfs.man
f41a2e1
@@ -84,6 +84,20 @@ in
f41a2e1
 .SS "Options supported by all versions"
f41a2e1
 These options are valid to use with any NFS version.
f41a2e1
 .TP 1.5i
f41a2e1
+.BI nfsvers= n
f41a2e1
+The NFS protocol version number used to contact the server's NFS service.
f41a2e1
+If the server does not support the requested version, the mount request 
f41a2e1
+fails.
f41a2e1
+If this option is not specified, the client negotiates a suitable version 
f41a2e1
+with
f41a2e1
+the server, trying version 4 first, version 3 second, and version 2 last.
f41a2e1
+.TP 1.5i
f41a2e1
+.BI vers= n
f41a2e1
+This option is an alternative to the
f41a2e1
+.B nfsvers
f41a2e1
+option.
f41a2e1
+It is included for compatibility with other operating systems
f41a2e1
+.TP 1.5i
f41a2e1
 .BR soft " / " hard
f41a2e1
 Determines the recovery behavior of the NFS client
f41a2e1
 after an NFS request times out.
f41a2e1
@@ -621,18 +635,6 @@ Using this option ensures that
f41a2e1
 reports the proper maximum component length to applications
f41a2e1
 in such cases.
f41a2e1
 .TP 1.5i
f41a2e1
-.BI nfsvers= n
f41a2e1
-The NFS protocol version number used to contact the server's NFS service.
f41a2e1
-If the server does not support the requested version, the mount request fails.
f41a2e1
-If this option is not specified, the client negotiates a suitable version with
f41a2e1
-the server, trying version 4 first, version 3 second, and version 2 last.
f41a2e1
-.TP 1.5i
f41a2e1
-.BI vers= n
f41a2e1
-This option is an alternative to the
f41a2e1
-.B nfsvers
f41a2e1
-option.
f41a2e1
-It is included for compatibility with other operating systems.
f41a2e1
-.TP 1.5i
f41a2e1
 .BR lock " / " nolock
f41a2e1
 Selects whether to use the NLM sideband protocol to lock files on the server.
f41a2e1
 If neither option is specified (or if
f41a2e1
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
f41a2e1
index 737927c..517aa62 100644
f41a2e1
--- a/utils/mountd/cache.c
f41a2e1
+++ b/utils/mountd/cache.c
f41a2e1
@@ -347,20 +347,26 @@ static char *next_mnt(void **v, char *p)
f41a2e1
 
f41a2e1
 static int is_subdirectory(char *child, char *parent)
f41a2e1
 {
f41a2e1
+	/* Check is child is strictly a subdirectory of
f41a2e1
+	 * parent or a more distant descendant.
f41a2e1
+	 */
f41a2e1
 	size_t l = strlen(parent);
f41a2e1
 
f41a2e1
-	if (strcmp(parent, "/") == 0)
f41a2e1
+	if (strcmp(parent, "/") == 0 && child[1] != 0)
f41a2e1
 		return 1;
f41a2e1
 
f41a2e1
-	return strcmp(child, parent) == 0
f41a2e1
-		|| (strncmp(child, parent, l) == 0 && child[l] == '/');
f41a2e1
+	return (strncmp(child, parent, l) == 0 && child[l] == '/');
f41a2e1
 }
f41a2e1
 
f41a2e1
 static int path_matches(nfs_export *exp, char *path)
f41a2e1
 {
f41a2e1
-	if (exp->m_export.e_flags & NFSEXP_CROSSMOUNT)
f41a2e1
-		return is_subdirectory(path, exp->m_export.e_path);
f41a2e1
-	return strcmp(path, exp->m_export.e_path) == 0;
f41a2e1
+	/* Does the path match the export?  I.e. is it an
f41a2e1
+	 * exact match, or does the export have CROSSMOUNT, and path
f41a2e1
+	 * is a descendant?
f41a2e1
+	 */
f41a2e1
+	return strcmp(path, exp->m_export.e_path) == 0
f41a2e1
+		|| ((exp->m_export.e_flags & NFSEXP_CROSSMOUNT)
f41a2e1
+		    && is_subdirectory(path, exp->m_export.e_path));
f41a2e1
 }
f41a2e1
 
f41a2e1
 static int
f41a2e1
@@ -369,15 +375,13 @@ export_matches(nfs_export *exp, char *dom, char *path, struct addrinfo *ai)
f41a2e1
 	return path_matches(exp, path) && client_matches(exp, dom, ai);
f41a2e1
 }
f41a2e1
 
f41a2e1
-/* True iff e1 is a child of e2 and e2 has crossmnt set: */
f41a2e1
+/* True iff e1 is a child of e2 (or descendant) and e2 has crossmnt set: */
f41a2e1
 static bool subexport(struct exportent *e1, struct exportent *e2)
f41a2e1
 {
f41a2e1
 	char *p1 = e1->e_path, *p2 = e2->e_path;
f41a2e1
-	size_t l2 = strlen(p2);
f41a2e1
 
f41a2e1
 	return e2->e_flags & NFSEXP_CROSSMOUNT
f41a2e1
-		&& strncmp(p1, p2, l2) == 0
f41a2e1
-		&& p1[l2] == '/';
f41a2e1
+		&& is_subdirectory(p1, p2);
f41a2e1
 }
f41a2e1
 
f41a2e1
 struct parsed_fsid {
f41a2e1
diff --git a/utils/nfsdcltrack/nfsdcltrack.man b/utils/nfsdcltrack/nfsdcltrack.man
f41a2e1
index 47007df..6940788 100644
f41a2e1
--- a/utils/nfsdcltrack/nfsdcltrack.man
f41a2e1
+++ b/utils/nfsdcltrack/nfsdcltrack.man
f41a2e1
@@ -1,53 +1,3 @@
f41a2e1
-.\" Automatically generated by Pod::Man 2.25 (Pod::Simple 3.16)
f41a2e1
-.\"
f41a2e1
-.\" Standard preamble:
f41a2e1
-.\" ========================================================================
f41a2e1
-.de Sp \" Vertical space (when we can't use .PP)
f41a2e1
-.if t .sp .5v
f41a2e1
-.if n .sp
f41a2e1
-..
f41a2e1
-.de Vb \" Begin verbatim text
f41a2e1
-.ft CW
f41a2e1
-.nf
f41a2e1
-.ne \\$1
f41a2e1
-..
f41a2e1
-.de Ve \" End verbatim text
f41a2e1
-.ft R
f41a2e1
-.fi
f41a2e1
-..
f41a2e1
-.\" Set up some character translations and predefined strings.  \*(-- will
f41a2e1
-.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
f41a2e1
-.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
f41a2e1
-.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
f41a2e1
-.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
f41a2e1
-.\" nothing in troff, for use with C<>.
f41a2e1
-.tr \(*W-
f41a2e1
-.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
f41a2e1
-.ie n \{\
f41a2e1
-.    ds -- \(*W-
f41a2e1
-.    ds PI pi
f41a2e1
-.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
f41a2e1
-.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
f41a2e1
-.    ds L" ""
f41a2e1
-.    ds R" ""
f41a2e1
-.    ds C` ""
f41a2e1
-.    ds C' ""
f41a2e1
-'br\}
f41a2e1
-.el\{\
f41a2e1
-.    ds -- \|\(em\|
f41a2e1
-.    ds PI \(*p
f41a2e1
-.    ds L" ``
f41a2e1
-.    ds R" ''
f41a2e1
-'br\}
f41a2e1
-.\"
f41a2e1
-.\" Escape single quotes in literal strings from groff's Unicode transform.
f41a2e1
-.ie \n(.g .ds Aq \(aq
f41a2e1
-.el       .ds Aq '
f41a2e1
-.\"
f41a2e1
-.\" If the F register is turned on, we'll generate index entries on stderr for
f41a2e1
-.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
f41a2e1
-.\" entries marked with X<> in POD.  Of course, you'll have to process the
f41a2e1
-.\" output yourself in some meaningful fashion.
f41a2e1
 .ie \nF \{\
f41a2e1
 .    de IX
f41a2e1
 .    tm Index:\\$1\t\\n%\t"\\$2"
f41a2e1
@@ -59,70 +9,6 @@
f41a2e1
 .    de IX
f41a2e1
 ..
f41a2e1
 .\}
f41a2e1
-.\"
f41a2e1
-.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
f41a2e1
-.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
f41a2e1
-.    \" fudge factors for nroff and troff
f41a2e1
-.if n \{\
f41a2e1
-.    ds #H 0
f41a2e1
-.    ds #V .8m
f41a2e1
-.    ds #F .3m
f41a2e1
-.    ds #[ \f1
f41a2e1
-.    ds #] \fP
f41a2e1
-.\}
f41a2e1
-.if t \{\
f41a2e1
-.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
f41a2e1
-.    ds #V .6m
f41a2e1
-.    ds #F 0
f41a2e1
-.    ds #[ \&
f41a2e1
-.    ds #] \&
f41a2e1
-.\}
f41a2e1
-.    \" simple accents for nroff and troff
f41a2e1
-.if n \{\
f41a2e1
-.    ds ' \&
f41a2e1
-.    ds ` \&
f41a2e1
-.    ds ^ \&
f41a2e1
-.    ds , \&
f41a2e1
-.    ds ~ ~
f41a2e1
-.    ds /
f41a2e1
-.\}
f41a2e1
-.if t \{\
f41a2e1
-.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
f41a2e1
-.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
f41a2e1
-.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
f41a2e1
-.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
f41a2e1
-.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
f41a2e1
-.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
f41a2e1
-.\}
f41a2e1
-.    \" troff and (daisy-wheel) nroff accents
f41a2e1
-.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
f41a2e1
-.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
f41a2e1
-.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
f41a2e1
-.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
f41a2e1
-.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
f41a2e1
-.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
f41a2e1
-.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
f41a2e1
-.ds ae a\h'-(\w'a'u*4/10)'e
f41a2e1
-.ds Ae A\h'-(\w'A'u*4/10)'E
f41a2e1
-.    \" corrections for vroff
f41a2e1
-.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
f41a2e1
-.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
f41a2e1
-.    \" for low resolution devices (crt and lpr)
f41a2e1
-.if \n(.H>23 .if \n(.V>19 \
f41a2e1
-\{\
f41a2e1
-.    ds : e
f41a2e1
-.    ds 8 ss
f41a2e1
-.    ds o a
f41a2e1
-.    ds d- d\h'-1'\(ga
f41a2e1
-.    ds D- D\h'-1'\(hy
f41a2e1
-.    ds th \o'bp'
f41a2e1
-.    ds Th \o'LP'
f41a2e1
-.    ds ae ae
f41a2e1
-.    ds Ae AE
f41a2e1
-.\}
f41a2e1
-.rm #[ #] #H #V #F C
f41a2e1
-.\" ========================================================================
f41a2e1
-.\"
f41a2e1
 .IX Title "NFSDCLTRACK 8"
f41a2e1
 .TH NFSDCLTRACK 8 "2012-10-24" "" ""
f41a2e1
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
f41a2e1
diff --git a/utils/nfsidmap/Makefile.am b/utils/nfsidmap/Makefile.am
f41a2e1
index c0675c4..737a219 100644
f41a2e1
--- a/utils/nfsidmap/Makefile.am
f41a2e1
+++ b/utils/nfsidmap/Makefile.am
f41a2e1
@@ -1,9 +1,10 @@
f41a2e1
 ## Process this file with automake to produce Makefile.in
f41a2e1
 
f41a2e1
 man8_MANS = nfsidmap.man
f41a2e1
-
f41a2e1
 sbin_PROGRAMS	= nfsidmap
f41a2e1
+
f41a2e1
 nfsidmap_SOURCES = nfsidmap.c
f41a2e1
 nfsidmap_LDADD = $(LIBNFSIDMAP) -lkeyutils ../../support/nfs/libnfs.a
f41a2e1
 
f41a2e1
 MAINTAINERCLEANFILES = Makefile.in
f41a2e1
+EXTRA_DIST = id_resolver.conf
f41a2e1
diff --git a/utils/nfsidmap/id_resolver.conf b/utils/nfsidmap/id_resolver.conf
f41a2e1
new file mode 100644
f41a2e1
index 0000000..2c156c6
f41a2e1
--- /dev/null
f41a2e1
+++ b/utils/nfsidmap/id_resolver.conf
f41a2e1
@@ -0,0 +1 @@
f41a2e1
+create	id_resolver	*	*	/usr/sbin/nfsidmap -t 600 %k %d
f41a2e1
diff --git a/utils/statd/statd.c b/utils/statd/statd.c
f41a2e1
index 652546c..8c51bcc 100644
f41a2e1
--- a/utils/statd/statd.c
f41a2e1
+++ b/utils/statd/statd.c
f41a2e1
@@ -28,6 +28,7 @@
f41a2e1
 
f41a2e1
 #include "statd.h"
f41a2e1
 #include "nfslib.h"
f41a2e1
+#include "nfsrpc.h"
f41a2e1
 #include "nsm.h"
f41a2e1
 
f41a2e1
 /* Socket operations */
f41a2e1
@@ -237,6 +238,12 @@ int main (int argc, char **argv)
f41a2e1
 	/* Set hostname */
f41a2e1
 	MY_NAME = NULL;
f41a2e1
 
f41a2e1
+	/* Refuse to start if another statd is running */
f41a2e1
+	if (nfs_probe_statd()) {
f41a2e1
+		fprintf(stderr, "Statd service already running!\n");
f41a2e1
+		exit(1);
f41a2e1
+	}
f41a2e1
+
f41a2e1
 	/* Process command line switches */
f41a2e1
 	while ((arg = getopt_long(argc, argv, "h?vVFNH:dn:p:o:P:L", longopts, NULL)) != EOF) {
f41a2e1
 		switch (arg) {