summaryrefslogtreecommitdiffstats
path: root/utils/mount/stropts.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2009-07-14 16:34:20 -0400
committerSteve Dickson <steved@redhat.com>2009-07-14 16:34:20 -0400
commit19ba81f64447dca205362a119f1e72701438aecc (patch)
tree2251c60ffeed9c867488152a4e1f8ee9b1b05d29 /utils/mount/stropts.c
parent3fc80f43ffb272036188d070a01090bbf243b7b5 (diff)
downloadnfs-utils-19ba81f64447dca205362a119f1e72701438aecc.tar.gz
nfs-utils-19ba81f64447dca205362a119f1e72701438aecc.tar.xz
nfs-utils-19ba81f64447dca205362a119f1e72701438aecc.zip
mount.nfs: make nfs_options2pmap return errors
Up until now, nfs_options2pmap() has been passed mount options that have already gone through the kernel's parser successfully. So, it never had to check for invalid mount option values. However, we are about to pass it options that come right from the user. So nfs_options2pmap() will now need to report an error and fail if it encounters a bogus value for any of the options it cares about. ===== Note that nfs_options2pmap() will allow a bogus value for an option if the same option is specified farther to the right with a useable value. For example, if a user specifies "proto=foo,...,tcp" then nfs_options2pmap() uses "tcp" and ignores "proto=foo". However, if the options are specified in the other order: "tcp,...,proto=foo" then nfs_options2pmap() will fail. This is a simple and unambiguous extension of the "rightmost wins" rule. Since mount.nfs strips out these options out and replaces them with the rpcbind-negotiated options before invoking mount(2), the kernel should never receive bogus values for these options from mount.nfs in such cases. This is probably slightly more flexible behavior than the legacy mount implementation, but should be harmless. All mount options unrelated to pmap are ignored by nfs_options2pmap(). Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
Diffstat (limited to 'utils/mount/stropts.c')
-rw-r--r--utils/mount/stropts.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index ec95b78..30ac5ae 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -450,7 +450,10 @@ static struct mount_options *nfs_rewrite_mount_options(char *str)
goto err;
}
- nfs_options2pmap(options, &nfs_pmap, &mnt_pmap);
+ if (!nfs_options2pmap(options, &nfs_pmap, &mnt_pmap)) {
+ errno = EINVAL;
+ goto err;
+ }
/* The kernel NFS client doesn't support changing the RPC program
* number for these services, so reset these fields before probing