Skip to contentSkip to conversation

mount.nfs: Configuration file parser ignoring options

PATCH In review Steve Dickson 1 participant 2 messages Jan 18, 2010 – Jan 20, 2010 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mount.nfs: Configuration file parser ignoring options

Author: Steve Dickson <[email protected]>
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.

utils/mount/configfile.c renamed from utils/mount/configfile.c.orig +21 -5
diff -up nfs-utils-1.2.1/utils/mount/configfile.c.orig nfs-utils-1.2.1/utils/mount/configfile.c
@@ -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;
 }