[PATCH] mount.nfs: Configuration file parser ignoring options

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Author: Steve Dickson <steved@xxxxxxxxxx>
Date:   Mon Jan 18 16:45:26 EST 2010

    mount.nfs: Configuration file parser ignoring options

    When the protocol version is set on the command line,
    none of the variables set in the configuration file
    are passed down to the kernel due to a bug in the 
    parsing routine. 

Tested-by: Jeff Layton <jlayton@xxxxxxxxxx>
Signed-off-by: Steve Dickson <steved@xxxxxxxxxx>

diff -up nfs-utils-1.2.1/utils/mount/configfile.c.orig nfs-utils-1.2.1/utils/mount/configfile.c
--- nfs-utils-1.2.1/utils/mount/configfile.c.orig	2009-11-04 06:13:56.000000000 -0500
+++ nfs-utils-1.2.1/utils/mount/configfile.c	2010-01-18 15:39:02.973739055 -0500
@@ -194,13 +194,29 @@ void free_all(void)
 static char *versions[] = {"v2", "v3", "v4", "vers", "nfsvers", NULL};
 int inline check_vers(char *mopt, char *field)
 {
-	int i;
+	int i, found=0;
 
-	if (strncmp("mountvers", field, strlen("mountvers")) != 0) {
-		for (i=0; versions[i]; i++) 
-			if (strcasestr(mopt, versions[i]) != NULL)
-				return 1;
+	/*
+	 * First check to see if the config setting is one 
+	 * of the many version settings
+	 */
+	for (i=0; versions[i]; i++) { 
+		if (strcasestr(field, versions[i]) != NULL) {
+			found++;
+			break;
+		}
+	}
+	if (!found)
+		return 0;
+	/*
+	 * It appears the version is being set, now see
+	 * if the version appears on the command 
+	 */
+	for (i=0; versions[i]; i++)  {
+		if (strcasestr(mopt, versions[i]) != NULL)
+			return 1;
 	}
+
 	return 0;
 }
 
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux