|
|
1e08c0 |
commit 845c87b67b7bfd60127e23d1df93a94ceb9d3d18
|
|
|
1e08c0 |
Author: NeilBrown <neilb@suse.com>
|
|
|
1e08c0 |
Date: Wed Jul 26 13:51:51 2017 -0400
|
|
|
1e08c0 |
|
|
|
1e08c0 |
mount: Fix problems with parsing minorversion=
|
|
|
1e08c0 |
|
|
|
1e08c0 |
1/ minorversion=0 is not recognized, as errors from
|
|
|
1e08c0 |
strtol() are not correctly detected.
|
|
|
1e08c0 |
2/ when there is an error in the minorversion= value,
|
|
|
1e08c0 |
no message is presented.
|
|
|
1e08c0 |
3/ Current code recognizes "minorversion" and sets V_SPECIFIC,
|
|
|
1e08c0 |
but then because *cptr == '\0', the v_mode is reset to V_GENERAL.
|
|
|
1e08c0 |
This results in minorversion negotiation, which is not wanted.
|
|
|
1e08c0 |
|
|
|
1e08c0 |
This patch addresses all of these.
|
|
|
1e08c0 |
|
|
|
1e08c0 |
Signed-off-by: NeilBrown <neilb@suse.com>
|
|
|
1e08c0 |
Signed-off-by: Steve Dickson <steved@redhat.com>
|
|
|
1e08c0 |
(cherry picked from commit 050153ef6a86ff5ab06ef65be36336824a323779)
|
|
|
1e08c0 |
|
|
|
1e08c0 |
diff --git a/utils/mount/network.c b/utils/mount/network.c
|
|
|
1e08c0 |
index b2e4374..b64c526 100644
|
|
|
1e08c0 |
--- a/utils/mount/network.c
|
|
|
1e08c0 |
+++ b/utils/mount/network.c
|
|
|
1e08c0 |
@@ -1283,13 +1283,19 @@ nfs_nfs_version(struct mount_options *options, struct nfs_version *version)
|
|
|
1e08c0 |
if (!version_val)
|
|
|
1e08c0 |
goto ret_error;
|
|
|
1e08c0 |
|
|
|
1e08c0 |
- if (!(version->major = strtol(version_val, &cptr, 10)))
|
|
|
1e08c0 |
+ version->major = strtol(version_val, &cptr, 10);
|
|
|
1e08c0 |
+ if (cptr == version_val || (*cptr && *cptr != '.'))
|
|
|
1e08c0 |
goto ret_error;
|
|
|
1e08c0 |
-
|
|
|
1e08c0 |
- if (version->major < 4)
|
|
|
1e08c0 |
+ if (version->major == 4 && *cptr != '.' &&
|
|
|
1e08c0 |
+ (version_val = po_get(options, "minorversion")) != NULL) {
|
|
|
1e08c0 |
+ version->minor = strtol(version_val, &cptr, 10);
|
|
|
1e08c0 |
+ i = -1;
|
|
|
1e08c0 |
+ if (*cptr)
|
|
|
1e08c0 |
+ goto ret_error;
|
|
|
1e08c0 |
version->v_mode = V_SPECIFIC;
|
|
|
1e08c0 |
-
|
|
|
1e08c0 |
- if (*cptr == '.') {
|
|
|
1e08c0 |
+ } else if (version->major < 4)
|
|
|
1e08c0 |
+ version->v_mode = V_SPECIFIC;
|
|
|
1e08c0 |
+ else if (*cptr == '.') {
|
|
|
1e08c0 |
version_val = ++cptr;
|
|
|
1e08c0 |
if (!(version->minor = strtol(version_val, &cptr, 10)) && cptr == version_val)
|
|
|
1e08c0 |
goto ret_error;
|
|
|
1e08c0 |
@@ -1303,7 +1309,10 @@ nfs_nfs_version(struct mount_options *options, struct nfs_version *version)
|
|
|
1e08c0 |
return 1;
|
|
|
1e08c0 |
|
|
|
1e08c0 |
ret_error:
|
|
|
1e08c0 |
- if (i <= 2 ) {
|
|
|
1e08c0 |
+ if (i < 0) {
|
|
|
1e08c0 |
+ nfs_error(_("%s: parsing error on 'minorversion=' option"),
|
|
|
1e08c0 |
+ progname);
|
|
|
1e08c0 |
+ } else if (i <= 2 ) {
|
|
|
1e08c0 |
nfs_error(_("%s: parsing error on 'v' option"),
|
|
|
1e08c0 |
progname);
|
|
|
1e08c0 |
} else if (i == 3 ) {
|