Commit 82edf0ac authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://cifs.bkbits.net/linux-2.5-with-cifs

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 54165329 9ab64854
...@@ -458,7 +458,7 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -458,7 +458,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
unsigned int cls, con, tag, oidlen, rc; unsigned int cls, con, tag, oidlen, rc;
int use_ntlmssp = FALSE; int use_ntlmssp = FALSE;
dump_mem(" Received SecBlob ", security_blob, length); /* cifs_dump_mem(" Received SecBlob ", security_blob, length); */
asn1_open(&ctx, security_blob, length); asn1_open(&ctx, security_blob, length);
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "cifs_debug.h" #include "cifs_debug.h"
void void
dump_mem(char *label, void *data, int length) cifs_dump_mem(char *label, void *data, int length)
{ {
int i, j; int i, j;
int *intptr = data; int *intptr = data;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#ifndef _H_CIFS_DEBUG #ifndef _H_CIFS_DEBUG
#define _H_CIFS_DEBUG #define _H_CIFS_DEBUG
void dump_mem(char *label, void *data, int length); void cifs_dump_mem(char *label, void *data, int length);
extern int traceSMB; /* flag which enables the function below */ extern int traceSMB; /* flag which enables the function below */
void dump_smb(struct smb_hdr *, int); void dump_smb(struct smb_hdr *, int);
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
/* All SMB/CIFS PDU handling routines go here - except for a few leftovers in connect.c */ /* SMB/CIFS PDU handling routines here - except for leftovers in connect.c */
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -85,7 +85,8 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses, ...@@ -85,7 +85,8 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses,
} }
pSMB->ByteCount = strlen(protocols[0].name) + 1; pSMB->ByteCount = strlen(protocols[0].name) + 1;
strncpy(pSMB->DialectsArray, protocols[0].name, 30); /* null guaranteed to be at end of source and target buffers anyway */ strncpy(pSMB->DialectsArray, protocols[0].name, 30);
/* null guaranteed to be at end of source and target buffers anyway */
pSMB->hdr.smb_buf_length += pSMB->ByteCount; pSMB->hdr.smb_buf_length += pSMB->ByteCount;
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
...@@ -94,17 +95,19 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses, ...@@ -94,17 +95,19 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses,
(struct smb_hdr *) pSMBr, &bytes_returned, 0); (struct smb_hdr *) pSMBr, &bytes_returned, 0);
if (rc == 0) { if (rc == 0) {
ses->dialectIndex = le16_to_cpu(pSMBr->DialectIndex); ses->dialectIndex = le16_to_cpu(pSMBr->DialectIndex);
ses->secMode = pSMBr->SecurityMode; /* one byte - no need to convert this or EncryptionKeyLen field from le, */ ses->secMode = pSMBr->SecurityMode;
/* one byte - no need to convert this or EncryptionKeyLen from le,*/
ses->maxReq = le16_to_cpu(pSMBr->MaxMpxCount); ses->maxReq = le16_to_cpu(pSMBr->MaxMpxCount);
/* probably no need to store and check maxvcs */ /* probably no need to store and check maxvcs */
ses->maxBuf = ses->maxBuf =
min(le32_to_cpu(pSMBr->MaxBufferSize), min(le32_to_cpu(pSMBr->MaxBufferSize),
(__u32) CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE); (__u32) CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE);
ses->maxRw = le32_to_cpu(pSMBr->MaxRawSize); /* BB le_to_host needed around here and ff */ ses->maxRw = le32_to_cpu(pSMBr->MaxRawSize);
cFYI(1, ("\nMax buf = %d ", ses->maxBuf)); cFYI(1, ("\nMax buf = %d ", ses->maxBuf));
GETU32(ses->sessid) = le32_to_cpu(pSMBr->SessionKey); GETU32(ses->sessid) = le32_to_cpu(pSMBr->SessionKey);
ses->capabilities = le32_to_cpu(pSMBr->Capabilities); ses->capabilities = le32_to_cpu(pSMBr->Capabilities);
ses->timeZone = le16_to_cpu(pSMBr->ServerTimeZone); /* BB with UTC do we ever need to be using srvr timezone? */ ses->timeZone = le16_to_cpu(pSMBr->ServerTimeZone);
/* BB with UTC do we ever need to be using srvr timezone? */
if (pSMBr->EncryptionKeyLength == CIFS_CRYPTO_KEY_SIZE) { if (pSMBr->EncryptionKeyLength == CIFS_CRYPTO_KEY_SIZE) {
memcpy(cryptokey, pSMBr->u.EncryptionKey, memcpy(cryptokey, pSMBr->u.EncryptionKey,
CIFS_CRYPTO_KEY_SIZE); CIFS_CRYPTO_KEY_SIZE);
...@@ -495,7 +498,6 @@ CIFSSMBRead(const int xid, const struct cifsTconInfo *tcon, ...@@ -495,7 +498,6 @@ CIFSSMBRead(const int xid, const struct cifsTconInfo *tcon,
pSMBr->DataLength = le16_to_cpu(pSMBr->DataLength); pSMBr->DataLength = le16_to_cpu(pSMBr->DataLength);
*nbytes = pSMBr->DataLength; *nbytes = pSMBr->DataLength;
/* BB check that DataLength would not go beyond end of SMB BB */ /* BB check that DataLength would not go beyond end of SMB BB */
/* if(pSMBr->DataOffset < pSMBr->ByteCount + sizeof(READ_RSP) - 1 *//* BB fix this length check */
if (pSMBr->DataLength > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE) { if (pSMBr->DataLength > CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE) {
rc = -EIO; rc = -EIO;
*nbytes = 0; *nbytes = 0;
...@@ -541,7 +543,7 @@ CIFSSMBWrite(const int xid, const struct cifsTconInfo *tcon, ...@@ -541,7 +543,7 @@ CIFSSMBWrite(const int xid, const struct cifsTconInfo *tcon,
pSMB->DataLengthLow = count; pSMB->DataLengthLow = count;
pSMB->DataLengthHigh = 0; pSMB->DataLengthHigh = 0;
pSMB->DataOffset = pSMB->DataOffset =
cpu_to_le16((int) &(pSMB->Data) - (int) pSMB->hdr.Protocol); cpu_to_le16(offsetof(struct smb_com_write_req,Data) - 4);
copy_from_user(pSMB->Data, buf, pSMB->DataLengthLow); copy_from_user(pSMB->Data, buf, pSMB->DataLengthLow);
pSMB->ByteCount += pSMB->DataLengthLow + 1 /* pad */ ; pSMB->ByteCount += pSMB->DataLengthLow + 1 /* pad */ ;
...@@ -685,7 +687,8 @@ CIFSSMBRename(const int xid, const struct cifsTconInfo *tcon, ...@@ -685,7 +687,8 @@ CIFSSMBRename(const int xid, const struct cifsTconInfo *tcon,
name_len2++; /* signature byte */ name_len2++; /* signature byte */
} }
pSMB->ByteCount = 1 /* 1st signature byte */ + name_len + name_len2; /* we could also set search attributes but not needed */ pSMB->ByteCount = 1 /* 1st signature byte */ + name_len + name_len2;
/* we could also set search attributes but not needed */
pSMB->hdr.smb_buf_length += pSMB->ByteCount; pSMB->hdr.smb_buf_length += pSMB->ByteCount;
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
...@@ -739,8 +742,8 @@ CIFSUnixCreateSymLink(const int xid, const struct cifsTconInfo *tcon, ...@@ -739,8 +742,8 @@ CIFSUnixCreateSymLink(const int xid, const struct cifsTconInfo *tcon,
pSMB->Flags = 0; pSMB->Flags = 0;
pSMB->Timeout = 0; pSMB->Timeout = 0;
pSMB->Reserved2 = 0; pSMB->Reserved2 = 0;
pSMB->ParameterOffset = pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req,
(int) &(pSMB->InformationLevel) - (int) pSMB->hdr.Protocol; InformationLevel) - 4;
pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount;
data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset;
...@@ -759,7 +762,7 @@ CIFSUnixCreateSymLink(const int xid, const struct cifsTconInfo *tcon, ...@@ -759,7 +762,7 @@ CIFSUnixCreateSymLink(const int xid, const struct cifsTconInfo *tcon,
pSMB->DataCount = name_len_target; pSMB->DataCount = name_len_target;
pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxParameterCount = cpu_to_le16(2);
pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ pSMB->MaxDataCount = cpu_to_le16(1000); /*BB find exact max SMB from sess */
pSMB->SetupCount = 1; pSMB->SetupCount = 1;
pSMB->Reserved3 = 0; pSMB->Reserved3 = 0;
pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
...@@ -825,8 +828,8 @@ CIFSUnixCreateHardLink(const int xid, const struct cifsTconInfo *tcon, ...@@ -825,8 +828,8 @@ CIFSUnixCreateHardLink(const int xid, const struct cifsTconInfo *tcon,
pSMB->Flags = 0; pSMB->Flags = 0;
pSMB->Timeout = 0; pSMB->Timeout = 0;
pSMB->Reserved2 = 0; pSMB->Reserved2 = 0;
pSMB->ParameterOffset = pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req,
(int) &(pSMB->InformationLevel) - (int) pSMB->hdr.Protocol; InformationLevel) - 4;
pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount;
data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset;
...@@ -845,7 +848,7 @@ CIFSUnixCreateHardLink(const int xid, const struct cifsTconInfo *tcon, ...@@ -845,7 +848,7 @@ CIFSUnixCreateHardLink(const int xid, const struct cifsTconInfo *tcon,
pSMB->DataCount = name_len_target; pSMB->DataCount = name_len_target;
pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxParameterCount = cpu_to_le16(2);
pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB from sess*/
pSMB->SetupCount = 1; pSMB->SetupCount = 1;
pSMB->Reserved3 = 0; pSMB->Reserved3 = 0;
pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION); pSMB->SubCommand = cpu_to_le16(TRANS2_SET_PATH_INFORMATION);
...@@ -983,9 +986,8 @@ CIFSSMBUnixQuerySymLink(const int xid, const struct cifsTconInfo *tcon, ...@@ -983,9 +986,8 @@ CIFSSMBUnixQuerySymLink(const int xid, const struct cifsTconInfo *tcon,
pSMB->Flags = 0; pSMB->Flags = 0;
pSMB->Timeout = 0; pSMB->Timeout = 0;
pSMB->Reserved2 = 0; pSMB->Reserved2 = 0;
pSMB->ParameterOffset = pSMB->ParameterOffset = cpu_to_le16(offsetof(
cpu_to_le16((int) &(pSMB->InformationLevel) - struct smb_com_transaction2_qpi_req ,InformationLevel) - 4);
(int) pSMB->hdr.Protocol);
pSMB->DataCount = 0; pSMB->DataCount = 0;
pSMB->DataOffset = 0; pSMB->DataOffset = 0;
pSMB->SetupCount = 1; pSMB->SetupCount = 1;
...@@ -1084,8 +1086,8 @@ CIFSSMBQPathInfo(const int xid, const struct cifsTconInfo *tcon, ...@@ -1084,8 +1086,8 @@ CIFSSMBQPathInfo(const int xid, const struct cifsTconInfo *tcon,
pSMB->Flags = 0; pSMB->Flags = 0;
pSMB->Timeout = 0; pSMB->Timeout = 0;
pSMB->Reserved2 = 0; pSMB->Reserved2 = 0;
pSMB->ParameterOffset = cpu_to_le16((int) &(pSMB->InformationLevel) pSMB->ParameterOffset = cpu_to_le16(offsetof(
- (int) pSMB->hdr.Protocol); struct smb_com_transaction2_qpi_req ,InformationLevel) - 4);
pSMB->DataCount = 0; pSMB->DataCount = 0;
pSMB->DataOffset = 0; pSMB->DataOffset = 0;
pSMB->SetupCount = 1; pSMB->SetupCount = 1;
...@@ -1161,9 +1163,8 @@ CIFSSMBUnixQPathInfo(const int xid, const struct cifsTconInfo *tcon, ...@@ -1161,9 +1163,8 @@ CIFSSMBUnixQPathInfo(const int xid, const struct cifsTconInfo *tcon,
pSMB->Flags = 0; pSMB->Flags = 0;
pSMB->Timeout = 0; pSMB->Timeout = 0;
pSMB->Reserved2 = 0; pSMB->Reserved2 = 0;
pSMB->ParameterOffset = pSMB->ParameterOffset = cpu_to_le16(offsetof(
cpu_to_le16((int) &(pSMB->InformationLevel) - struct smb_com_transaction2_qpi_req ,InformationLevel) - 4);
(int) pSMB->hdr.Protocol);
pSMB->DataCount = 0; pSMB->DataCount = 0;
pSMB->DataOffset = 0; pSMB->DataOffset = 0;
pSMB->SetupCount = 1; pSMB->SetupCount = 1;
...@@ -1238,9 +1239,8 @@ CIFSFindSingle(const int xid, const struct cifsTconInfo *tcon, ...@@ -1238,9 +1239,8 @@ CIFSFindSingle(const int xid, const struct cifsTconInfo *tcon,
pSMB->Flags = 0; pSMB->Flags = 0;
pSMB->Timeout = 0; pSMB->Timeout = 0;
pSMB->Reserved2 = 0; pSMB->Reserved2 = 0;
pSMB->ParameterOffset = pSMB->ParameterOffset = cpu_to_le16(
cpu_to_le16((int) &pSMB->InformationLevel - offsetof(struct smb_com_transaction2_ffirst_req,InformationLevel) - 4);
(int) &pSMB->hdr.Protocol);
pSMB->DataCount = 0; pSMB->DataCount = 0;
pSMB->DataOffset = 0; pSMB->DataOffset = 0;
pSMB->SetupCount = 1; /* one byte, no need to le convert */ pSMB->SetupCount = 1; /* one byte, no need to le convert */
...@@ -1321,9 +1321,8 @@ CIFSFindFirst(const int xid, const struct cifsTconInfo *tcon, ...@@ -1321,9 +1321,8 @@ CIFSFindFirst(const int xid, const struct cifsTconInfo *tcon,
pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ;
pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount);
pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterCount = pSMB->TotalParameterCount;
pSMB->ParameterOffset = pSMB->ParameterOffset = cpu_to_le16(offsetof(struct
cpu_to_le16((int) &pSMB->SearchAttributes - smb_com_transaction2_ffirst_req, SearchAttributes) - 4);
(int) &pSMB->hdr.Protocol);
pSMB->DataCount = 0; pSMB->DataCount = 0;
pSMB->DataOffset = 0; pSMB->DataOffset = 0;
pSMB->SetupCount = 1; /* one byte no need to make endian neutral */ pSMB->SetupCount = 1; /* one byte no need to make endian neutral */
...@@ -1407,8 +1406,8 @@ CIFSFindNext(const int xid, const struct cifsTconInfo *tcon, ...@@ -1407,8 +1406,8 @@ CIFSFindNext(const int xid, const struct cifsTconInfo *tcon,
pSMB->Flags = 0; pSMB->Flags = 0;
pSMB->Timeout = 0; pSMB->Timeout = 0;
pSMB->Reserved2 = 0; pSMB->Reserved2 = 0;
pSMB->ParameterOffset = pSMB->ParameterOffset = cpu_to_le16(offsetof(
cpu_to_le16((int) &pSMB->SearchHandle - (int) &pSMB->hdr.Protocol); struct smb_com_transaction2_fnext_req,SearchHandle) - 4);
pSMB->DataCount = 0; pSMB->DataCount = 0;
pSMB->DataOffset = 0; pSMB->DataOffset = 0;
pSMB->SetupCount = 1; pSMB->SetupCount = 1;
...@@ -1532,9 +1531,8 @@ CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses, ...@@ -1532,9 +1531,8 @@ CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses,
pSMB->Flags = 0; pSMB->Flags = 0;
pSMB->Timeout = 0; pSMB->Timeout = 0;
pSMB->Reserved2 = 0; pSMB->Reserved2 = 0;
pSMB->ParameterOffset = pSMB->ParameterOffset = cpu_to_le16(offsetof(
cpu_to_le16((int) &(pSMB->MaxReferralLevel) - struct smb_com_transaction2_get_dfs_refer_req, MaxReferralLevel) - 4);
(int) pSMB->hdr.Protocol);
pSMB->SetupCount = 1; pSMB->SetupCount = 1;
pSMB->Reserved3 = 0; pSMB->Reserved3 = 0;
pSMB->SubCommand = cpu_to_le16(TRANS2_GET_DFS_REFERRAL); pSMB->SubCommand = cpu_to_le16(TRANS2_GET_DFS_REFERRAL);
...@@ -1587,8 +1585,8 @@ CIFSSMBQFSInfo(const int xid, const struct cifsTconInfo *tcon, ...@@ -1587,8 +1585,8 @@ CIFSSMBQFSInfo(const int xid, const struct cifsTconInfo *tcon,
pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ;
pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount);
pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterCount = pSMB->TotalParameterCount;
pSMB->ParameterOffset = cpu_to_le16((int) &(pSMB->InformationLevel) pSMB->ParameterOffset = cpu_to_le16(offsetof(
- (int) pSMB->hdr.Protocol); struct smb_com_transaction2_qfsi_req, InformationLevel) - 4);
pSMB->DataCount = 0; pSMB->DataCount = 0;
pSMB->DataOffset = 0; pSMB->DataOffset = 0;
pSMB->SetupCount = 1; pSMB->SetupCount = 1;
...@@ -1662,8 +1660,8 @@ CIFSSMBQFSAttributeInfo(int xid, struct cifsTconInfo *tcon, ...@@ -1662,8 +1660,8 @@ CIFSSMBQFSAttributeInfo(int xid, struct cifsTconInfo *tcon,
pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ;
pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount);
pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterCount = pSMB->TotalParameterCount;
pSMB->ParameterOffset = cpu_to_le16((int) &(pSMB->InformationLevel) pSMB->ParameterOffset = cpu_to_le16(offsetof(
- (int) pSMB->hdr.Protocol); struct smb_com_transaction2_qfsi_req, InformationLevel) - 4);
pSMB->DataCount = 0; pSMB->DataCount = 0;
pSMB->DataOffset = 0; pSMB->DataOffset = 0;
pSMB->SetupCount = 1; pSMB->SetupCount = 1;
...@@ -1725,9 +1723,9 @@ CIFSSMBQFSDeviceInfo(int xid, struct cifsTconInfo *tcon, ...@@ -1725,9 +1723,9 @@ CIFSSMBQFSDeviceInfo(int xid, struct cifsTconInfo *tcon,
pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ; pSMB->ByteCount = pSMB->TotalParameterCount + 1 /* pad */ ;
pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount); pSMB->TotalParameterCount = cpu_to_le16(pSMB->TotalParameterCount);
pSMB->ParameterCount = pSMB->TotalParameterCount; pSMB->ParameterCount = pSMB->TotalParameterCount;
pSMB->ParameterOffset = pSMB->ParameterOffset = cpu_to_le16(offsetof(
cpu_to_le16((int) &(pSMB->InformationLevel) - struct smb_com_transaction2_qfsi_req, InformationLevel) - 4);
(int) pSMB->hdr.Protocol);
pSMB->DataCount = 0; pSMB->DataCount = 0;
pSMB->DataOffset = 0; pSMB->DataOffset = 0;
pSMB->SetupCount = 1; pSMB->SetupCount = 1;
...@@ -1743,7 +1741,8 @@ CIFSSMBQFSDeviceInfo(int xid, struct cifsTconInfo *tcon, ...@@ -1743,7 +1741,8 @@ CIFSSMBQFSDeviceInfo(int xid, struct cifsTconInfo *tcon,
cERROR(1, ("\nSend error in QFSDeviceInfo = %d\n", rc)); cERROR(1, ("\nSend error in QFSDeviceInfo = %d\n", rc));
} else { /* decode response */ } else { /* decode response */
pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset); pSMBr->DataOffset = le16_to_cpu(pSMBr->DataOffset);
if ((pSMBr->ByteCount < sizeof (FILE_SYSTEM_DEVICE_INFO)) || (pSMBr->DataOffset > 512)) /* BB also check enough bytes returned */ if ((pSMBr->ByteCount < sizeof (FILE_SYSTEM_DEVICE_INFO))
|| (pSMBr->DataOffset > 512))
rc = -EIO; /* bad smb */ rc = -EIO; /* bad smb */
else { else {
response_data = response_data =
...@@ -1790,9 +1789,8 @@ CIFSSMBQFSUnixInfo(int xid, struct cifsTconInfo *tcon, ...@@ -1790,9 +1789,8 @@ CIFSSMBQFSUnixInfo(int xid, struct cifsTconInfo *tcon,
pSMB->ByteCount = pSMB->ParameterCount + 1 /* pad */ ; pSMB->ByteCount = pSMB->ParameterCount + 1 /* pad */ ;
pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount); pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount);
pSMB->TotalParameterCount = pSMB->ParameterCount; pSMB->TotalParameterCount = pSMB->ParameterCount;
pSMB->ParameterOffset = pSMB->ParameterOffset = cpu_to_le16(offsetof(struct
cpu_to_le16((int) &(pSMB->InformationLevel) - smb_com_transaction2_qfsi_req, InformationLevel) - 4);
(int) pSMB->hdr.Protocol);
pSMB->SetupCount = 1; pSMB->SetupCount = 1;
pSMB->Reserved3 = 0; pSMB->Reserved3 = 0;
pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION); pSMB->SubCommand = cpu_to_le16(TRANS2_QUERY_FS_INFORMATION);
...@@ -1806,7 +1804,7 @@ CIFSSMBQFSUnixInfo(int xid, struct cifsTconInfo *tcon, ...@@ -1806,7 +1804,7 @@ CIFSSMBQFSUnixInfo(int xid, struct cifsTconInfo *tcon,
cERROR(1, ("\nSend error in QFSUnixInfo = %d\n", rc)); cERROR(1, ("\nSend error in QFSUnixInfo = %d\n", rc));
} else { /* decode response */ } else { /* decode response */
pSMBr->DataOffset = cpu_to_le16(pSMBr->DataOffset); pSMBr->DataOffset = cpu_to_le16(pSMBr->DataOffset);
if ((pSMBr->ByteCount < 13) || (pSMBr->DataOffset > 512)) { /* BB also check enough bytes returned */ if ((pSMBr->ByteCount < 13) || (pSMBr->DataOffset > 512)) {
rc = -EIO; /* bad smb */ rc = -EIO; /* bad smb */
} else { } else {
response_data = response_data =
...@@ -1862,14 +1860,14 @@ CIFSSMBSetEOF(int xid, struct cifsTconInfo *tcon, char *fileName, ...@@ -1862,14 +1860,14 @@ CIFSSMBSetEOF(int xid, struct cifsTconInfo *tcon, char *fileName,
pSMB->ParameterCount = 6 + name_len; pSMB->ParameterCount = 6 + name_len;
pSMB->DataCount = sizeof (struct file_end_of_file_info); pSMB->DataCount = sizeof (struct file_end_of_file_info);
pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxParameterCount = cpu_to_le16(2);
pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB size from sess */
pSMB->MaxSetupCount = 0; pSMB->MaxSetupCount = 0;
pSMB->Reserved = 0; pSMB->Reserved = 0;
pSMB->Flags = 0; pSMB->Flags = 0;
pSMB->Timeout = 0; pSMB->Timeout = 0;
pSMB->Reserved2 = 0; pSMB->Reserved2 = 0;
pSMB->ParameterOffset = pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req,
(int) &(pSMB->InformationLevel) - (int) pSMB->hdr.Protocol; InformationLevel) - 4;
pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount;
if(SetAllocation) { if(SetAllocation) {
if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU) if (tcon->ses->capabilities & CAP_INFOLEVEL_PASSTHRU)
...@@ -1946,15 +1944,15 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, ...@@ -1946,15 +1944,15 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
pSMB->Flags = 0; pSMB->Flags = 0;
pSMB->Timeout = 0; pSMB->Timeout = 0;
pSMB->Reserved2 = 0; pSMB->Reserved2 = 0;
pSMB->ParameterOffset = pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_sfi_req,
(int) &(pSMB->Fid) - (int) pSMB->hdr.Protocol; Fid) - 4;
pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount;
data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset;
pSMB->DataCount = sizeof(struct file_end_of_file_info); pSMB->DataCount = sizeof(struct file_end_of_file_info);
pSMB->MaxParameterCount = cpu_to_le16(2); pSMB->MaxParameterCount = cpu_to_le16(2);
pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find exact max SMB PDU from sess structure BB */ pSMB->MaxDataCount = cpu_to_le16(1000); /* BB find max SMB PDU from sess */
pSMB->SetupCount = 1; pSMB->SetupCount = 1;
pSMB->Reserved3 = 0; pSMB->Reserved3 = 0;
pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION); pSMB->SubCommand = cpu_to_le16(TRANS2_SET_FILE_INFORMATION);
...@@ -2042,8 +2040,8 @@ CIFSSMBSetTimes(int xid, struct cifsTconInfo *tcon, char *fileName, ...@@ -2042,8 +2040,8 @@ CIFSSMBSetTimes(int xid, struct cifsTconInfo *tcon, char *fileName,
pSMB->Flags = 0; pSMB->Flags = 0;
pSMB->Timeout = 0; pSMB->Timeout = 0;
pSMB->Reserved2 = 0; pSMB->Reserved2 = 0;
pSMB->ParameterOffset = pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req,
(int) &(pSMB->InformationLevel) - (int) pSMB->hdr.Protocol; InformationLevel) - 4;
pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount;
data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset; data_offset = (char *) (&pSMB->hdr.Protocol) + pSMB->DataOffset;
pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset); pSMB->ParameterOffset = cpu_to_le16(pSMB->ParameterOffset);
...@@ -2118,8 +2116,8 @@ CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *tcon, ...@@ -2118,8 +2116,8 @@ CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *tcon,
pSMB->Flags = 0; pSMB->Flags = 0;
pSMB->Timeout = 0; pSMB->Timeout = 0;
pSMB->Reserved2 = 0; pSMB->Reserved2 = 0;
pSMB->ParameterOffset = pSMB->ParameterOffset = offsetof(struct smb_com_transaction2_spi_req,
(int) &(pSMB->InformationLevel) - (int) pSMB->hdr.Protocol; InformationLevel) - 4;
pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount; pSMB->DataOffset = pSMB->ParameterOffset + pSMB->ParameterCount;
data_offset = data_offset =
(FILE_UNIX_BASIC_INFO *) ((char *) &pSMB->hdr.Protocol + (FILE_UNIX_BASIC_INFO *) ((char *) &pSMB->hdr.Protocol +
...@@ -2138,9 +2136,7 @@ CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *tcon, ...@@ -2138,9 +2136,7 @@ CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *tcon,
pSMB->Reserved4 = 0; pSMB->Reserved4 = 0;
pSMB->hdr.smb_buf_length += pSMB->ByteCount; pSMB->hdr.smb_buf_length += pSMB->ByteCount;
data_offset->Uid = cpu_to_le64(uid); data_offset->Uid = cpu_to_le64(uid);
cFYI(1, ("\nUid = %lld from %lld ", data_offset->Uid, uid));
data_offset->Gid = cpu_to_le64(gid); data_offset->Gid = cpu_to_le64(gid);
cFYI(1, ("\nGid = %lld from %lld ", data_offset->Gid, gid));
data_offset->Permissions = cpu_to_le64(mode); data_offset->Permissions = cpu_to_le64(mode);
pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount); pSMB->ByteCount = cpu_to_le16(pSMB->ByteCount);
rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB,
......
...@@ -168,7 +168,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server) ...@@ -168,7 +168,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
} else if (temp[0] != (char) 0) { } else if (temp[0] != (char) 0) {
cERROR(1, cERROR(1,
("\nUnknown RFC 1001 frame received not 0x00 nor 0x85")); ("\nUnknown RFC 1001 frame received not 0x00 nor 0x85"));
dump_mem(" Received Data is: ", temp, length); cifs_dump_mem(" Received Data is: ", temp, length);
break; break;
} else { } else {
if ((length != sizeof (struct smb_hdr) - 1) if ((length != sizeof (struct smb_hdr) - 1)
...@@ -757,8 +757,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, ...@@ -757,8 +757,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
/* Removed following few lines to not send old style password /* Removed following few lines to not send old style password
hash ever - for better security */ hash ever - for better security */
/* toUpper(cifs_sb->local_nls, password_with_pad); /* toUpper(cifs_sb->local_nls, password_with_pad);
SMBencrypt(password_with_pad, cryptKey,session_key); SMBencrypt(password_with_pad, cryptKey,session_key); */
dump_mem("\nCIFS (Samba encrypt): ", session_key,CIFS_SESSION_KEY_SIZE); */
rc = CIFSSessSetup(xid, pSesInfo, rc = CIFSSessSetup(xid, pSesInfo,
volume_info.username, volume_info.username,
...@@ -925,7 +924,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, char *user, ...@@ -925,7 +924,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, char *user,
bcc_ptr += CIFS_SESSION_KEY_SIZE; bcc_ptr += CIFS_SESSION_KEY_SIZE;
if (ses->capabilities & CAP_UNICODE) { if (ses->capabilities & CAP_UNICODE) {
if ((int) bcc_ptr % 2) { /* must be word aligned for Unicode */ if ((long) bcc_ptr % 2) { /* must be word aligned for Unicode */
*bcc_ptr = 0; *bcc_ptr = 0;
bcc_ptr++; bcc_ptr++;
} }
...@@ -983,13 +982,12 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, char *user, ...@@ -983,13 +982,12 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, char *user,
strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); strcpy(bcc_ptr, CIFS_NETWORK_OPSYS);
bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1;
} }
BCC(smb_buffer) = (int) bcc_ptr - (int) pByteArea(smb_buffer); BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer);
smb_buffer->smb_buf_length += BCC(smb_buffer); smb_buffer->smb_buf_length += BCC(smb_buffer);
BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer));
rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response,
&bytes_returned, 1); &bytes_returned, 1);
/* dump_mem("\nSessSetup response is: ", smb_buffer_response, 92);*/
if (rc) { if (rc) {
/* rc = map_smb_to_linux_error(smb_buffer_response); now done in SendReceive */ /* rc = map_smb_to_linux_error(smb_buffer_response); now done in SendReceive */
} else if ((smb_buffer_response->WordCount == 3) } else if ((smb_buffer_response->WordCount == 3)
...@@ -1011,7 +1009,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, char *user, ...@@ -1011,7 +1009,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, char *user,
pSMBr->resp.SecurityBlobLength; pSMBr->resp.SecurityBlobLength;
if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) { if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) {
if ((int) (bcc_ptr) % 2) { if ((long) (bcc_ptr) % 2) {
remaining_words = remaining_words =
(BCC(smb_buffer_response) (BCC(smb_buffer_response)
- 1) / 2; - 1) / 2;
...@@ -1069,7 +1067,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, char *user, ...@@ -1069,7 +1067,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses, char *user,
} else { /* ASCII */ } else { /* ASCII */
len = strnlen(bcc_ptr, 1024); len = strnlen(bcc_ptr, 1024);
if (((int) bcc_ptr + len) - (int) if (((long) bcc_ptr + len) - (long)
pByteArea(smb_buffer_response) pByteArea(smb_buffer_response)
<= BCC(smb_buffer_response)) { <= BCC(smb_buffer_response)) {
ses->serverOS = kcalloc(len + 1,GFP_KERNEL); ses->serverOS = kcalloc(len + 1,GFP_KERNEL);
...@@ -1176,7 +1174,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, ...@@ -1176,7 +1174,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
bcc_ptr += SecurityBlobLength; bcc_ptr += SecurityBlobLength;
if (ses->capabilities & CAP_UNICODE) { if (ses->capabilities & CAP_UNICODE) {
if ((int) bcc_ptr % 2) { /* must be word aligned for Unicode strings */ if ((long) bcc_ptr % 2) { /* must be word aligned for Unicode strings */
*bcc_ptr = 0; *bcc_ptr = 0;
bcc_ptr++; bcc_ptr++;
} }
...@@ -1229,13 +1227,12 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, ...@@ -1229,13 +1227,12 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
strcpy(bcc_ptr, CIFS_NETWORK_OPSYS); strcpy(bcc_ptr, CIFS_NETWORK_OPSYS);
bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1; bcc_ptr += strlen(CIFS_NETWORK_OPSYS) + 1;
} }
BCC(smb_buffer) = (int) bcc_ptr - (int) pByteArea(smb_buffer); BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer);
smb_buffer->smb_buf_length += BCC(smb_buffer); smb_buffer->smb_buf_length += BCC(smb_buffer);
BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer));
rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response,
&bytes_returned, 1); &bytes_returned, 1);
/* dump_mem("\nSessSetup response is: ", smb_buffer_response, 92); */
if (rc) { if (rc) {
/* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */ /* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */
} else if ((smb_buffer_response->WordCount == 3) } else if ((smb_buffer_response->WordCount == 3)
...@@ -1265,7 +1262,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, ...@@ -1265,7 +1262,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
} }
if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) { if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) {
if ((int) (bcc_ptr) % 2) { if ((long) (bcc_ptr) % 2) {
remaining_words = remaining_words =
(BCC(smb_buffer_response) (BCC(smb_buffer_response)
- 1) / 2; - 1) / 2;
...@@ -1328,7 +1325,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses, ...@@ -1328,7 +1325,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
} else { /* ASCII */ } else { /* ASCII */
len = strnlen(bcc_ptr, 1024); len = strnlen(bcc_ptr, 1024);
if (((int) bcc_ptr + len) - (int) if (((long) bcc_ptr + len) - (long)
pByteArea(smb_buffer_response) pByteArea(smb_buffer_response)
<= BCC(smb_buffer_response)) { <= BCC(smb_buffer_response)) {
ses->serverOS = kcalloc(len + 1, GFP_KERNEL); ses->serverOS = kcalloc(len + 1, GFP_KERNEL);
...@@ -1465,16 +1462,16 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, ...@@ -1465,16 +1462,16 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
SecurityBlob->DomainName.MaximumLength = SecurityBlob->DomainName.MaximumLength =
cpu_to_le16(SecurityBlob->DomainName.Length); cpu_to_le16(SecurityBlob->DomainName.Length);
SecurityBlob->DomainName.Buffer = SecurityBlob->DomainName.Buffer =
cpu_to_le32((unsigned int) &SecurityBlob-> cpu_to_le32((long) &SecurityBlob->
DomainString - DomainString -
(unsigned int) &SecurityBlob->Signature); (long) &SecurityBlob->Signature);
bcc_ptr += SecurityBlob->DomainName.Length; bcc_ptr += SecurityBlob->DomainName.Length;
SecurityBlobLength += SecurityBlob->DomainName.Length; SecurityBlobLength += SecurityBlob->DomainName.Length;
SecurityBlob->DomainName.Length = SecurityBlob->DomainName.Length =
cpu_to_le16(SecurityBlob->DomainName.Length); cpu_to_le16(SecurityBlob->DomainName.Length);
} }
if (ses->capabilities & CAP_UNICODE) { if (ses->capabilities & CAP_UNICODE) {
if ((int) bcc_ptr % 2) { if ((long) bcc_ptr % 2) {
*bcc_ptr = 0; *bcc_ptr = 0;
bcc_ptr++; bcc_ptr++;
} }
...@@ -1511,7 +1508,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, ...@@ -1511,7 +1508,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
SecurityBlob->NegotiateFlags = SecurityBlob->NegotiateFlags =
cpu_to_le32(SecurityBlob->NegotiateFlags); cpu_to_le32(SecurityBlob->NegotiateFlags);
pSMB->req.SecurityBlobLength = cpu_to_le16(SecurityBlobLength); pSMB->req.SecurityBlobLength = cpu_to_le16(SecurityBlobLength);
BCC(smb_buffer) = (int) bcc_ptr - (int) pByteArea(smb_buffer); BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer);
smb_buffer->smb_buf_length += BCC(smb_buffer); smb_buffer->smb_buf_length += BCC(smb_buffer);
BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer));
...@@ -1564,7 +1561,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, ...@@ -1564,7 +1561,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
if(SecurityBlob2->NegotiateFlags & NTLMSSP_NEGOTIATE_NTLMV2) if(SecurityBlob2->NegotiateFlags & NTLMSSP_NEGOTIATE_NTLMV2)
*pNTLMv2_flag = TRUE; *pNTLMv2_flag = TRUE;
if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) { if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) {
if ((int) (bcc_ptr) % 2) { if ((long) (bcc_ptr) % 2) {
remaining_words = remaining_words =
(BCC(smb_buffer_response) (BCC(smb_buffer_response)
- 1) / 2; - 1) / 2;
...@@ -1650,7 +1647,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, ...@@ -1650,7 +1647,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
} else { /* ASCII */ } else { /* ASCII */
len = strnlen(bcc_ptr, 1024); len = strnlen(bcc_ptr, 1024);
if (((int) bcc_ptr + len) - (int) if (((long) bcc_ptr + len) - (long)
pByteArea(smb_buffer_response) pByteArea(smb_buffer_response)
<= BCC(smb_buffer_response)) { <= BCC(smb_buffer_response)) {
ses->serverOS = ses->serverOS =
...@@ -1846,7 +1843,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, ...@@ -1846,7 +1843,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
SecurityBlobLength += SecurityBlob->WorkstationName.Length; SecurityBlobLength += SecurityBlob->WorkstationName.Length;
SecurityBlob->WorkstationName.Length = cpu_to_le16(SecurityBlob->WorkstationName.Length); */ SecurityBlob->WorkstationName.Length = cpu_to_le16(SecurityBlob->WorkstationName.Length); */
if ((int) bcc_ptr % 2) { if ((long) bcc_ptr % 2) {
*bcc_ptr = 0; *bcc_ptr = 0;
bcc_ptr++; bcc_ptr++;
} }
...@@ -1918,7 +1915,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, ...@@ -1918,7 +1915,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
SecurityBlob->NegotiateFlags = SecurityBlob->NegotiateFlags =
cpu_to_le32(SecurityBlob->NegotiateFlags); cpu_to_le32(SecurityBlob->NegotiateFlags);
pSMB->req.SecurityBlobLength = cpu_to_le16(SecurityBlobLength); pSMB->req.SecurityBlobLength = cpu_to_le16(SecurityBlobLength);
BCC(smb_buffer) = (int) bcc_ptr - (int) pByteArea(smb_buffer); BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer);
smb_buffer->smb_buf_length += BCC(smb_buffer); smb_buffer->smb_buf_length += BCC(smb_buffer);
BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer));
...@@ -1959,7 +1956,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, ...@@ -1959,7 +1956,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
("\nNTLMSSP response to Authenticate ")); ("\nNTLMSSP response to Authenticate "));
if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) { if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) {
if ((int) (bcc_ptr) % 2) { if ((long) (bcc_ptr) % 2) {
remaining_words = remaining_words =
(BCC(smb_buffer_response) (BCC(smb_buffer_response)
- 1) / 2; - 1) / 2;
...@@ -2037,8 +2034,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, ...@@ -2037,8 +2034,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
} else { /* ASCII */ } else { /* ASCII */
len = strnlen(bcc_ptr, 1024); len = strnlen(bcc_ptr, 1024);
if (((int) bcc_ptr + len) - if (((long) bcc_ptr + len) -
(int) pByteArea(smb_buffer_response) (long) pByteArea(smb_buffer_response)
<= BCC(smb_buffer_response)) { <= BCC(smb_buffer_response)) {
ses->serverOS = kcalloc(len + 1,GFP_KERNEL); ses->serverOS = kcalloc(len + 1,GFP_KERNEL);
strncpy(ses->serverOS,bcc_ptr, len); strncpy(ses->serverOS,bcc_ptr, len);
...@@ -2142,7 +2139,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, ...@@ -2142,7 +2139,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
strcpy(bcc_ptr, "?????"); strcpy(bcc_ptr, "?????");
bcc_ptr += strlen("?????"); bcc_ptr += strlen("?????");
bcc_ptr += 1; bcc_ptr += 1;
BCC(smb_buffer) = (int) bcc_ptr - (int) pByteArea(smb_buffer); BCC(smb_buffer) = (long) bcc_ptr - (long) pByteArea(smb_buffer);
smb_buffer->smb_buf_length += BCC(smb_buffer); smb_buffer->smb_buf_length += BCC(smb_buffer);
BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer)); BCC(smb_buffer) = cpu_to_le16(BCC(smb_buffer));
...@@ -2159,8 +2156,8 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, ...@@ -2159,8 +2156,8 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
strncpy(tcon->treeName, tree, MAX_TREE_SIZE); strncpy(tcon->treeName, tree, MAX_TREE_SIZE);
if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) { if (smb_buffer->Flags2 &= SMBFLG2_UNICODE) {
length = UniStrnlen((wchar_t *) bcc_ptr, 512); length = UniStrnlen((wchar_t *) bcc_ptr, 512);
if (((int) bcc_ptr + (2 * length)) - if (((long) bcc_ptr + (2 * length)) -
(int) pByteArea(smb_buffer_response) <= (long) pByteArea(smb_buffer_response) <=
BCC(smb_buffer_response)) { BCC(smb_buffer_response)) {
tcon->nativeFileSystem = tcon->nativeFileSystem =
kcalloc(length + 2, GFP_KERNEL); kcalloc(length + 2, GFP_KERNEL);
...@@ -2175,8 +2172,8 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses, ...@@ -2175,8 +2172,8 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
/* else do not bother copying these informational fields */ /* else do not bother copying these informational fields */
} else { } else {
length = strnlen(bcc_ptr, 1024); length = strnlen(bcc_ptr, 1024);
if (((int) bcc_ptr + length) - if (((long) bcc_ptr + length) -
(int) pByteArea(smb_buffer_response) <= (long) pByteArea(smb_buffer_response) <=
BCC(smb_buffer_response)) { BCC(smb_buffer_response)) {
tcon->nativeFileSystem = tcon->nativeFileSystem =
kcalloc(length + 1, GFP_KERNEL); kcalloc(length + 1, GFP_KERNEL);
......
...@@ -572,9 +572,6 @@ fill_in_inode(struct inode *tmp_inode, ...@@ -572,9 +572,6 @@ fill_in_inode(struct inode *tmp_inode,
tmp_inode->i_size = pfindData->EndOfFile; tmp_inode->i_size = pfindData->EndOfFile;
tmp_inode->i_blocks = tmp_inode->i_blocks =
do_div(pfindData->AllocationSize, tmp_inode->i_blksize); do_div(pfindData->AllocationSize, tmp_inode->i_blksize);
cFYI(1,
("\nFinddata alloc size (from smb) %lld",
pfindData->AllocationSize));
if (pfindData->AllocationSize < pfindData->EndOfFile) if (pfindData->AllocationSize < pfindData->EndOfFile)
cFYI(1, ("\nServer inconsistency Error: it says allocation size less than end of file ")); cFYI(1, ("\nServer inconsistency Error: it says allocation size less than end of file "));
cFYI(1, cFYI(1,
...@@ -652,10 +649,6 @@ unix_fill_in_inode(struct inode *tmp_inode, ...@@ -652,10 +649,6 @@ unix_fill_in_inode(struct inode *tmp_inode,
tmp_inode->i_size = pfindData->EndOfFile; tmp_inode->i_size = pfindData->EndOfFile;
tmp_inode->i_blocks = tmp_inode->i_blocks =
do_div(pfindData->NumOfBytes, tmp_inode->i_blksize); do_div(pfindData->NumOfBytes, tmp_inode->i_blksize);
cFYI(0, ("\nFinddata alloc size (from smb) %lld", pfindData->NumOfBytes)); /* BB remove */
if (pfindData->NumOfBytes < pfindData->EndOfFile)
cFYI(0, ("\nServer inconsistency Error: it says allocation size less than end of file ")); /* BB remove */
cFYI(1, ("\nCIFS FFIRST: Size %ld and blocks %ld ", (unsigned long) tmp_inode->i_size, tmp_inode->i_blocks)); /* BB remove */
if (S_ISREG(tmp_inode->i_mode)) { if (S_ISREG(tmp_inode->i_mode)) {
cFYI(1, (" File inode ")); cFYI(1, (" File inode "));
tmp_inode->i_op = &cifs_file_inode_ops; tmp_inode->i_op = &cifs_file_inode_ops;
......
...@@ -131,9 +131,6 @@ cifs_get_inode_info_unix(struct inode **pinode, ...@@ -131,9 +131,6 @@ cifs_get_inode_info_unix(struct inode **pinode,
inode->i_blksize = inode->i_blksize =
(pTcon->ses->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFE00; (pTcon->ses->maxBuf - MAX_CIFS_HDR_SIZE) & 0xFFFFFE00;
inode->i_blocks = do_div(findData.NumOfBytes, inode->i_blksize); inode->i_blocks = do_div(findData.NumOfBytes, inode->i_blksize);
cFYI(1,
("\nFinddata alloc size (from smb) %lld",
findData.NumOfBytes));
if (findData.NumOfBytes < findData.EndOfFile) if (findData.NumOfBytes < findData.EndOfFile)
cFYI(1, ("\nServer inconsistency Error: it says allocation size less than end of file ")); cFYI(1, ("\nServer inconsistency Error: it says allocation size less than end of file "));
cFYI(1, cFYI(1,
......
...@@ -694,8 +694,8 @@ const struct nt_err_code_struct nt_errs[] = { ...@@ -694,8 +694,8 @@ const struct nt_err_code_struct nt_errs[] = {
/***************************************************************************** /*****************************************************************************
Print an error message from the status code Print an error message from the status code
*****************************************************************************/ *****************************************************************************/
void /* void
print_status(__u32 status_code) cifs_print_status(__u32 status_code)
{ {
int idx = 0; int idx = 0;
...@@ -709,4 +709,4 @@ print_status(__u32 status_code) ...@@ -709,4 +709,4 @@ print_status(__u32 status_code)
idx++; idx++;
} }
return; return;
} } */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment