[linux-cifs-client] [patch][linux-cifs] login as anonymous for -o guest option

Shirish Pargaonkar shirishpargaonkar at gmail.com
Fri Feb 20 16:58:07 GMT 2009


On Fri, Feb 20, 2009 at 7:16 AM, Jeff Layton <jlayton at redhat.com> wrote:
> On Fri, 20 Feb 2009 03:50:14 -0600
> Shirish Pargaonkar <shirishpargaonkar at gmail.com> wrote:
>
>> On Wed, Feb 18, 2009 at 3:07 PM, Jeff Layton <jlayton at redhat.com> wrote:
>> > On Wed, 18 Feb 2009 14:47:16 -0600
>> > Shirish Pargaonkar <shirishpargaonkar at gmail.com> wrote:
>> >
>> >> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
>> >> index d6a3c1c..dc05bf9 100644
>> >> --- a/fs/cifs/connect.c
>> >> +++ b/fs/cifs/connect.c
>> >> @@ -69,6 +69,7 @@ struct smb_vol {
>> >>       mode_t file_mode;
>> >>       mode_t dir_mode;
>> >>       unsigned secFlg;
>> >> +     unsigned guest;
>> >>       bool rw:1;
>> >>       bool retry:1;
>> >>       bool intr:1;
>> >> @@ -1183,7 +1184,7 @@ cifs_parse_mount_options(char *options,
>> >>               } else if (strnicmp(data, "version", 3) == 0) {
>> >>                       /* ignore */
>> >>               } else if (strnicmp(data, "guest", 5) == 0) {
>> >> -                     /* ignore */
>> >> +                     vol->guest = true;
>> >>               } else if (strnicmp(data, "rw", 2) == 0) {
>> >>                       vol->rw = true;
>> >>               } else if (strnicmp(data, "noblocksend", 11) == 0) {
>> >> @@ -2266,6 +2267,13 @@ cifs_mount(struct super_block *sb, struc
>> >>               list_add(&pSesInfo->smb_ses_list, &srvTcp->smb_ses_list);
>> >>               write_unlock(&cifs_tcp_ses_lock);
>> >>
>> >> +             if (volume_info->guest) {
>> >> +                     volume_info->guest = false;
>> >> +                     volume_info->username = NULL;
>> >> +                     volume_info->password = NULL;
>> >> +                     strcpy(pSesInfo->userName, ""); /* anonymous user */
>> >> +             }
>> >> +
>> >>               /* volume_info->password freed at unmount */
>> >>               if (volume_info->password) {
>> >>                       pSesInfo->password = volume_info->password;
>> >
>> > We already have the ability to do a guest login. You just send a blank
>> > user= option and that just ensures that volume_info->nullauth gets
>> > set. A better scheme to me would be to have mount.cifs just turn the
>> > username into an empty string. It seems like that should do what you
>> > want...
>> >
>> > --
>> > Jeff Layton <jlayton at redhat.com>
>> >
>>
>> how about this change to mount.cifs.c?
>>
>> Regards,
>>
>> Shirish
>
> Looks reasonable. My only (very minor) concern is that we have
> different behavior if you specify:
>
>    user=foo,guest
>
> ...than if you specify:
>
>    guest,user=foo
>
> ...but we have that in other places so I'm not too worried about it.
>
> --
> Jeff Layton <jlayton at redhat.com>
>


Jeff,

With the patch, for the cases,   -o user=foo,guest   and  -o guest,user=foo
I see the same behaviour, mount.cifs does not prompt for password and
user id for session setup is anonymous

For the case,  -o user=guest,foo  it is different, mount.cifs prompts
for password and user id for session setup is foo.

Regards,

Shirish


More information about the linux-cifs-client mailing list