mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-28 21:33:52 +00:00
cifs: reinstate original behavior again for forceuid/forcegid
[ Upstream commit77d8aa79ec
] forceuid/forcegid should be enabled by default when uid=/gid= options are specified, but commit24e0a1eff9
("cifs: switch to new mount api") changed the behavior. Due to the change, a mounted share does not show intentional uid/gid for files and directories even though uid=/gid= options are specified since forceuid/forcegid are not enabled. This patch reinstates original behavior that overrides uid/gid with specified uid/gid by the options. Fixes:24e0a1eff9
("cifs: switch to new mount api") Signed-off-by: Takayuki Nagata <tnagata@redhat.com> Acked-by: Paulo Alcantara (Red Hat) <pc@manguebit.com> Acked-by: Ronnie Sahlberg <lsahlber@redhat.com> Acked-by: Tom Talpey <tom@talpey.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
9055500f3b
commit
eca7aaaa9e
2 changed files with 14 additions and 0 deletions
|
@ -715,6 +715,16 @@ static int smb3_fs_context_validate(struct fs_context *fc)
|
||||||
/* set the port that we got earlier */
|
/* set the port that we got earlier */
|
||||||
cifs_set_port((struct sockaddr *)&ctx->dstaddr, ctx->port);
|
cifs_set_port((struct sockaddr *)&ctx->dstaddr, ctx->port);
|
||||||
|
|
||||||
|
if (ctx->uid_specified && !ctx->forceuid_specified) {
|
||||||
|
ctx->override_uid = 1;
|
||||||
|
pr_notice("enabling forceuid mount option implicitly because uid= option is specified\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ctx->gid_specified && !ctx->forcegid_specified) {
|
||||||
|
ctx->override_gid = 1;
|
||||||
|
pr_notice("enabling forcegid mount option implicitly because gid= option is specified\n");
|
||||||
|
}
|
||||||
|
|
||||||
if (ctx->override_uid && !ctx->uid_specified) {
|
if (ctx->override_uid && !ctx->uid_specified) {
|
||||||
ctx->override_uid = 0;
|
ctx->override_uid = 0;
|
||||||
pr_notice("ignoring forceuid mount option specified with no uid= option\n");
|
pr_notice("ignoring forceuid mount option specified with no uid= option\n");
|
||||||
|
@ -984,12 +994,14 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
|
||||||
ctx->override_uid = 0;
|
ctx->override_uid = 0;
|
||||||
else
|
else
|
||||||
ctx->override_uid = 1;
|
ctx->override_uid = 1;
|
||||||
|
ctx->forceuid_specified = true;
|
||||||
break;
|
break;
|
||||||
case Opt_forcegid:
|
case Opt_forcegid:
|
||||||
if (result.negated)
|
if (result.negated)
|
||||||
ctx->override_gid = 0;
|
ctx->override_gid = 0;
|
||||||
else
|
else
|
||||||
ctx->override_gid = 1;
|
ctx->override_gid = 1;
|
||||||
|
ctx->forcegid_specified = true;
|
||||||
break;
|
break;
|
||||||
case Opt_perm:
|
case Opt_perm:
|
||||||
if (result.negated)
|
if (result.negated)
|
||||||
|
|
|
@ -156,6 +156,8 @@ enum cifs_param {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct smb3_fs_context {
|
struct smb3_fs_context {
|
||||||
|
bool forceuid_specified;
|
||||||
|
bool forcegid_specified;
|
||||||
bool uid_specified;
|
bool uid_specified;
|
||||||
bool cruid_specified;
|
bool cruid_specified;
|
||||||
bool gid_specified;
|
bool gid_specified;
|
||||||
|
|
Loading…
Reference in a new issue