]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
mount: silently fails when bad option values are given
authorSteve Dickson <steved@redhat.com>
Thu, 3 Jun 2010 12:32:56 +0000 (08:32 -0400)
committerSteve Dickson <steved@redhat.com>
Tue, 22 Jun 2010 13:52:43 +0000 (09:52 -0400)
mount.nfs should not only fail when an invalid option values
are supplied (as it does), it should also print a diagnostic
message identifying the problem

Signed-off-by: Steve Dickson <steved@redhat.com>
utils/mount/network.c
utils/mount/nfsumount.c

index c5412574a1e2b1b642d3a52ce656e1aec941f5a4..d9903ed44c492cc3fccedfa04ea2b38ab5a3b83f 100644 (file)
@@ -1212,6 +1212,8 @@ nfs_nfs_program(struct mount_options *options, unsigned long *program)
                        return 1;
                }
        case PO_BAD_VALUE:
+               nfs_error(_("%s: invalid value for 'nfsprog=' option"),
+                               progname);
                return 0;
        }
 
@@ -1251,9 +1253,12 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)
                        }
                        return 0;
                case PO_NOT_FOUND:
-                       nfs_error(_("%s: option parsing error\n"),
+                       nfs_error(_("%s: parsing error on 'vers=' option\n"),
                                        progname);
+                       return 0;
                case PO_BAD_VALUE:
+                       nfs_error(_("%s: invalid value for 'vers=' option"),
+                                       progname);
                        return 0;
                }
        case 4: /* nfsvers */
@@ -1265,9 +1270,12 @@ nfs_nfs_version(struct mount_options *options, unsigned long *version)
                        }
                        return 0;
                case PO_NOT_FOUND:
-                       nfs_error(_("%s: option parsing error\n"),
+                       nfs_error(_("%s: parsing error on 'nfsvers=' option\n"),
                                        progname);
+                       return 0;
                case PO_BAD_VALUE:
+                       nfs_error(_("%s: invalid value for 'nfsvers=' option"),
+                                       progname);
                        return 0;
                }
        }
@@ -1336,6 +1344,8 @@ nfs_nfs_port(struct mount_options *options, unsigned long *port)
                        return 1;
                }
        case PO_BAD_VALUE:
+               nfs_error(_("%s: invalid value for 'port=' option"),
+                               progname);
                return 0;
        }
 
@@ -1423,6 +1433,8 @@ nfs_mount_program(struct mount_options *options, unsigned long *program)
                        return 1;
                }
        case PO_BAD_VALUE:
+               nfs_error(_("%s: invalid value for 'mountprog=' option"),
+                               progname);
                return 0;
        }
 
@@ -1452,6 +1464,8 @@ nfs_mount_version(struct mount_options *options, unsigned long *version)
                        return 1;
                }
        case PO_BAD_VALUE:
+               nfs_error(_("%s: invalid value for 'mountvers=' option"),
+                               progname);
                return 0;
        }
 
@@ -1510,6 +1524,8 @@ nfs_mount_port(struct mount_options *options, unsigned long *port)
                        return 1;
                }
        case PO_BAD_VALUE:
+               nfs_error(_("%s: invalid value for 'mountport=' option"),
+                               progname);
                return 0;
        }
 
index 9d798a2ff347513779b646b88692ae873844b158..151434050d68641e189b6877174dceb50b215f4c 100644 (file)
@@ -179,10 +179,8 @@ static int nfs_umount_do_umnt(struct mount_options *options,
        struct pmap nfs_pmap, mnt_pmap;
        sa_family_t family;
 
-       if (!nfs_options2pmap(options, &nfs_pmap, &mnt_pmap)) {
-               nfs_error(_("%s: bad mount options"), progname);
+       if (!nfs_options2pmap(options, &nfs_pmap, &mnt_pmap))
                return EX_FAIL;
-       }
 
        /* Skip UMNT call for vers=4 mounts */
        if (nfs_pmap.pm_vers == 4)