X-Git-Url: https://git.decadent.org.uk/gitweb/?p=nfs-utils.git;a=blobdiff_plain;f=utils%2Fmount%2Fstropts.c;h=a0b9e7fdf80a0f8967bda37c05b1ee34444769a0;hp=4c9ee17b95ba9554f00dfb77966bb34255bdd111;hb=2498a68b1bec01d0ee8a63962b314140e8289036;hpb=e4328bb8d13ae6dda33308557e6bbb352d5674bb diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c index 4c9ee17..a0b9e7f 100644 --- a/utils/mount/stropts.c +++ b/utils/mount/stropts.c @@ -611,6 +611,18 @@ static int nfs_try_mount_v4(struct nfsmount_info *mi) } if (mi->version == 0) { + if (po_contains(options, "mounthost") || + po_contains(options, "mountaddr") || + po_contains(options, "mountvers") || + po_contains(options, "mountproto")) { + /* + * Since these mountd options are set assume version 3 + * is wanted so error out with EPROTONOSUPPORT so the + * protocol negation starts with v3. + */ + errno = EPROTONOSUPPORT; + goto out_fail; + } if (po_append(options, "vers=4") == PO_FAILED) { errno = EINVAL; goto out_fail; @@ -621,12 +633,13 @@ static int nfs_try_mount_v4(struct nfsmount_info *mi) errno = EINVAL; goto out_fail; } + /* * Update option string to be recorded in /etc/mtab. */ if (po_join(options, mi->extra_opts) == PO_FAILED) { errno = ENOMEM; - return 0; + goto out_fail; } result = nfs_sys_mount(mi, options);