Skip to content

Commit 270d73e

Browse files
scottmayhewSteve French
authored andcommitted
smb: client: fix null auth
Commit abdb174 removed code that clears ctx->username when sec=none, so attempting to mount with '-o sec=none' now fails with -EACCES. Fix it by adding that logic to the parsing of the 'sec' option, as well as checking if the mount is using null auth before setting the username when parsing the 'user' option. Fixes: abdb174 ("cifs: get rid of mount options string parsing") Cc: stable@vger.kernel.org Signed-off-by: Scott Mayhew <smayhew@redhat.com> Reviewed-by: Paulo Alcantara (SUSE) <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 2d7b8c6 commit 270d73e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/smb/client/fs_context.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,8 @@ cifs_parse_security_flavors(struct fs_context *fc, char *value, struct smb3_fs_c
231231
break;
232232
case Opt_sec_none:
233233
ctx->nullauth = 1;
234+
kfree(ctx->username);
235+
ctx->username = NULL;
234236
break;
235237
default:
236238
cifs_errorf(fc, "bad security option: %s\n", value);
@@ -1201,6 +1203,8 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
12011203
case Opt_user:
12021204
kfree(ctx->username);
12031205
ctx->username = NULL;
1206+
if (ctx->nullauth)
1207+
break;
12041208
if (strlen(param->string) == 0) {
12051209
/* null user, ie. anonymous authentication */
12061210
ctx->nullauth = 1;

0 commit comments

Comments
 (0)