Merge with /pub/scm/linux/kernel/git/torvalds/linux-2.6.git
authorSteve French <sfrench@us.ibm.com>
Wed, 22 Feb 2006 23:38:53 +0000 (23:38 +0000)
committerSteve French <sfrench@us.ibm.com>
Wed, 22 Feb 2006 23:38:53 +0000 (23:38 +0000)
Signed-off-by: Steve French <sfrench@us.ibm.com>
1  2 
fs/cifs/cifssmb.c
fs/cifs/connect.c

diff --combined fs/cifs/cifssmb.c
index 38ab9f67c5f41c3a24b8862e4428c570a76182bc,b41e8b379652b228377f01d1d20bfaa47c3883e8..9d7bbd225effd0383b32264e832a35a33fd6d36c
@@@ -1,7 -1,7 +1,7 @@@
  /*
   *   fs/cifs/cifssmb.c
   *
 - *   Copyright (C) International Business Machines  Corp., 2002,2005
 + *   Copyright (C) International Business Machines  Corp., 2002,2006
   *   Author(s): Steve French (sfrench@us.ibm.com)
   *
   *   Contains the routines for constructing the SMB PDUs themselves
@@@ -186,35 -186,7 +186,35 @@@ small_smb_init(int smb_command, int wct
                  cifs_stats_inc(&tcon->num_smbs_sent);
  
        return rc;
 -}  
 +}
 +
 +#ifdef CONFIG_CIFS_EXPERIMENTAL  
 +int
 +small_smb_init_no_tc(const int smb_command, const int wct, 
 +                   struct cifsSesInfo *ses, void **request_buf)
 +{
 +      int rc;
 +      struct smb_hdr * buffer;
 +
 +      rc = small_smb_init(smb_command, wct, NULL, request_buf);
 +      if(rc)
 +              return rc;
 +
 +      buffer = (struct smb_hdr *)*request_buf;
 +      buffer->Mid = GetNextMid(ses->server);
 +      if (ses->capabilities & CAP_UNICODE)
 +              buffer->Flags2 |= SMBFLG2_UNICODE;
 +      if (ses->capabilities & CAP_STATUS32)
 +              buffer->Flags2 |= SMBFLG2_ERR_STATUS;
 +
 +      /* uid, tid can stay at zero as set in header assemble */
 +
 +      /* BB add support for turning on the signing when 
 +      this function is used after 1st of session setup requests */
 +
 +      return rc;
 +}
 +#endif  /* CONFIG_CIFS_EXPERIMENTAL */
  
  /* If the return code is zero, this function must fill in request_buf pointer */
  static int
@@@ -1076,13 -1048,14 +1076,14 @@@ CIFSSMBRead(const int xid, struct cifsT
                        cifs_small_buf_release(iov[0].iov_base);
                else if(resp_buf_type == CIFS_LARGE_BUFFER)
                        cifs_buf_release(iov[0].iov_base);
-       } else /* return buffer to caller to free */ /* BB FIXME how do we tell caller if it is not a large buffer */ {
-               *buf = iov[0].iov_base;
+       } else if(resp_buf_type != CIFS_NO_BUFFER) {
+               /* return buffer to caller to free */ 
+               *buf = iov[0].iov_base;         
                if(resp_buf_type == CIFS_SMALL_BUFFER)
                        *pbuf_type = CIFS_SMALL_BUFFER;
                else if(resp_buf_type == CIFS_LARGE_BUFFER)
                        *pbuf_type = CIFS_LARGE_BUFFER;
-       }
+       } /* else no valid buffer on return - leave as null */
  
        /* Note: On -EAGAIN error only caller can retry on handle based calls
                since file handle passed in no longer valid */
diff --combined fs/cifs/connect.c
index 0e1560ac5ad77726b23e87d872e7c1537b2e9766,ef5ae6f93c75daa4129128095a0cd0c490d949da..16535b510a968f66e9426180da1b76fcbddc9b07
@@@ -1,7 -1,7 +1,7 @@@
  /*
   *   fs/cifs/connect.c
   *
 - *   Copyright (C) International Business Machines  Corp., 2002,2005
 + *   Copyright (C) International Business Machines  Corp., 2002,2006
   *   Author(s): Steve French (sfrench@us.ibm.com)
   *
   *   This library is free software; you can redistribute it and/or modify
@@@ -1795,10 -1795,10 +1795,10 @@@ cifs_mount(struct super_block *sb, stru
                           conjunction with 52K kvec constraint on arch with 4K
                           page size  */
  
-               if(cifs_sb->rsize < PAGE_CACHE_SIZE) {
-                       cifs_sb->rsize = PAGE_CACHE_SIZE
-                       /* Windows ME does this */
-                       cFYI(1,("Attempt to set readsize for mount to less than one page (4096)"));
+               if(cifs_sb->rsize < 2048) {
+                       cifs_sb->rsize = 2048
+                       /* Windows ME may prefer this */
+                       cFYI(1,("readsize set to minimum 2048"));
                }
                cifs_sb->mnt_uid = volume_info.linux_uid;
                cifs_sb->mnt_gid = volume_info.linux_gid;
@@@ -2525,7 -2525,7 +2525,7 @@@ CIFSNTLMSSPNegotiateSessSetup(unsigned 
        __u32 negotiate_flags, capabilities;
        __u16 count;
  
 -      cFYI(1, ("In NTLMSSP sesssetup (negotiate) "));
 +      cFYI(1, ("In NTLMSSP sesssetup (negotiate)"));
        if(ses == NULL)
                return -EINVAL;
        domain = ses->domainName;
        SecurityBlob->MessageType = NtLmNegotiate;
        negotiate_flags =
            NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_NEGOTIATE_OEM |
 -          NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_NTLM | 0x80000000 |
 +          NTLMSSP_REQUEST_TARGET | NTLMSSP_NEGOTIATE_NTLM |
 +          NTLMSSP_NEGOTIATE_56 |
            /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN | */ NTLMSSP_NEGOTIATE_128;
        if(sign_CIFS_PDUs)
                negotiate_flags |= NTLMSSP_NEGOTIATE_SIGN;
        SecurityBlob->WorkstationName.Length = 0;
        SecurityBlob->WorkstationName.MaximumLength = 0;
  
 -      if (domain == NULL) {
 -              SecurityBlob->DomainName.Buffer = 0;
 -              SecurityBlob->DomainName.Length = 0;
 -              SecurityBlob->DomainName.MaximumLength = 0;
 -      } else {
 -              __u16 len;
 -              negotiate_flags |= NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED;
 -              strncpy(bcc_ptr, domain, 63);
 -              len = strnlen(domain, 64);
 -              SecurityBlob->DomainName.MaximumLength =
 -                  cpu_to_le16(len);
 -              SecurityBlob->DomainName.Buffer =
 -                  cpu_to_le32((long) &SecurityBlob->
 -                              DomainString -
 -                              (long) &SecurityBlob->Signature);
 -              bcc_ptr += len;
 -              SecurityBlobLength += len;
 -              SecurityBlob->DomainName.Length =
 -                  cpu_to_le16(len);
 -      }
 +      /* Domain not sent on first Sesssetup in NTLMSSP, instead it is sent
 +      along with username on auth request (ie the response to challenge) */
 +      SecurityBlob->DomainName.Buffer = 0;
 +      SecurityBlob->DomainName.Length = 0;
 +      SecurityBlob->DomainName.MaximumLength = 0;
        if (ses->capabilities & CAP_UNICODE) {
                if ((long) bcc_ptr % 2) {
                        *bcc_ptr = 0;
                              SecurityBlob2->MessageType));
                } else if (ses) {
                        ses->Suid = smb_buffer_response->Uid; /* UID left in le format */ 
 -                      cFYI(1, ("UID = %d ", ses->Suid));
 +                      cFYI(1, ("UID = %d", ses->Suid));
                        if ((pSMBr->resp.hdr.WordCount == 3)
                            || ((pSMBr->resp.hdr.WordCount == 4)
                                && (blob_len <
  
                                if (pSMBr->resp.hdr.WordCount == 4) {
                                        bcc_ptr += blob_len;
 -                                      cFYI(1,
 -                                           ("Security Blob Length %d ",
 +                                      cFYI(1, ("Security Blob Length %d",
                                              blob_len));
                                }
  
 -                              cFYI(1, ("NTLMSSP Challenge rcvd "));
 +                              cFYI(1, ("NTLMSSP Challenge rcvd"));
  
                                memcpy(ses->server->cryptKey,
                                       SecurityBlob2->Challenge,
                                       CIFS_CRYPTO_KEY_SIZE);
 -                              if(SecurityBlob2->NegotiateFlags & cpu_to_le32(NTLMSSP_NEGOTIATE_NTLMV2))
 +                              if(SecurityBlob2->NegotiateFlags & 
 +                                      cpu_to_le32(NTLMSSP_NEGOTIATE_NTLMV2))
                                        *pNTLMv2_flag = TRUE;
  
                                if((SecurityBlob2->NegotiateFlags & 
                                                bcc_ptr++;
                                        } else
                                                cFYI(1,
 -                                                   ("Variable field of length %d extends beyond end of smb ",
 +                                                   ("Variable field of length %d extends beyond end of smb",
                                                      len));
                                }
                        } else {
                }
        } else {
                cERROR(1,
 -                     (" Invalid Word count %d: ",
 +                     (" Invalid Word count %d:",
                        smb_buffer_response->WordCount));
                rc = -EIO;
        }
@@@ -3433,7 -3447,7 +3433,7 @@@ int cifs_setup_session(unsigned int xid
                if (extended_security
                                && (pSesInfo->capabilities & CAP_EXTENDED_SECURITY)
                                && (pSesInfo->server->secType == NTLMSSP)) {
 -                      cFYI(1, ("New style sesssetup "));
 +                      cFYI(1, ("New style sesssetup"));
                        rc = CIFSSpnegoSessSetup(xid, pSesInfo,
                                NULL /* security blob */, 
                                0 /* blob length */,
                } else if (extended_security
                           && (pSesInfo->capabilities & CAP_EXTENDED_SECURITY)
                           && (pSesInfo->server->secType == RawNTLMSSP)) {
 -                      cFYI(1, ("NTLMSSP sesssetup "));
 +                      cFYI(1, ("NTLMSSP sesssetup"));
                        rc = CIFSNTLMSSPNegotiateSessSetup(xid,
                                                pSesInfo,
                                                &ntlmv2_flag,