From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shirish Pargaonkar Subject: Re: [linux-cifs-client] [PATCH] cifs: reinstate original behavior when uid=/gid= options are specified Date: Fri, 31 Jul 2009 14:26:15 -0500 Message-ID: <4a4634330907311226g409e4098s83059caf8db4f03b@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-cifs-client@lists.samba.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org To: Jeff Layton Return-path: Received: from an-out-0708.google.com ([209.85.132.250]:64939 "EHLO an-out-0708.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751710AbZGaT0Q convert rfc822-to-8bit (ORCPT ); Fri, 31 Jul 2009 15:26:16 -0400 In-Reply-To: <1249037742-7862-1-git-send-email-jlayton@redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 restor= ed. > It also adds "noforceuid" and "noforcegid" options to make it so that > ownership information from the server is preserved, even when the mou= nt > 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 ch= ar *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; Should override_uid and override_gid be initialized to 1 so that if uid and/or gid are specified and none of the options, either forceuid/gid and or noforceuid/gid are specified, the vol-> override defaults to 1 (i.e. forceuid/gid)? > > =A0 =A0 =A0 =A0separator[0] =3D ','; > =A0 =A0 =A0 =A0separator[1] =3D 0; > @@ -1093,18 +1097,20 @@ cifs_parse_mount_options(char *options, const= char *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->li= nux_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->ov= erride_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->li= nux_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->ov= erride_gid =3D 1; > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else if (!strnicmp(data, "uid", 3) &&= value && *value) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 vol->linux_uid =3D simp= le_strtoul(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) &&= value && *value) { > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 vol->linux_gid =3D simp= le_strtoul(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->f= ile_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 forc= euid mount option " > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= "specified 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 forc= egid mount option " > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= "specified 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 > -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel= " in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html