From: Jeff Layton <jlayton@xxxxxxxxxx> 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@xxxxxxxxxx> --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html