Made minor updates to the patch (white space cleanup that checkpatch spotted) and added the RB (see attached) Merged into github smb3-utils for-next branch and also to cifs-utils samba.org for-next https://git.samba.org/?p=cifs-utils.git;a=shortlog;h=refs/heads/for-next On Sat, Mar 15, 2025 at 2:09 AM Meetakshi Setiya <meetakshisetiyaoss@xxxxxxxxx> wrote: > > Thanks Paulo, created a PR for cifs-utils based on your suggestion > https://github.com/smfrench/smb3-utils/pull/14 > > Thanks > Meetakshi > > On Wed, Mar 12, 2025 at 9:53 PM Paulo Alcantara <pc@xxxxxxxxxxxxx> wrote: > > > > Steve French <smfrench@xxxxxxxxx> writes: > > > > > Meetakshi sent a patch idea to try (to also fix this in cifs-utils) - > > > will take a look > > > > Where is the patch? > > > > Something like below would work > > > > diff --git a/mount.cifs.c b/mount.cifs.c > > index 7605130..16730c6 100644 > > --- a/mount.cifs.c > > +++ b/mount.cifs.c > > @@ -200,6 +200,7 @@ struct parsed_mount_info { > > unsigned int got_domain:1; > > unsigned int is_krb5:1; > > unsigned int is_noauth:1; > > + unsigned int is_guest:1; > > uid_t sudo_uid; > > }; > > > > @@ -1161,6 +1162,7 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) > > parsed_info->got_user = 1; > > parsed_info->got_password = 1; > > parsed_info->got_password2 = 1; > > + parsed_info->is_guest = 1; > > goto nocopy; > > case OPT_RO: > > *filesys_flags |= MS_RDONLY; > > @@ -2334,7 +2336,9 @@ mount_retry: > > fprintf(stderr, "%s kernel mount options: %s", > > thisprogram, options); > > > > - if (parsed_info->got_password && !(parsed_info->is_krb5 || parsed_info->is_noauth)) { > > + if (parsed_info->got_password && > > + !(parsed_info->is_krb5 || parsed_info->is_noauth || > > + parsed_info->is_guest)) { > > /* > > * Commas have to be doubled, or else they will > > * look like the parameter separator > > @@ -2345,7 +2349,9 @@ mount_retry: > > fprintf(stderr, ",pass=********"); > > } > > > > - if (parsed_info->got_password2 && !(parsed_info->is_krb5 || parsed_info->is_noauth)) { > > + if (parsed_info->got_password2 && > > + !(parsed_info->is_krb5 || parsed_info->is_noauth || > > + parsed_info->is_guest)) { > > strlcat(options, ",password2=", options_size); > > strlcat(options, parsed_info->password2, options_size); > > if (parsed_info->verboseflag) -- Thanks, Steve
From ac4d6e9cf69e1794dff061d62f727388a3b8b12b Mon Sep 17 00:00:00 2001 From: Meetakshi Setiya <msetiya@xxxxxxxxxxxxx> Date: Sat, 15 Mar 2025 06:49:13 +0000 Subject: [PATCH] Fix regression in mount.cifs with guest mount option mount.cifs was erroneously passing the empty password and password2 strings to the linux smb client for "guest" mounts. Handling empty password2 has not been implemented on the client yet, which ends up failing the mount with "cifs: Bad value for password2". This patch contains fixes for the mentioned scenario. Signed-off-by: Meetakshi Setiya <msetiya@xxxxxxxxxxxxx> Reviewed-by: Paulo Alcantara (Red Hat) <pc@xxxxxxxxxxxxx> Reviewed-by: Bharath SM <bharathsm@xxxxxxxxxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> --- mount.cifs.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mount.cifs.c b/mount.cifs.c index 7605130..6edd96e 100644 --- a/mount.cifs.c +++ b/mount.cifs.c @@ -200,6 +200,7 @@ struct parsed_mount_info { unsigned int got_domain:1; unsigned int is_krb5:1; unsigned int is_noauth:1; + unsigned int is_guest:1; uid_t sudo_uid; }; @@ -1158,6 +1159,7 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info) *filesys_flags &= ~MS_NOEXEC; goto nocopy; case OPT_GUEST: + parsed_info->is_guest = 1; parsed_info->got_user = 1; parsed_info->got_password = 1; parsed_info->got_password2 = 1; @@ -2334,7 +2336,8 @@ mount_retry: fprintf(stderr, "%s kernel mount options: %s", thisprogram, options); - if (parsed_info->got_password && !(parsed_info->is_krb5 || parsed_info->is_noauth)) { + if (parsed_info->got_password && + !(parsed_info->is_krb5 || parsed_info->is_noauth || parsed_info->is_guest)) { /* * Commas have to be doubled, or else they will * look like the parameter separator @@ -2345,7 +2348,8 @@ mount_retry: fprintf(stderr, ",pass=********"); } - if (parsed_info->got_password2 && !(parsed_info->is_krb5 || parsed_info->is_noauth)) { + if (parsed_info->got_password2 && + !(parsed_info->is_krb5 || parsed_info->is_noauth || parsed_info->is_guest)) { strlcat(options, ",password2=", options_size); strlcat(options, parsed_info->password2, options_size); if (parsed_info->verboseflag) -- 2.43.0