walters / rpms / nfs-utils

Forked from rpms/nfs-utils 6 years ago
Clone
ea858b4
diff --git a/aclocal/ipv6.m4 b/aclocal/ipv6.m4
ea858b4
index ba9dcc2..2490f3d 100644
ea858b4
--- a/aclocal/ipv6.m4
ea858b4
+++ b/aclocal/ipv6.m4
ea858b4
@@ -11,7 +11,7 @@ AC_DEFUN([AC_IPV6], [
ea858b4
 
ea858b4
     dnl TI-RPC required for IPv6
ea858b4
     if test "$enable_tirpc" = no; then
ea858b4
-      AC_MSG_ERROR(['--enable-ipv6' requires '--enable-tirpc'.])
ea858b4
+      AC_MSG_ERROR(['--enable-ipv6' requires TIRPC support.])
ea858b4
     fi
ea858b4
 
ea858b4
     dnl IPv6-enabled networking functions required for IPv6
ea858b4
diff --git a/aclocal/libtirpc.m4 b/aclocal/libtirpc.m4
ea858b4
index af4c7d3..9f0fde0 100644
ea858b4
--- a/aclocal/libtirpc.m4
ea858b4
+++ b/aclocal/libtirpc.m4
ea858b4
@@ -11,17 +11,29 @@ AC_DEFUN([AC_LIBTIRPC], [
ea858b4
   dnl if --enable-tirpc was specifed, the following components
ea858b4
   dnl must be present, and we set up HAVE_ macros for them.
ea858b4
 
ea858b4
-  if test "$enable_tirpc" = yes; then
ea858b4
+  if test "$enable_tirpc" != "no"; then
ea858b4
 
ea858b4
     dnl look for the library; add to LIBS if found
ea858b4
     AC_CHECK_LIB([tirpc], [clnt_tli_create], ,
ea858b4
-                 [AC_MSG_ERROR([libtirpc not found.])])
ea858b4
+                 [if test "$enable_tirpc" = "yes"; then
ea858b4
+			AC_MSG_ERROR([libtirpc not found.])
ea858b4
+		  else
ea858b4
+			AC_MSG_WARN([libtirpc not found. TIRPC disabled!])
ea858b4
+			enable_tirpc="no"
ea858b4
+		  fi])
ea858b4
+  fi
ea858b4
 
ea858b4
+  if test "$enable_tirpc" != "no"; then
ea858b4
     dnl also must have the headers installed where we expect
ea858b4
     dnl look for headers; add -I compiler option if found
ea858b4
-    AC_CHECK_HEADERS([${tirpc_header_dir}/netconfig.h], ,
ea858b4
-                     [AC_MSG_ERROR([libtirpc headers not found.])])
ea858b4
-    AC_SUBST([AM_CPPFLAGS], ["-I${tirpc_header_dir}"])
ea858b4
+    AC_CHECK_HEADERS([${tirpc_header_dir}/netconfig.h],
ea858b4
+    		      AC_SUBST([AM_CPPFLAGS], ["-I${tirpc_header_dir}"]),
ea858b4
+		      [if test "$enable_tirpc" = "yes"; then
ea858b4
+			 AC_MSG_ERROR([libtirpc headers not found.])
ea858b4
+		       else
ea858b4
+			 AC_MSG_WARN([libtirpc headers not found. TIRPC disabled!])
ea858b4
+			 enable_tirpc="no"
ea858b4
+		       fi])
ea858b4
 
ea858b4
   fi
ea858b4
 
ea858b4
diff --git a/configure.ac b/configure.ac
ea858b4
index e09e1d9..e0ca70e 100644
ea858b4
--- a/configure.ac
ea858b4
+++ b/configure.ac
ea858b4
@@ -1,6 +1,6 @@
ea858b4
 dnl Process this file with autoconf to produce a configure script.
ea858b4
 dnl
ea858b4
-AC_INIT([linux nfs-utils],[1.1.6],[linux-nfs@vger.kernel.org],[nfs-utils])
ea858b4
+AC_INIT([linux nfs-utils],[1.2.0],[linux-nfs@vger.kernel.org],[nfs-utils])
ea858b4
 AC_CANONICAL_BUILD([])
ea858b4
 AC_CANONICAL_HOST([])
ea858b4
 AC_CONFIG_MACRO_DIR(aclocal)
ea858b4
@@ -120,9 +120,9 @@ AC_ARG_ENABLE(mount,
ea858b4
 	AM_CONDITIONAL(CONFIG_MOUNT, [test "$enable_mount" = "yes"])
ea858b4
 AC_ARG_ENABLE(tirpc,
ea858b4
 	[AC_HELP_STRING([--enable-tirpc],
ea858b4
-			[enable use of TI-RPC @<:@default=no@:>@])],
ea858b4
+			[enable use of TI-RPC @<:@default=yes@:>@])],
ea858b4
 	enable_tirpc=$enableval,
ea858b4
-	enable_tirpc=no)
ea858b4
+	enable_tirpc='yes')
ea858b4
 AC_ARG_ENABLE(ipv6,
ea858b4
 	[AC_HELP_STRING([--enable-ipv6],
ea858b4
                         [enable support for IPv6 @<:@default=no@:>@])],
ea858b4
diff --git a/support/nfs/closeall.c b/support/nfs/closeall.c
ea858b4
index cc7fb3b..38fb162 100644
ea858b4
--- a/support/nfs/closeall.c
ea858b4
+++ b/support/nfs/closeall.c
ea858b4
@@ -7,19 +7,24 @@
ea858b4
 #include <unistd.h>
ea858b4
 #include <stdlib.h>
ea858b4
 #include <dirent.h>
ea858b4
+#include <errno.h>
ea858b4
 
ea858b4
 void
ea858b4
 closeall(int min)
ea858b4
 {
ea858b4
+	char *endp;
ea858b4
+	long n;
ea858b4
 	DIR *dir = opendir("/proc/self/fd");
ea858b4
+
ea858b4
 	if (dir != NULL) {
ea858b4
 		int dfd = dirfd(dir);
ea858b4
 		struct dirent *d;
ea858b4
 
ea858b4
 		while ((d = readdir(dir)) != NULL) {
ea858b4
-			char *endp;
ea858b4
-			long n = strtol(d->d_name, &endp, 10);
ea858b4
-			if (*endp != '\0' && n >= min && n != dfd)
ea858b4
+			errno = 0;
ea858b4
+			n = strtol(d->d_name, &endp, 10);
ea858b4
+			if (!errno && *endp == '\0' && endp != d->d_name &&
ea858b4
+			    n >= min && n != dfd)
ea858b4
 				(void) close(n);
ea858b4
 		}
ea858b4
 		closedir(dir);
ea858b4
diff --git a/utils/gssd/gssd.c b/utils/gssd/gssd.c
ea858b4
index f6949db..40a2b4d 100644
ea858b4
--- a/utils/gssd/gssd.c
ea858b4
+++ b/utils/gssd/gssd.c
ea858b4
@@ -171,6 +171,8 @@ main(int argc, char *argv[])
ea858b4
 
ea858b4
 	initerr(progname, verbosity, fg);
ea858b4
 #ifdef HAVE_AUTHGSS_SET_DEBUG_LEVEL
ea858b4
+	if (verbosity && rpc_verbosity == 0)
ea858b4
+		rpc_verbosity = verbosity;
ea858b4
 	authgss_set_debug_level(rpc_verbosity);
ea858b4
 #else
ea858b4
         if (rpc_verbosity > 0)
ea858b4
diff --git a/utils/gssd/svcgssd.c b/utils/gssd/svcgssd.c
ea858b4
index 6ca0e8d..69d2a69 100644
ea858b4
--- a/utils/gssd/svcgssd.c
ea858b4
+++ b/utils/gssd/svcgssd.c
ea858b4
@@ -208,6 +208,8 @@ main(int argc, char *argv[])
ea858b4
 
ea858b4
 	initerr(progname, verbosity, fg);
ea858b4
 #ifdef HAVE_AUTHGSS_SET_DEBUG_LEVEL
ea858b4
+	if (verbosity && rpc_verbosity == 0)
ea858b4
+		rpc_verbosity = verbosity;
ea858b4
 	authgss_set_debug_level(rpc_verbosity);
ea858b4
 #else
ea858b4
 	if (rpc_verbosity > 0)
ea858b4
@@ -215,6 +217,8 @@ main(int argc, char *argv[])
ea858b4
 			    "support setting debug level\n");
ea858b4
 #endif
ea858b4
 #ifdef HAVE_NFS4_SET_DEBUG
ea858b4
+		if (verbosity && idmap_verbosity == 0)
ea858b4
+			idmap_verbosity = verbosity;
ea858b4
         nfs4_set_debug(idmap_verbosity, NULL);
ea858b4
 #else
ea858b4
 	if (idmap_verbosity > 0)
ea858b4
diff --git a/utils/mountd/mountd.c b/utils/mountd/mountd.c
ea858b4
index 25d292b..b59f939 100644
ea858b4
--- a/utils/mountd/mountd.c
ea858b4
+++ b/utils/mountd/mountd.c
ea858b4
@@ -467,8 +467,12 @@ get_rootfh(struct svc_req *rqstp, dirpath *path, nfs_export **expret,
ea858b4
 			return NULL;
ea858b4
 		}
ea858b4
 	} else {
ea858b4
-		if (exp->m_exported<1)
ea858b4
+		int did_export = 0;
ea858b4
+	retry:
ea858b4
+		if (exp->m_exported<1) {
ea858b4
 			export_export(exp);
ea858b4
+			did_export = 1;
ea858b4
+		}
ea858b4
 		if (!exp->m_xtabent)
ea858b4
 			xtab_append(exp);
ea858b4
 
ea858b4
@@ -482,6 +486,11 @@ get_rootfh(struct svc_req *rqstp, dirpath *path, nfs_export **expret,
ea858b4
 				fh = getfh_old ((struct sockaddr *) sin,
ea858b4
 						stb.st_dev, stb.st_ino);
ea858b4
 		}
ea858b4
+		if (fh == NULL && !did_export) {
ea858b4
+			exp->m_exported = 0;
ea858b4
+			goto retry;
ea858b4
+		}
ea858b4
+
ea858b4
 		if (fh == NULL) {
ea858b4
 			xlog(L_WARNING, "getfh failed: %s", strerror(errno));
ea858b4
 			*error = NFSERR_ACCES;