aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c42
1 files changed, 14 insertions, 28 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index e488603fb1e7..05aa651ea3da 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2525,7 +2525,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2525 __u32 negotiate_flags, capabilities; 2525 __u32 negotiate_flags, capabilities;
2526 __u16 count; 2526 __u16 count;
2527 2527
2528 cFYI(1, ("In NTLMSSP sesssetup (negotiate) ")); 2528 cFYI(1, ("In NTLMSSP sesssetup (negotiate)"));
2529 if(ses == NULL) 2529 if(ses == NULL)
2530 return -EINVAL; 2530 return -EINVAL;
2531 domain = ses->domainName; 2531 domain = ses->domainName;
@@ -2575,7 +2575,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2575 SecurityBlob->MessageType = NtLmNegotiate; 2575 SecurityBlob->MessageType = NtLmNegotiate;
2576 negotiate_flags = 2576 negotiate_flags =
2577 NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_OEM | 2577 NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_OEM |
2578 NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_NTLM | 0x80000000 | 2578 NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_NTLM |
2579 NTLMSSP_NEGOTIATE_56 |
2579 /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN | */ NTLMSSP_NEGOTIATE_128; 2580 /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN | */ NTLMSSP_NEGOTIATE_128;
2580 if(sign_CIFS_PDUs) 2581 if(sign_CIFS_PDUs)
2581 negotiate_flags |= NTLMSSP_NEGOTIATE_SIGN; 2582 negotiate_flags |= NTLMSSP_NEGOTIATE_SIGN;
@@ -2588,26 +2589,11 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2588 SecurityBlob->WorkstationName.Length = 0; 2589 SecurityBlob->WorkstationName.Length = 0;
2589 SecurityBlob->WorkstationName.MaximumLength = 0; 2590 SecurityBlob->WorkstationName.MaximumLength = 0;
2590 2591
2591 if (domain == NULL) { 2592 /* Domain not sent on first Sesssetup in NTLMSSP, instead it is sent
2592 SecurityBlob->DomainName.Buffer = 0; 2593 along with username on auth request (ie the response to challenge) */
2593 SecurityBlob->DomainName.Length = 0; 2594 SecurityBlob->DomainName.Buffer = 0;
2594 SecurityBlob->DomainName.MaximumLength = 0; 2595 SecurityBlob->DomainName.Length = 0;
2595 } else { 2596 SecurityBlob->DomainName.MaximumLength = 0;
2596 __u16 len;
2597 negotiate_flags |= NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED;
2598 strncpy(bcc_ptr, domain, 63);
2599 len = strnlen(domain, 64);
2600 SecurityBlob->DomainName.MaximumLength =
2601 cpu_to_le16(len);
2602 SecurityBlob->DomainName.Buffer =
2603 cpu_to_le32((long) &SecurityBlob->
2604 DomainString -
2605 (long) &SecurityBlob->Signature);
2606 bcc_ptr += len;
2607 SecurityBlobLength += len;
2608 SecurityBlob->DomainName.Length =
2609 cpu_to_le16(len);
2610 }
2611 if (ses->capabilities & CAP_UNICODE) { 2597 if (ses->capabilities & CAP_UNICODE) {
2612 if ((long) bcc_ptr % 2) { 2598 if ((long) bcc_ptr % 2) {
2613 *bcc_ptr = 0; 2599 *bcc_ptr = 0;
@@ -2677,7 +2663,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2677 SecurityBlob2->MessageType)); 2663 SecurityBlob2->MessageType));
2678 } else if (ses) { 2664 } else if (ses) {
2679 ses->Suid = smb_buffer_response->Uid; /* UID left in le format */ 2665 ses->Suid = smb_buffer_response->Uid; /* UID left in le format */
2680 cFYI(1, ("UID = %d ", ses->Suid)); 2666 cFYI(1, ("UID = %d", ses->Suid));
2681 if ((pSMBr->resp.hdr.WordCount == 3) 2667 if ((pSMBr->resp.hdr.WordCount == 3)
2682 || ((pSMBr->resp.hdr.WordCount == 4) 2668 || ((pSMBr->resp.hdr.WordCount == 4)
2683 && (blob_len < 2669 && (blob_len <
@@ -2685,17 +2671,17 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2685 2671
2686 if (pSMBr->resp.hdr.WordCount == 4) { 2672 if (pSMBr->resp.hdr.WordCount == 4) {
2687 bcc_ptr += blob_len; 2673 bcc_ptr += blob_len;
2688 cFYI(1, 2674 cFYI(1, ("Security Blob Length %d",
2689 ("Security Blob Length %d ",
2690 blob_len)); 2675 blob_len));
2691 } 2676 }
2692 2677
2693 cFYI(1, ("NTLMSSP Challenge rcvd ")); 2678 cFYI(1, ("NTLMSSP Challenge rcvd"));
2694 2679
2695 memcpy(ses->server->cryptKey, 2680 memcpy(ses->server->cryptKey,
2696 SecurityBlob2->Challenge, 2681 SecurityBlob2->Challenge,
2697 CIFS_CRYPTO_KEY_SIZE); 2682 CIFS_CRYPTO_KEY_SIZE);
2698 if(SecurityBlob2->NegotiateFlags & cpu_to_le32(NTLMSSP_NEGOTIATE_NTLMV2)) 2683 if(SecurityBlob2->NegotiateFlags &
2684 cpu_to_le32(NTLMSSP_NEGOTIATE_NTLMV2))
2699 *pNTLMv2_flag = TRUE; 2685 *pNTLMv2_flag = TRUE;
2700 2686
2701 if((SecurityBlob2->NegotiateFlags & 2687 if((SecurityBlob2->NegotiateFlags &
@@ -2818,7 +2804,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2818 bcc_ptr++; 2804 bcc_ptr++;
2819 } else 2805 } else
2820 cFYI(1, 2806 cFYI(1,
2821 ("Variable field of length %d extends beyond end of smb ", 2807 ("Variable field of length %d extends beyond end of smb",
2822 len)); 2808 len));
2823 } 2809 }
2824 } else { 2810 } else {