mcinglis / rpms / nfs-utils

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