@@ -100,7 +100,6 @@ static const char *nfs_version_opttbl[] = {
"v4",
"vers",
"nfsvers",
- "minorversion",
NULL,
};
@@ -1291,17 +1290,19 @@ nfs_nfs_version(char *type, struct mount_options *options, struct nfs_version *v
if (!version_val)
goto ret_error;
- if (!(version->major = strtol(version_val, &cptr, 10)))
+ version->major = strtol(version_val, &cptr, 10);
+ if (cptr == version_val || (*cptr && *cptr != '.'))
goto ret_error;
-
- if (strcmp(nfs_version_opttbl[i], "minorversion") == 0) {
+ if (version->major == 4 && *cptr != '.' &&
+ (version_val = po_get(options, "minorversion")) != NULL) {
+ version->minor = strtol(version_val, &cptr, 10);
+ i = -1;
+ if (*cptr)
+ goto ret_error;
version->v_mode = V_SPECIFIC;
- version->minor = version->major;
- version->major = 4;
} else if (version->major < 4)
version->v_mode = V_SPECIFIC;
-
- if (*cptr == '.') {
+ else if (*cptr == '.') {
version_val = ++cptr;
if (!(version->minor = strtol(version_val, &cptr, 10)) && cptr == version_val)
goto ret_error;
@@ -1315,7 +1316,10 @@ nfs_nfs_version(char *type, struct mount_options *options, struct nfs_version *v
return 1;
ret_error:
- if (i <= 2 ) {
+ if (i < 0) {
+ nfs_error(_("%s: parsing error on 'minorversion=' option"),
+ progname);
+ } else if (i <= 2 ) {
nfs_error(_("%s: parsing error on 'v' option"),
progname);
} else if (i == 3 ) {
1/ minorversion=0 is not recognized, as errors from strtol() are not correctly detected. 2/ when there is an error in the minorversion= value, no message is presented. 3/ Current code recognizes "minorversion" and sets V_SPECIFIC, but then because *cptr == '\0', the v_mode is reset to V_GENERAL. This results in minorversion negotiation, which is not wanted. This patch addresses all of these. Signed-off-by: NeilBrown <neilb@suse.com> --- utils/mount/network.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html