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.c50
1 files changed, 18 insertions, 32 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index ef5ae6f93c75..16535b510a96 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * fs/cifs/connect.c 2 * fs/cifs/connect.c
3 * 3 *
4 * Copyright (C) International Business Machines Corp., 2002,2005 4 * Copyright (C) International Business Machines Corp., 2002,2006
5 * Author(s): Steve French (sfrench@us.ibm.com) 5 * Author(s): Steve French (sfrench@us.ibm.com)
6 * 6 *
7 * This library is free software; you can redistribute it and/or modify 7 * This library is free software; you can redistribute it and/or modify
@@ -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 {
@@ -2830,7 +2816,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2830 } 2816 }
2831 } else { 2817 } else {
2832 cERROR(1, 2818 cERROR(1,
2833 (" Invalid Word count %d: ", 2819 (" Invalid Word count %d:",
2834 smb_buffer_response->WordCount)); 2820 smb_buffer_response->WordCount));
2835 rc = -EIO; 2821 rc = -EIO;
2836 } 2822 }
@@ -3447,7 +3433,7 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo,
3447 if (extended_security 3433 if (extended_security
3448 && (pSesInfo->capabilities & CAP_EXTENDED_SECURITY) 3434 && (pSesInfo->capabilities & CAP_EXTENDED_SECURITY)
3449 && (pSesInfo->server->secType == NTLMSSP)) { 3435 && (pSesInfo->server->secType == NTLMSSP)) {
3450 cFYI(1, ("New style sesssetup ")); 3436 cFYI(1, ("New style sesssetup"));
3451 rc = CIFSSpnegoSessSetup(xid, pSesInfo, 3437 rc = CIFSSpnegoSessSetup(xid, pSesInfo,
3452 NULL /* security blob */, 3438 NULL /* security blob */,
3453 0 /* blob length */, 3439 0 /* blob length */,
@@ -3455,7 +3441,7 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo,
3455 } else if (extended_security 3441 } else if (extended_security
3456 && (pSesInfo->capabilities & CAP_EXTENDED_SECURITY) 3442 && (pSesInfo->capabilities & CAP_EXTENDED_SECURITY)
3457 && (pSesInfo->server->secType == RawNTLMSSP)) { 3443 && (pSesInfo->server->secType == RawNTLMSSP)) {
3458 cFYI(1, ("NTLMSSP sesssetup ")); 3444 cFYI(1, ("NTLMSSP sesssetup"));
3459 rc = CIFSNTLMSSPNegotiateSessSetup(xid, 3445 rc = CIFSNTLMSSPNegotiateSessSetup(xid,
3460 pSesInfo, 3446 pSesInfo,
3461 &ntlmv2_flag, 3447 &ntlmv2_flag,