From patchwork Tue Mar 30 19:51:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 89383 Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o2UJq1OC006848 for ; Tue, 30 Mar 2010 19:52:42 GMT Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id B50CEAD208; Tue, 30 Mar 2010 13:51:40 -0600 (MDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.8 tests=BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS,SPF_NEUTRAL autolearn=ham version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by lists.samba.org (Postfix) with ESMTP id 56283AD27F for ; Tue, 30 Mar 2010 13:51:18 -0600 (MDT) Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2UJpGjo006789 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 30 Mar 2010 15:51:16 -0400 Received: from localhost.localdomain (vpn-10-89.rdu.redhat.com [10.11.10.89]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2UJp84S024778; Tue, 30 Mar 2010 15:51:16 -0400 From: Jeff Layton To: linux-cifs-client@lists.samba.org Date: Tue, 30 Mar 2010 15:51:12 -0400 Message-Id: <1269978677-6817-11-git-send-email-jlayton@samba.org> In-Reply-To: <1269978677-6817-1-git-send-email-jlayton@samba.org> References: <1269978677-6817-1-git-send-email-jlayton@samba.org> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Cc: linux-fsdevel@vger.kernel.org Subject: [linux-cifs-client] [PATCH 10/15] cifs: move secType to the SMB session X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 30 Mar 2010 19:52:42 +0000 (UTC) diff --git a/fs/cifs/cifs_spnego.c b/fs/cifs/cifs_spnego.c index 8ec7736..2f6bb5b 100644 --- a/fs/cifs/cifs_spnego.c +++ b/fs/cifs/cifs_spnego.c @@ -132,9 +132,9 @@ cifs_get_spnego_key(struct cifsSesInfo *sesInfo) dp = description + strlen(description); /* for now, only sec=krb5 and sec=mskrb5 are valid */ - if (server->secType == Kerberos) + if (sesInfo->secType == Kerberos) sprintf(dp, ";sec=krb5"); - else if (server->secType == MSKerberos) + else if (sesInfo->secType == MSKerberos) sprintf(dp, ";sec=mskrb5"); else goto out; diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h index 1aa8418..b47a66b 100644 --- a/fs/cifs/cifsglob.h +++ b/fs/cifs/cifsglob.h @@ -160,7 +160,6 @@ struct TCP_Server_Info { struct task_struct *tsk; char server_GUID[16]; char secMode; - enum securityEnum secType; unsigned int maxReq; /* Clients should submit no more */ /* than maxReq distinct unanswered SMBs to the server when using */ /* multiplexed reads or writes */ @@ -212,6 +211,7 @@ struct cifsSesInfo { struct TCP_Server_Info *server; /* pointer to server info */ int ses_count; /* reference counter */ enum statusEnum status; + enum securityEnum secType; unsigned overrideSecFlg; /* if non-zero override global sec flags */ __u16 ipc_tid; /* special tid for connection to IPC share */ __u16 flags; diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 2c6de17..227be2c 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -425,7 +425,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) if ((secFlags & CIFSSEC_MAY_LANMAN) || (secFlags & CIFSSEC_MAY_PLNTXT)) - server->secType = LANMAN; + ses->secType = LANMAN; else { cERROR(1, ("mount failed weak security disabled" " in /proc/fs/cifs/SecurityFlags")); @@ -521,20 +521,20 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) " but client support disabled")); if ((secFlags & CIFSSEC_MUST_NTLMV2) == CIFSSEC_MUST_NTLMV2) - server->secType = NTLMv2; + ses->secType = NTLMv2; else if (secFlags & CIFSSEC_MAY_NTLM) - server->secType = NTLM; + ses->secType = NTLM; else if (secFlags & CIFSSEC_MAY_NTLMV2) - server->secType = NTLMv2; + ses->secType = NTLMv2; else if (secFlags & CIFSSEC_MAY_KRB5) - server->secType = Kerberos; + ses->secType = Kerberos; else if (secFlags & CIFSSEC_MAY_NTLMSSP) - server->secType = RawNTLMSSP; + ses->secType = RawNTLMSSP; else if (secFlags & CIFSSEC_MAY_LANMAN) - server->secType = LANMAN; + ses->secType = LANMAN; /* #ifdef CONFIG_CIFS_EXPERIMENTAL else if (secFlags & CIFSSEC_MAY_PLNTXT) - server->secType = ?? + ses->secType = ?? #endif */ else { rc = -EOPNOTSUPP; @@ -593,12 +593,12 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) } if (count == 16) { - server->secType = RawNTLMSSP; + ses->secType = RawNTLMSSP; } else { rc = decode_negTokenInit(pSMBr->u.extended_response. SecurityBlob, count - 16, - &server->secType); + &ses->secType); if (rc == 1) rc = 0; else diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 9dc817d..3e1efc6 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c @@ -2752,7 +2752,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, NTLMv2 password here) */ #ifdef CONFIG_CIFS_WEAK_PW_HASH if ((extended_security & CIFSSEC_MAY_LANMAN) && - (ses->server->secType == LANMAN)) + (ses->secType == LANMAN)) calc_lanman_hash(tcon->password, ses->server->cryptKey, ses->server->secMode & SECMODE_PW_ENCRYPT ? true : false, diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c index aaa9c1c..63da915 100644 --- a/fs/cifs/sess.c +++ b/fs/cifs/sess.c @@ -580,7 +580,7 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time, if (ses == NULL) return -EINVAL; - type = ses->server->secType; + type = ses->secType; cFYI(1, ("sess setup type %d", type)); ssetup_ntlmssp_authenticate: