All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: smfrench-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	idra-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org,
	Pavel Shilovsky
	<piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH 14/19] cifs: add new fields to cifs_ses to track requested security flavor
Date: Fri, 24 May 2013 08:56:44 -0400	[thread overview]
Message-ID: <20130524085644.4c670c4d@corrin.poochiereds.net> (raw)
In-Reply-To: <1369321563-16893-15-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

On Thu, 23 May 2013 11:05:58 -0400
Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:

> Currently we have the overrideSecFlg field, but it's quite cumbersome
> to work with. Add some new fields that will eventually supercede it.
> 
> Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
>  fs/cifs/cifsfs.c   | 11 +++++++----
>  fs/cifs/cifsglob.h |  2 ++
>  fs/cifs/connect.c  |  5 +++++
>  3 files changed, 14 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
> index bb27269..97601fa 100644
> --- a/fs/cifs/cifsfs.c
> +++ b/fs/cifs/cifsfs.c
> @@ -312,11 +312,14 @@ cifs_show_address(struct seq_file *s, struct TCP_Server_Info *server)
>  }
>  
>  static void
> -cifs_show_security(struct seq_file *s, struct TCP_Server_Info *server)
> +cifs_show_security(struct seq_file *s, struct cifs_ses *ses)
>  {
> +	if (ses->sectype == Unspecified)
> +		return;
> +
>  	seq_printf(s, ",sec=");
>  
> -	switch (server->secType) {
> +	switch (ses->sectype) {
>  	case LANMAN:
>  		seq_printf(s, "lanman");
>  		break;
> @@ -338,7 +341,7 @@ cifs_show_security(struct seq_file *s, struct TCP_Server_Info *server)
>  		break;
>  	}
>  
> -	if (server->sec_mode & (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED))
> +	if (ses->sign)
>  		seq_printf(s, "i");
>  }
>  
> @@ -369,7 +372,7 @@ cifs_show_options(struct seq_file *s, struct dentry *root)
>  	srcaddr = (struct sockaddr *)&tcon->ses->server->srcaddr;
>  
>  	seq_printf(s, ",vers=%s", tcon->ses->server->vals->version_string);
> -	cifs_show_security(s, tcon->ses->server);
> +	cifs_show_security(s, tcon->ses);
>  	cifs_show_cache_flavor(s, cifs_sb);
>  
>  	if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER)
> diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
> index 9f88a35..a911a33 100644
> --- a/fs/cifs/cifsglob.h
> +++ b/fs/cifs/cifsglob.h
> @@ -713,6 +713,8 @@ struct cifs_ses {
>  	char *password;
>  	struct session_key auth_key;
>  	struct ntlmssp_auth *ntlmssp; /* ciphertext, flags, server challenge */
> +	enum securityEnum sectype; /* what security flavor was specified? */
> +	bool sign;		/* is signing required? */
>  	bool need_reconnect:1; /* connection reset, uid now invalid */
>  #ifdef CONFIG_CIFS_SMB2
>  	__u16 session_flags;
> diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
> index 7b71961..072598f 100644
> --- a/fs/cifs/connect.c
> +++ b/fs/cifs/connect.c
> @@ -2513,6 +2513,9 @@ cifs_get_smb_ses(struct TCP_Server_Info *server, struct smb_vol *volume_info)
>  	ses->linux_uid = volume_info->linux_uid;
>  
>  	ses->overrideSecFlg = volume_info->secFlg;
> +	ses->sectype = volume_info->sectype;
> +	ses->sign = volume_info->sign ? volume_info->sign :
> +				(global_secflags & CIFSSEC_MUST_SIGN);

Note that there's a minor bug in the above line. CIFSSEC_MUST_SIGN is
CIFSSEC_MAY_SIGN or'ed with another bit. So this ends up setting
ses->sign when only CIFSSEC_MAY_SIGN is set. I've got that fixed in my
repo, and the next iteration of the set will include it.

>  
>  	mutex_lock(&ses->session_mutex);
>  	rc = cifs_negotiate_protocol(xid, ses);
> @@ -3931,6 +3934,8 @@ cifs_construct_tcon(struct cifs_sb_info *cifs_sb, kuid_t fsuid)
>  	vol_info->nocase = master_tcon->nocase;
>  	vol_info->local_lease = master_tcon->local_lease;
>  	vol_info->no_linux_ext = !master_tcon->unix_ext;
> +	vol_info->sectype = master_tcon->ses->sectype;
> +	vol_info->sign = master_tcon->ses->sign;
>  
>  	rc = cifs_set_vol_auth(vol_info, master_tcon->ses);
>  	if (rc) {


-- 
Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

  parent reply	other threads:[~2013-05-24 12:56 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-23 15:05 [PATCH 00/19] cifs: overhaul of auth selection code Jeff Layton
     [not found] ` <1369321563-16893-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-23 15:05   ` [PATCH 01/19] cifs: remove protocolEnum definition Jeff Layton
     [not found]     ` <1369321563-16893-2-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-24 12:08       ` Pavel Shilovsky
2013-05-23 15:05   ` [PATCH 02/19] cifs: remove useless memset in LANMAN auth code Jeff Layton
     [not found]     ` <1369321563-16893-3-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-24 12:08       ` Pavel Shilovsky
2013-05-23 15:05   ` [PATCH 03/19] cifs: make decode_ascii_ssetup void return Jeff Layton
     [not found]     ` <1369321563-16893-4-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-24 12:10       ` Pavel Shilovsky
2013-05-23 15:05   ` [PATCH 04/19] cifs: throw a warning if negotiate or sess_setup ops are passed NULL server or session pointers Jeff Layton
     [not found]     ` <1369321563-16893-5-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-24 12:15       ` Pavel Shilovsky
     [not found]         ` <CAKywueQWk_r+TcSebVHzyWs_Gnbdj523CETqXB4u25QkebPrqA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-05-24 12:20           ` Jeff Layton
2013-05-23 15:05   ` [PATCH 05/19] cifs: remove the cifs_ses->flags field Jeff Layton
     [not found]     ` <1369321563-16893-6-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-24 12:16       ` Pavel Shilovsky
2013-05-23 15:05   ` [PATCH 06/19] cifs: remove "seal" stubs Jeff Layton
     [not found]     ` <1369321563-16893-7-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-24 12:17       ` Pavel Shilovsky
2013-05-24 18:32       ` Steve French
     [not found]         ` <CAH2r5mv3bRxXKzBSkD9BUGxLVdvtcrD1vTfqsEp=cX2MrcQAvw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-05-24 19:42           ` Jeff Layton
     [not found]             ` <20130524154206.4cd7e357-4QP7MXygkU+dMjc06nkz3ljfA9RmPOcC@public.gmane.org>
2013-05-25  4:17               ` Shirish Pargaonkar
2013-05-23 15:05   ` [PATCH 07/19] cifs: break out decoding of security blob into separate function Jeff Layton
     [not found]     ` <1369321563-16893-8-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-24 12:24       ` Pavel Shilovsky
2013-05-23 15:05   ` [PATCH 08/19] cifs: break out lanman NEGOTIATE handling " Jeff Layton
     [not found]     ` <1369321563-16893-9-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-24 12:31       ` Pavel Shilovsky
2013-05-23 15:05   ` [PATCH 09/19] cifs: move handling of signed connections " Jeff Layton
     [not found]     ` <1369321563-16893-10-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-24 12:41       ` Pavel Shilovsky
     [not found]         ` <CAKywueQEwagjBhXsuSBEMRdnAAHyFovnoaR+28Gb7B9QpEXbqw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-05-24 12:45           ` Jeff Layton
2013-05-23 15:05   ` [PATCH 10/19] cifs: factor out check for extended security bit " Jeff Layton
     [not found]     ` <1369321563-16893-11-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-28  6:02       ` Pavel Shilovsky
2013-05-23 15:05   ` [PATCH 11/19] cifs: add new "Unspecified" securityEnum value Jeff Layton
     [not found]     ` <1369321563-16893-12-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-28  5:43       ` Pavel Shilovsky
2013-05-23 15:05   ` [PATCH 12/19] cifs: track the flavor of the NEGOTIATE reponse Jeff Layton
     [not found]     ` <1369321563-16893-13-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-28  5:46       ` Pavel Shilovsky
2013-05-23 15:05   ` [PATCH 13/19] cifs: add new fields to smb_vol to track the requested security flavor Jeff Layton
     [not found]     ` <1369321563-16893-14-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-28  5:49       ` Pavel Shilovsky
2013-05-23 15:05   ` [PATCH 14/19] cifs: add new fields to cifs_ses to track " Jeff Layton
     [not found]     ` <1369321563-16893-15-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-24 12:56       ` Jeff Layton [this message]
2013-05-23 15:05   ` [PATCH 15/19] cifs: track the enablement of signing in the TCP_Server_Info Jeff Layton
     [not found]     ` <1369321563-16893-16-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-28  6:00       ` Pavel Shilovsky
2013-05-23 15:06   ` [PATCH 16/19] cifs: move sectype to the cifs_ses instead of TCP_Server_Info Jeff Layton
     [not found]     ` <1369321563-16893-17-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-28  6:32       ` Pavel Shilovsky
2013-05-23 15:06   ` [PATCH 17/19] cifs: update the default global_secflags to include "raw" NTLMv2 Jeff Layton
     [not found]     ` <1369321563-16893-18-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-28  6:34       ` Pavel Shilovsky
2013-05-23 15:06   ` [PATCH 18/19] cifs: clean up the SecurityFlags write handler Jeff Layton
     [not found]     ` <1369321563-16893-19-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-28  6:36       ` Pavel Shilovsky
2013-05-23 15:06   ` [PATCH 19/19] cifs: try to handle the MUST SecurityFlags sanely Jeff Layton
     [not found]     ` <1369321563-16893-20-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2013-05-28  6:38       ` Pavel Shilovsky

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=20130524085644.4c670c4d@corrin.poochiereds.net \
    --to=jlayton-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=idra-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org \
    --cc=linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=piastryyy-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=smfrench-Re5JQEeQqe8AvxtiuMwx3w@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.