All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve French <smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 6/6] cifs: add separate cred_uid field to sesInfo
Date: Thu, 15 Jul 2010 15:24:46 -0500	[thread overview]
Message-ID: <AANLkTik7vm4iYcRH2oGxuINyL2VxY_h9Y03sFhQWR19d@mail.gmail.com> (raw)
In-Reply-To: <1277068251-16344-7-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

I merged the first 5 of this series, but wanted to understand what
behavior this changes first (it is probably ok).  With current
userspace code - what changes would a user see with this?

On Sun, Jun 20, 2010 at 4:10 PM, Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> Right now, there's no clear separation between the uid that owns the
> credentials used to do the mount and the overriding owner of the files
> on that mount.
>
> Add a separate cred_uid field that is set to the real uid
> of the mount user. Unlike the linux_uid, the uid= option does not
> override this parameter. The parm is sent to cifs.upcall, which can then
> preferentially use the creduid= parm instead of the uid= parm for
> finding credentials.
>
> This is not the only way to solve this. We could try to do all of this
> in kernel instead by having a module parameter that affects what gets
> passed in the uid= field of the upcall. That said, we have a lot more
> flexibility to change things in userspace so I think it probably makes
> sense to do it this way.
>
> Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  fs/cifs/cifs_spnego.c |    3 +++
>  fs/cifs/cifsglob.h    |    3 ++-
>  fs/cifs/connect.c     |    7 +++++--
>  3 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c
> index 379bd7d..6effccf 100644
> --- a/fs/cifs/cifs_spnego.c
> +++ b/fs/cifs/cifs_spnego.c
> @@ -144,6 +144,9 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo)
>        sprintf(dp, ";uid=0x%x", sesInfo->linux_uid);
>
>        dp = description + strlen(description);
> +       sprintf(dp, ";creduid=0x%x", sesInfo->cred_uid);
> +
> +       dp = description + strlen(description);
>        sprintf(dp, ";user=%s", sesInfo->userName);
>
>        dp = description + strlen(description);
> diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
> index 415703b..e15d7a5 100644
> --- a/fs/cifs/cifsglob.h
> +++ b/fs/cifs/cifsglob.h
> @@ -209,7 +209,8 @@ struct cifsSesInfo {
>        char *serverNOS;        /* name of network operating system of server */
>        char *serverDomain;     /* security realm of server */
>        int Suid;               /* remote smb uid  */
> -       uid_t linux_uid;        /* local Linux uid */
> +       uid_t linux_uid;        /* overriding owner of files on the mount */
> +       uid_t cred_uid;         /* owner of credentials */
>        int capabilities;
>        char serverName[SERVER_NAME_LEN_WITH_NULL * 2]; /* BB make bigger for
>                                TCP names - will ipv6 and sctp addresses fit? */
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 58e0217..920d94e 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -66,6 +66,7 @@ struct smb_vol {
>        char *iocharset;  /* local code page for mapping to and from Unicode */
>        char source_rfc1001_name[16]; /* netbios name of client */
>        char target_rfc1001_name[16]; /* netbios name of server for Win9x/ME */
> +       uid_t cred_uid;
>        uid_t linux_uid;
>        gid_t linux_gid;
>        mode_t file_mode;
> @@ -830,7 +831,8 @@ cifs_parse_mount_options(char *options, const char *devname,
>        /* null target name indicates to use *SMBSERVR default called name
>           if we end up sending RFC1001 session initialize */
>        vol->target_rfc1001_name[0] = 0;
> -       vol->linux_uid = current_uid();  /* use current_euid() instead? */
> +       vol->cred_uid = current_uid();
> +       vol->linux_uid = current_uid();
>        vol->linux_gid = current_gid();
>
>        /* default to only allowing write access to owner of the mount */
> @@ -1647,7 +1649,7 @@ cifs_find_smb_ses(struct TCP_Server_Info *server, struct smb_vol *vol)
>        list_for_each_entry(ses, &server->smb_ses_list, smb_ses_list) {
>                switch (server->secType) {
>                case Kerberos:
> -                       if (vol->linux_uid != ses->linux_uid)
> +                       if (vol->cred_uid != ses->cred_uid)
>                                continue;
>                        break;
>                default:
> @@ -1764,6 +1766,7 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info)
>                if (ses->domainName)
>                        strcpy(ses->domainName, volume_info->domainname);
>        }
> +       ses->cred_uid = volume_info->cred_uid;
>        ses->linux_uid = volume_info->linux_uid;
>        ses->overrideSecFlg = volume_info->secFlg;
>
> --
> 1.6.6.1
>
>



-- 
Thanks,

Steve

  parent reply	other threads:[~2010-07-15 20:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-20 21:10 [PATCH 0/6] cifs: session matching and authentication fixes and cleanups Jeff Layton
     [not found] ` <1277068251-16344-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-06-20 21:10   ` [PATCH 1/6] cifs: have cifs_convert_address set port Jeff Layton
2010-06-20 21:10   ` [PATCH 2/6] cifs: move address comparison into separate function Jeff Layton
2010-06-20 21:10   ` [PATCH 3/6] cifs: match secType when searching for existing tcp session Jeff Layton
2010-06-20 21:10   ` [PATCH 4/6] cifs: clean up cifs_find_smb_ses Jeff Layton
2010-06-20 21:10   ` [PATCH 5/6] cifs: remove unused cifsUidInfo struct Jeff Layton
2010-06-20 21:10   ` [PATCH 6/6] cifs: add separate cred_uid field to sesInfo Jeff Layton
     [not found]     ` <1277068251-16344-7-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-07-15 20:24       ` Steve French [this message]
     [not found]         ` <AANLkTik7vm4iYcRH2oGxuINyL2VxY_h9Y03sFhQWR19d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2010-07-15 21:19           ` Jeff Layton
     [not found]             ` <20100715171936.4252a16d-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2010-07-18 11:18               ` Jeff Layton
     [not found]                 ` <20100718071819.4264e8aa-9yPaYZwiELC+kQycOl6kW4xkIHaj4LzF@public.gmane.org>
2010-07-23 20:51                   ` Jeff Layton
2010-07-23 18:41           ` Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AANLkTik7vm4iYcRH2oGxuINyL2VxY_h9Y03sFhQWR19d@mail.gmail.com \
    --to=smfrench-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.