aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2006-05-31 18:40:51 -0400
committerSteve French <sfrench@us.ibm.com>2006-05-31 18:40:51 -0400
commit3979877e5606ecc58c5a31bd0078c6d80ba9cbe7 (patch)
treed221455b5176ea8b26e750d6498c3ed822998ba3 /fs/cifs/connect.c
parent26a21b980b1897b11fd7f9ba4bf6060c9e15df10 (diff)
[CIFS] Support for setting up SMB sessions to legacy lanman servers
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c39
1 files changed, 26 insertions, 13 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index bae1479318d1..7ffb8f244f6a 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -49,8 +49,6 @@
49 49
50static DECLARE_COMPLETION(cifsd_complete); 50static DECLARE_COMPLETION(cifsd_complete);
51 51
52extern void SMBencrypt(unsigned char *passwd, unsigned char *c8,
53 unsigned char *p24);
54extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8, 52extern void SMBNTencrypt(unsigned char *passwd, unsigned char *c8,
55 unsigned char *p24); 53 unsigned char *p24);
56 54
@@ -585,9 +583,11 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
585 /* merge response - fix up 1st*/ 583 /* merge response - fix up 1st*/
586 if(coalesce_t2(smb_buffer, 584 if(coalesce_t2(smb_buffer,
587 mid_entry->resp_buf)) { 585 mid_entry->resp_buf)) {
586 mid_entry->multiRsp = 1;
588 break; 587 break;
589 } else { 588 } else {
590 /* all parts received */ 589 /* all parts received */
590 mid_entry->multiEnd = 1;
591 goto multi_t2_fnd; 591 goto multi_t2_fnd;
592 } 592 }
593 } else { 593 } else {
@@ -632,9 +632,14 @@ multi_t2_fnd:
632 wake_up_process(task_to_wake); 632 wake_up_process(task_to_wake);
633 } else if ((is_valid_oplock_break(smb_buffer, server) == FALSE) 633 } else if ((is_valid_oplock_break(smb_buffer, server) == FALSE)
634 && (isMultiRsp == FALSE)) { 634 && (isMultiRsp == FALSE)) {
635 cERROR(1, ("No task to wake, unknown frame rcvd!")); 635 cERROR(1, ("No task to wake, unknown frame rcvd! NumMids %d", midCount.counter));
636 cifs_dump_mem("Received Data is: ",(char *)smb_buffer, 636 cifs_dump_mem("Received Data is: ",(char *)smb_buffer,
637 sizeof(struct smb_hdr)); 637 sizeof(struct smb_hdr));
638#ifdef CONFIG_CIFS_DEBUG2
639 cifs_dump_detail(smb_buffer);
640 cifs_dump_mids(server);
641#endif /* CIFS_DEBUG2 */
642
638 } 643 }
639 } /* end while !EXITING */ 644 } /* end while !EXITING */
640 645
@@ -976,7 +981,7 @@ cifs_parse_mount_options(char *options, const char *devname,struct smb_vol *vol)
976 } 981 }
977 /* BB are there cases in which a comma can be valid in 982 /* BB are there cases in which a comma can be valid in
978 a domain name and need special handling? */ 983 a domain name and need special handling? */
979 if (strnlen(value, 65) < 65) { 984 if (strnlen(value, 256) < 256) {
980 vol->domainname = value; 985 vol->domainname = value;
981 cFYI(1, ("Domain name set")); 986 cFYI(1, ("Domain name set"));
982 } else { 987 } else {
@@ -1762,9 +1767,14 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1762 if (volume_info.username) 1767 if (volume_info.username)
1763 strncpy(pSesInfo->userName, 1768 strncpy(pSesInfo->userName,
1764 volume_info.username,MAX_USERNAME_SIZE); 1769 volume_info.username,MAX_USERNAME_SIZE);
1765 if (volume_info.domainname) 1770 if (volume_info.domainname) {
1766 strncpy(pSesInfo->domainName, 1771 int len = strlen(volume_info.domainname);
1767 volume_info.domainname,MAX_USERNAME_SIZE); 1772 pSesInfo->domainName =
1773 kmalloc(len + 1, GFP_KERNEL);
1774 if(pSesInfo->domainName)
1775 strcpy(pSesInfo->domainName,
1776 volume_info.domainname);
1777 }
1768 pSesInfo->linux_uid = volume_info.linux_uid; 1778 pSesInfo->linux_uid = volume_info.linux_uid;
1769 down(&pSesInfo->sesSem); 1779 down(&pSesInfo->sesSem);
1770 rc = cifs_setup_session(xid,pSesInfo, cifs_sb->local_nls); 1780 rc = cifs_setup_session(xid,pSesInfo, cifs_sb->local_nls);
@@ -2054,7 +2064,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2054 bcc_ptr++; 2064 bcc_ptr++;
2055 } 2065 }
2056 if(user == NULL) 2066 if(user == NULL)
2057 bytes_returned = 0; /* skill null user */ 2067 bytes_returned = 0; /* skip null user */
2058 else 2068 else
2059 bytes_returned = 2069 bytes_returned =
2060 cifs_strtoUCS((__le16 *) bcc_ptr, user, 100, 2070 cifs_strtoUCS((__le16 *) bcc_ptr, user, 100,
@@ -2635,8 +2645,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2635 /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN | */ NTLMSSP_NEGOTIATE_128; 2645 /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN | */ NTLMSSP_NEGOTIATE_128;
2636 if(sign_CIFS_PDUs) 2646 if(sign_CIFS_PDUs)
2637 negotiate_flags |= NTLMSSP_NEGOTIATE_SIGN; 2647 negotiate_flags |= NTLMSSP_NEGOTIATE_SIGN;
2638 if(ntlmv2_support) 2648/* if(ntlmv2_support)
2639 negotiate_flags |= NTLMSSP_NEGOTIATE_NTLMV2; 2649 negotiate_flags |= NTLMSSP_NEGOTIATE_NTLMV2;*/
2640 /* setup pointers to domain name and workstation name */ 2650 /* setup pointers to domain name and workstation name */
2641 bcc_ptr += SecurityBlobLength; 2651 bcc_ptr += SecurityBlobLength;
2642 2652
@@ -3429,7 +3439,10 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
3429 } 3439 }
3430 /* else do not bother copying these informational fields */ 3440 /* else do not bother copying these informational fields */
3431 } 3441 }
3432 tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport); 3442 if(smb_buffer_response->WordCount == 3)
3443 tcon->Flags = le16_to_cpu(pSMBr->OptionalSupport);
3444 else
3445 tcon->Flags = 0;
3433 cFYI(1, ("Tcon flags: 0x%x ", tcon->Flags)); 3446 cFYI(1, ("Tcon flags: 0x%x ", tcon->Flags));
3434 } else if ((rc == 0) && tcon == NULL) { 3447 } else if ((rc == 0) && tcon == NULL) {
3435 /* all we need to save for IPC$ connection */ 3448 /* all we need to save for IPC$ connection */
@@ -3528,8 +3541,8 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo,
3528 pSesInfo->server->timeZone)); 3541 pSesInfo->server->timeZone));
3529#ifdef CONFIG_CIFS_EXPERIMENTAL 3542#ifdef CONFIG_CIFS_EXPERIMENTAL
3530 if(experimEnabled > 1) 3543 if(experimEnabled > 1)
3531 rc = CIFS_SessSetup(xid, pSesInfo, CIFS_NTLM /* type */, 3544 rc = CIFS_SessSetup(xid, pSesInfo,
3532 &ntlmv2_flag, nls_info); 3545 first_time, nls_info);
3533 else 3546 else
3534#endif 3547#endif
3535 if (extended_security 3548 if (extended_security