From: Jeff Layton <jlayton@samba.org>
To: linux-cifs-client@lists.samba.org
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH 10/15] cifs: move secType to the SMB session
Date: Tue, 30 Mar 2010 15:51:12 -0400 [thread overview]
Message-ID: <1269978677-6817-11-git-send-email-jlayton@samba.org> (raw)
In-Reply-To: <1269978677-6817-1-git-send-email-jlayton@samba.org>
From: Jeff Layton <jlayton@redhat.com>
There's no reason we need to use the same secType for every session on
a socket. Move the secType field from the server info struct to the
SMB session.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
---
fs/cifs/cifs_spnego.c | 4 ++--
fs/cifs/cifsglob.h | 2 +-
fs/cifs/cifssmb.c | 20 ++++++++++----------
fs/cifs/connect.c | 2 +-
fs/cifs/sess.c | 2 +-
5 files changed, 15 insertions(+), 15 deletions(-)
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:
--
1.6.6.1
next prev parent reply other threads:[~2010-03-30 19:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-30 19:51 [PATCH 00/15] cifs: implement multisession mounts (RFC) Jeff Layton
2010-03-30 19:51 ` [PATCH 01/15] cifs: remove unused list_head from cifs_sb_info Jeff Layton
2010-03-30 19:51 ` [PATCH 02/15] cifs: add function to get a tcon from cifs_sb Jeff Layton
2010-03-30 19:51 ` [PATCH 03/15] cifs: track local_nls in volume info Jeff Layton
2010-03-30 19:51 ` [PATCH 04/15] cifs: move SMB session creation code into separate function Jeff Layton
2010-03-30 19:51 ` [PATCH 05/15] cifs: move tcon find/create " Jeff Layton
2010-03-30 19:51 ` [PATCH 06/15] cifs: add tcon field to cifsFileInfo struct Jeff Layton
2010-03-30 19:51 ` [PATCH 07/15] cifs: make various routines use the cifsFileInfo->tcon pointer Jeff Layton
2010-03-30 19:51 ` [PATCH 08/15] cifs: have find_readable/writable_file filter by fsuid Jeff Layton
2010-03-30 19:51 ` [PATCH 09/15] cifs: fix cifs_show_options to show "username=" or "multises" Jeff Layton
2010-03-30 19:51 ` Jeff Layton [this message]
2010-03-30 19:51 ` [PATCH 11/15] cifs: have cifs_new_fileinfo take a tcon arg Jeff Layton
2010-03-30 19:51 ` [PATCH 12/15] cifs: build sessions and tcons on the fly Jeff Layton
2010-03-30 19:51 ` [PATCH 13/15] cifs: on multises mount, set ownership to current_fsuid/current_fsgid Jeff Layton
2010-03-30 19:51 ` [PATCH 14/15] cifs: add "multises" mount option Jeff Layton
2010-03-30 19:51 ` [PATCH 15/15] cifs: temporary hack -- set secType to Kerberos Jeff Layton
2010-03-31 12:18 ` [PATCH 00/15] cifs: implement multisession mounts (RFC) Jamie Lokier
2010-03-31 13:42 ` Jeff Layton
2010-03-31 16:43 ` Jeremy Allison
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=1269978677-6817-11-git-send-email-jlayton@samba.org \
--to=jlayton@samba.org \
--cc=linux-cifs-client@lists.samba.org \
--cc=linux-fsdevel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).