From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shirish Pargaonkar Subject: Re: [PATCH] cifs: reinstate original behavior when uid=/gid= options are specified Date: Fri, 31 Jul 2009 23:50:19 -0500 Message-ID: <4a4634330907312150t26518c33k32ce6e51c044c804@mail.gmail.com> References: <1249037742-7862-1-git-send-email-jlayton@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: linux-fsdevel@vger.kernel.org, linux-cifs-client@lists.samba.org, linux-kernel@vger.kernel.org To: Jeff Layton Return-path: In-Reply-To: <1249037742-7862-1-git-send-email-jlayton@redhat.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org List-Id: linux-fsdevel.vger.kernel.org acked; On Fri, Jul 31, 2009 at 5:55 AM, Jeff Layton wrote: > This patch fixes the regression reported here: > > http://bugzilla.kernel.org/show_bug.cgi?id=3D13861 > > commit 4ae1507f6d266d0cc3dd36e474d83aad70fec9e4 changed the default > behavior when the uid=3D or gid=3D 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. > > 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=3D or gid=3D options specified. > > It also adds a couple of printk notices that pop up when forceuid or > forcegid options are specified without a uid=3D or gid=3D option. > > Reported-by: Tom Chiverton > Signed-off-by: Jeff Layton > --- > =A0fs/cifs/connect.c | =A0 42 ++++++++++++++++++++++++++++++------------ > =A01 files changed, 30 insertions(+), 12 deletions(-) > > diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c > index f248688..1f3345d 100644 > --- a/fs/cifs/connect.c > +++ b/fs/cifs/connect.c > @@ -803,6 +803,10 @@ cifs_parse_mount_options(char *options, const char *= devname, > =A0 =A0 =A0 =A0char *data; > =A0 =A0 =A0 =A0unsigned int =A0temp_len, i, j; > =A0 =A0 =A0 =A0char separator[2]; > + =A0 =A0 =A0 short int override_uid =3D -1; > + =A0 =A0 =A0 short int override_gid =3D -1; > + =A0 =A0 =A0 bool uid_specified =3D false; > + =A0 =A0 =A0 bool gid_specified =3D false; > > =A0 =A0 =A0 =A0separator[0] =3D ','; > =A0 =A0 =A0 =A0separator[1] =3D 0; > @@ -1093,18 +1097,20 @@ cifs_parse_mount_options(char *options, const cha= r *devname, > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"too long.\n"); > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return 1; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (strnicmp(data, "uid", 3) =3D=3D = 0) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (value && *value) > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 vol->linux_= uid =3D > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 simple_strtoul(value, &value, 0); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (strnicmp(data, "forceuid", 8) = =3D=3D 0) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 vol->overri= de_uid =3D 1; > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (strnicmp(data, "gid", 3) =3D=3D = 0) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (value && *value) > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 vol->linux_= gid =3D > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 simple_strtoul(value, &value, 0); > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (strnicmp(data, "forcegid", 8) = =3D=3D 0) { > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 vol->overri= de_gid =3D 1; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (!strnicmp(data, "uid", 3) && val= ue && *value) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 vol->linux_uid =3D simple_s= trtoul(value, &value, 0); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 uid_specified =3D true; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (!strnicmp(data, "forceuid", 8)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 override_uid =3D 1; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (!strnicmp(data, "noforceuid", 10= )) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 override_uid =3D 0; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (!strnicmp(data, "gid", 3) && val= ue && *value) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 vol->linux_gid =3D simple_s= trtoul(value, &value, 0); > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 gid_specified =3D true; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (!strnicmp(data, "forcegid", 8)) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 override_gid =3D 1; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (!strnicmp(data, "noforcegid", 10= )) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 override_gid =3D 0; > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} else if (strnicmp(data, "file_mode", 4) = =3D=3D 0) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0if (value && *value) { > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vol->file_= mode =3D > @@ -1355,6 +1361,18 @@ cifs_parse_mount_options(char *options, const char= *devname, > =A0 =A0 =A0 =A0if (vol->UNCip =3D=3D NULL) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vol->UNCip =3D &vol->UNC[2]; > > + =A0 =A0 =A0 if (uid_specified) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 vol->override_uid =3D override_uid; > + =A0 =A0 =A0 else if (override_uid =3D=3D 1) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 printk(KERN_NOTICE "CIFS: ignoring forceuid= mount option " > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"spe= cified with no uid=3D option.\n"); > + > + =A0 =A0 =A0 if (gid_specified) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 vol->override_gid =3D override_gid; > + =A0 =A0 =A0 else if (override_gid =3D=3D 1) > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 printk(KERN_NOTICE "CIFS: ignoring forcegid= mount option " > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"spe= cified with no gid=3D option.\n"); > + > =A0 =A0 =A0 =A0return 0; > =A0} > > -- > 1.6.0.6 > > _______________________________________________ > linux-cifs-client mailing list > linux-cifs-client@lists.samba.org > https://lists.samba.org/mailman/listinfo/linux-cifs-client >