nfs-utils/nfs-utils-1.2.0-mntconf-vers.patch
Steve Dickson 2f3279563d - Change the nfsmount.conf file to define v3 as the default protocol
version.
- Make sure versions set on the command line override version set in
    nfsmount.conf
- Make version rollbacks still work when versions are set in nfsmount.conf
2009-10-01 11:50:39 +00:00

37 lines
1.1 KiB
Diff

diff -up nfs-utils-1.2.0/utils/mount/configfile.c.orig nfs-utils-1.2.0/utils/mount/configfile.c
--- nfs-utils-1.2.0/utils/mount/configfile.c.orig 2009-09-30 11:38:53.745992000 -0400
+++ nfs-utils-1.2.0/utils/mount/configfile.c 2009-09-30 13:49:38.480625000 -0400
@@ -185,6 +185,19 @@ 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 (strcasecmp(field, "nfsvers") == 0 ||
+ strcasecmp(field, "vers") == 0) {
+ for (i=0; versions[i]; i++)
+ if (strncasecmp(mopt, versions[i], strlen(versions[i])) == 0)
+ return 1;
+ }
+ return 0;
+}
/*
* Parse the given section of the configuration
* file to if there are any mount options set.
@@ -207,6 +220,12 @@ conf_parse_mntopts(char *section, char *
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';