Commit 9b9d6b24 authored by Jeff Layton's avatar Jeff Layton Committed by Steve French

cifs: reinstate original behavior when uid=/gid= options are specified

This patch fixes the regression reported here:

http://bugzilla.kernel.org/show_bug.cgi?id=13861

commit 4ae1507f changed the default
behavior when the uid= or gid= option was specified for a mount. The
existing behavior was to always clobber the ownership information
provided by the server when these options were specified. The above
commit changed this behavior so that these options simply provided
defaults when the server did not provide this information (unless
"forceuid" or "forcegid" were specified)

This patch reverts this change so that the default behavior is restored.
It also adds "noforceuid" and "noforcegid" options to make it so that
ownership information from the server is preserved, even when the mount
has uid= or gid= options specified.

It also adds a couple of printk notices that pop up when forceuid or
forcegid options are specified without a uid= or gid= option.
Reported-by: default avatarTom Chiverton <bugzilla.kernel.org@falkensweb.com>
Reviewed-by: default avatarShirish Pargaonkar <shirishp@us.ibm.com>
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 5bd9052d
...@@ -803,6 +803,10 @@ cifs_parse_mount_options(char *options, const char *devname, ...@@ -803,6 +803,10 @@ cifs_parse_mount_options(char *options, const char *devname,
char *data; char *data;
unsigned int temp_len, i, j; unsigned int temp_len, i, j;
char separator[2]; char separator[2];
short int override_uid = -1;
short int override_gid = -1;
bool uid_specified = false;
bool gid_specified = false;
separator[0] = ','; separator[0] = ',';
separator[1] = 0; separator[1] = 0;
...@@ -1093,18 +1097,20 @@ cifs_parse_mount_options(char *options, const char *devname, ...@@ -1093,18 +1097,20 @@ cifs_parse_mount_options(char *options, const char *devname,
"too long.\n"); "too long.\n");
return 1; return 1;
} }
} else if (strnicmp(data, "uid", 3) == 0) { } else if (!strnicmp(data, "uid", 3) && value && *value) {
if (value && *value) vol->linux_uid = simple_strtoul(value, &value, 0);
vol->linux_uid = uid_specified = true;
simple_strtoul(value, &value, 0); } else if (!strnicmp(data, "forceuid", 8)) {
} else if (strnicmp(data, "forceuid", 8) == 0) { override_uid = 1;
vol->override_uid = 1; } else if (!strnicmp(data, "noforceuid", 10)) {
} else if (strnicmp(data, "gid", 3) == 0) { override_uid = 0;
if (value && *value) } else if (!strnicmp(data, "gid", 3) && value && *value) {
vol->linux_gid = vol->linux_gid = simple_strtoul(value, &value, 0);
simple_strtoul(value, &value, 0); gid_specified = true;
} else if (strnicmp(data, "forcegid", 8) == 0) { } else if (!strnicmp(data, "forcegid", 8)) {
vol->override_gid = 1; override_gid = 1;
} else if (!strnicmp(data, "noforcegid", 10)) {
override_gid = 0;
} else if (strnicmp(data, "file_mode", 4) == 0) { } else if (strnicmp(data, "file_mode", 4) == 0) {
if (value && *value) { if (value && *value) {
vol->file_mode = vol->file_mode =
...@@ -1355,6 +1361,18 @@ cifs_parse_mount_options(char *options, const char *devname, ...@@ -1355,6 +1361,18 @@ cifs_parse_mount_options(char *options, const char *devname,
if (vol->UNCip == NULL) if (vol->UNCip == NULL)
vol->UNCip = &vol->UNC[2]; vol->UNCip = &vol->UNC[2];
if (uid_specified)
vol->override_uid = override_uid;
else if (override_uid == 1)
printk(KERN_NOTICE "CIFS: ignoring forceuid mount option "
"specified with no uid= option.\n");
if (gid_specified)
vol->override_gid = override_gid;
else if (override_gid == 1)
printk(KERN_NOTICE "CIFS: ignoring forcegid mount option "
"specified with no gid= option.\n");
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment