summaryrefslogtreecommitdiffstats
path: root/libmount/src/optstr.c
diff options
context:
space:
mode:
authorKarel Zak2012-06-14 14:19:26 +0200
committerKarel Zak2012-06-14 14:19:26 +0200
commite90e7401d0c318c9dac4a0204e2bca86949b1d32 (patch)
tree3829ed0ca2c3c46e71259116e2fbfaaa0773c6b8 /libmount/src/optstr.c
parentlibmount: don't generate empty option strings (diff)
downloadkernel-qcow2-util-linux-e90e7401d0c318c9dac4a0204e2bca86949b1d32.tar.gz
kernel-qcow2-util-linux-e90e7401d0c318c9dac4a0204e2bca86949b1d32.tar.xz
kernel-qcow2-util-linux-e90e7401d0c318c9dac4a0204e2bca86949b1d32.zip
libmount: don't use nosuid,noexec,nodev for cifs user=foo
mount -t cifs //127.0.0.1/users /mnt/smb -o user=root,password=linux is incorrectly translated to mount.cifs -o noexec,nosuid,nodev,user=root,password=linux ... The command mount(8) should be sensitive to "user" (without "=<name>") only. The correct cifs command line is: mount.cifs -o user=root,password=linux Addresses: https://bugzilla.novell.com/show_bug.cgi?id=766157 Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libmount/src/optstr.c')
-rw-r--r--libmount/src/optstr.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/libmount/src/optstr.c b/libmount/src/optstr.c
index ca1b2e2c7..c8beadad2 100644
--- a/libmount/src/optstr.c
+++ b/libmount/src/optstr.c
@@ -586,7 +586,7 @@ int mnt_optstr_get_flags(const char *optstr, unsigned long *flags,
{
struct libmnt_optmap const *maps[2];
char *name, *str = (char *) optstr;
- size_t namesz = 0;
+ size_t namesz = 0, valsz = 0;
int nmaps = 0;
assert(optstr);
@@ -603,7 +603,7 @@ int mnt_optstr_get_flags(const char *optstr, unsigned long *flags,
*/
maps[nmaps++] = mnt_get_builtin_optmap(MNT_USERSPACE_MAP);
- while(!mnt_optstr_next_option(&str, &name, &namesz, NULL, NULL)) {
+ while(!mnt_optstr_next_option(&str, &name, &namesz, NULL, &valsz)) {
const struct libmnt_optmap *ent;
const struct libmnt_optmap *m;
@@ -617,9 +617,10 @@ int mnt_optstr_get_flags(const char *optstr, unsigned long *flags,
else
*flags |= ent->id;
- } else if (nmaps == 2 && m == maps[1]) {
+ } else if (nmaps == 2 && m == maps[1] && valsz == 0) {
/*
- * Special case -- translate "user" to MS_ options
+ * Special case -- translate "user" (but no user=) to
+ * MS_ options
*/
if (ent->mask & MNT_INVERT)
continue;