summaryrefslogtreecommitdiffstats
path: root/utils/mount/configfile.c
diff options
context:
space:
mode:
authorSteve Dickson <steved@redhat.com>2009-10-09 09:19:39 -0400
committerSteve Dickson <steved@redhat.com>2009-10-09 09:19:39 -0400
commit2091bc67253d6dc1f68dba2218593701bfc729c0 (patch)
tree728020da4431ceec81e52dda6b4f5bb543fe9da1 /utils/mount/configfile.c
parent0e0526cce8127f1c18063ff700f5e4d5c77dc108 (diff)
downloadnfs-utils-2091bc67253d6dc1f68dba2218593701bfc729c0.tar.gz
nfs-utils-2091bc67253d6dc1f68dba2218593701bfc729c0.tar.xz
nfs-utils-2091bc67253d6dc1f68dba2218593701bfc729c0.zip
There are a number of different mount options that can be
used to set the protocol version on the command line. The config file code needs to know about each option so the command line value will override the config file value. Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/mount/configfile.c')
-rw-r--r--utils/mount/configfile.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/utils/mount/configfile.c b/utils/mount/configfile.c
index e347b0e..b0aa6f0 100644
--- a/utils/mount/configfile.c
+++ b/utils/mount/configfile.c
@@ -185,6 +185,20 @@ void free_all(void)
free(entry);
}
}
+static char *versions[] = {"v2", "v3", "v4", "vers", "nfsvers", NULL};
+int inline check_vers(char *mopt, char *field)
+{
+ int i;
+
+ if (strncmp("mountvers", field, strlen("mountvers") != 0 &&
+ (strcasecmp(field, "nfsvers") == 0 ||
+ strcasecmp(field, "vers") == 0))) {
+ for (i=0; versions[i]; i++)
+ if (strcasestr(mopt, versions[i]) != NULL)
+ return 1;
+ }
+ return 0;
+}
/*
* Parse the given section of the configuration
* file to if there are any mount options set.
@@ -207,6 +221,12 @@ conf_parse_mntopts(char *section, char *arg, char *opts)
snprintf(buf, BUFSIZ, "%s=", node->field);
if (opts && strcasestr(opts, buf) != NULL)
continue;
+ /*
+ * Protocol verions can be set in a number of ways
+ */
+ if (opts && check_vers(opts, node->field))
+ continue;
+
if (lookup_entry(node->field) != NULL)
continue;
buf[0] = '\0';