aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/smb2pdu.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2013-06-12 20:52:14 -0400
committerSteve French <smfrench@gmail.com>2013-06-24 02:56:44 -0400
commit3f618223dc0bdcbc8d510350e78ee2195ff93768 (patch)
tree07b910ab18112557f897f2192d073f97553e1055 /fs/cifs/smb2pdu.c
parent38d77c50b4f4e3ea1687e119871364f1c8d2f531 (diff)
move sectype to the cifs_ses instead of TCP_Server_Info
Now that we track what sort of NEGOTIATE response was received, stop mandating that every session on a socket use the same type of auth. Push that decision out into the session setup code, and make the sectype a per-session property. This should allow us to mix multiple sectypes on a socket as long as they are compatible with the NEGOTIATE response. With this too, we can now eliminate the ses->secFlg field since that info is redundant and harder to work with than a securityEnum. Signed-off-by: Jeff Layton <jlayton@redhat.com> Acked-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/smb2pdu.c')
-rw-r--r--fs/cifs/smb2pdu.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index ad8ef10de0bd..fd2ea4271282 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -328,7 +328,6 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
328 int rc = 0; 328 int rc = 0;
329 int resp_buftype; 329 int resp_buftype;
330 struct TCP_Server_Info *server = ses->server; 330 struct TCP_Server_Info *server = ses->server;
331 unsigned int sec_flags;
332 int blob_offset, blob_length; 331 int blob_offset, blob_length;
333 char *security_blob; 332 char *security_blob;
334 int flags = CIFS_NEG_OP; 333 int flags = CIFS_NEG_OP;
@@ -344,14 +343,6 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
344 if (rc) 343 if (rc)
345 return rc; 344 return rc;
346 345
347 /* if any of auth flags (ie not sign or seal) are overriden use them */
348 if (ses->overrideSecFlg & (~(CIFSSEC_MUST_SIGN | CIFSSEC_MUST_SEAL)))
349 sec_flags = ses->overrideSecFlg; /* BB FIXME fix sign flags?*/
350 else /* if override flags set only sign/seal OR them with global auth */
351 sec_flags = global_secflags | ses->overrideSecFlg;
352
353 cifs_dbg(FYI, "sec_flags 0x%x\n", sec_flags);
354
355 req->hdr.SessionId = 0; 346 req->hdr.SessionId = 0;
356 347
357 req->Dialects[0] = cpu_to_le16(ses->server->vals->protocol_id); 348 req->Dialects[0] = cpu_to_le16(ses->server->vals->protocol_id);
@@ -453,7 +444,6 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses,
453 int resp_buftype; 444 int resp_buftype;
454 __le32 phase = NtLmNegotiate; /* NTLMSSP, if needed, is multistage */ 445 __le32 phase = NtLmNegotiate; /* NTLMSSP, if needed, is multistage */
455 struct TCP_Server_Info *server = ses->server; 446 struct TCP_Server_Info *server = ses->server;
456 unsigned int sec_flags;
457 u16 blob_length = 0; 447 u16 blob_length = 0;
458 char *security_blob; 448 char *security_blob;
459 char *ntlmssp_blob = NULL; 449 char *ntlmssp_blob = NULL;
@@ -474,7 +464,8 @@ SMB2_sess_setup(const unsigned int xid, struct cifs_ses *ses,
474 if (!ses->ntlmssp) 464 if (!ses->ntlmssp)
475 return -ENOMEM; 465 return -ENOMEM;
476 466
477 ses->server->secType = RawNTLMSSP; 467 /* FIXME: allow for other auth types besides NTLMSSP (e.g. krb5) */
468 ses->sectype = RawNTLMSSP;
478 469
479ssetup_ntlmssp_authenticate: 470ssetup_ntlmssp_authenticate:
480 if (phase == NtLmChallenge) 471 if (phase == NtLmChallenge)
@@ -484,14 +475,6 @@ ssetup_ntlmssp_authenticate:
484 if (rc) 475 if (rc)
485 return rc; 476 return rc;
486 477
487 /* if any of auth flags (ie not sign or seal) are overriden use them */
488 if (ses->overrideSecFlg & (~(CIFSSEC_MUST_SIGN | CIFSSEC_MUST_SEAL)))
489 sec_flags = ses->overrideSecFlg; /* BB FIXME fix sign flags?*/
490 else /* if override flags set only sign/seal OR them with global auth */
491 sec_flags = global_secflags | ses->overrideSecFlg;
492
493 cifs_dbg(FYI, "sec_flags 0x%x\n", sec_flags);
494
495 req->hdr.SessionId = 0; /* First session, not a reauthenticate */ 478 req->hdr.SessionId = 0; /* First session, not a reauthenticate */
496 req->VcNumber = 0; /* MBZ */ 479 req->VcNumber = 0; /* MBZ */
497 /* to enable echos and oplocks */ 480 /* to enable echos and oplocks */