From patchwork Thu May 23 15:05:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 2607561 Return-Path: X-Original-To: patchwork-cifs-client@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 9D74DDFB78 for ; Thu, 23 May 2013 15:06:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759301Ab3EWPG0 (ORCPT ); Thu, 23 May 2013 11:06:26 -0400 Received: from mail-qa0-f51.google.com ([209.85.216.51]:42294 "EHLO mail-qa0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759358Ab3EWPGZ (ORCPT ); Thu, 23 May 2013 11:06:25 -0400 Received: by mail-qa0-f51.google.com with SMTP id ii15so1692185qab.3 for ; Thu, 23 May 2013 08:06:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references:x-gm-message-state; bh=1KD2HaI6CzuGCoS3Yqd4eA06fJYWOZK4j5YsYLlPic4=; b=ThVASQt1zM4mppuGD6SIVGw180qCZ7Qzbk1SNtY1mCxrzAIbT1yF88T+wSCVJZy3hC LeisEyt/37njsMmf0CtmU3c6KI2aKBXmUrBiTThistnEK9eGRpBQlQwFyjs1GCEyXW4k Vg3LxJFKMvC+A+F3d10BLPlXyzOiqc9aTw///V58aWBZYz0OS1biOeadvY/UY6pXJIZ2 fG+flhRobqAmrRkCE4vL4jZaI8+ukf+y3rt2YynR2eKgxLva4JqQehKmJZH0YTH6pUJk E6jeehGT8hCijFTDXdIJcQ4gBDS1YcEmNAAdMrYnoWNPBArw884gSbilfZETyTLHxtUH 1B3g== X-Received: by 10.229.67.69 with SMTP id q5mr4427508qci.56.1369321584588; Thu, 23 May 2013 08:06:24 -0700 (PDT) Received: from salusa.poochiereds.net (cpe-107-015-113-143.nc.res.rr.com. [107.15.113.143]) by mx.google.com with ESMTPSA id y1sm12688520qad.5.2013.05.23.08.06.23 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 23 May 2013 08:06:24 -0700 (PDT) From: Jeff Layton To: smfrench@gmail.com Cc: linux-cifs@vger.kernel.org, idra@samba.org Subject: [PATCH 14/19] cifs: add new fields to cifs_ses to track requested security flavor Date: Thu, 23 May 2013 11:05:58 -0400 Message-Id: <1369321563-16893-15-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1369321563-16893-1-git-send-email-jlayton@redhat.com> References: <1369321563-16893-1-git-send-email-jlayton@redhat.com> X-Gm-Message-State: ALoCoQmuwL2UuBdRtcO4eyodJFDxwYLOg4hr9iswepXiNwaiD1kGajb6tZziDZAs0/Qj0LyIj/Gy Sender: linux-cifs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org 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 --- 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); 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) {