]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
mount.nfs: Configuration file parser ignoring options
authorSteve Dickson <steved@redhat.com>
Wed, 20 Jan 2010 20:05:46 +0000 (15:05 -0500)
committerSteve Dickson <steved@redhat.com>
Wed, 20 Jan 2010 20:05:46 +0000 (15:05 -0500)
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@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mount/configfile.c

index 28b722c7e101034fe9fde2a7039b221c69dd29eb..1dd4159a74b97d1ef48a762c7c9143cb07216f82 100644 (file)
@@ -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;
 }