Commit ce1e78cd authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] cifs: annotate NEGOTIATE_{REQ,RESP}

Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ab54c114
......@@ -373,23 +373,23 @@ struct smb_hdr {
typedef struct negotiate_req {
struct smb_hdr hdr; /* wct = 0 */
__u16 ByteCount;
__le16 ByteCount;
unsigned char DialectsArray[1];
} NEGOTIATE_REQ;
typedef struct negotiate_rsp {
struct smb_hdr hdr; /* wct = 17 */
__u16 DialectIndex;
__le16 DialectIndex;
__u8 SecurityMode;
__u16 MaxMpxCount;
__u16 MaxNumberVcs;
__u32 MaxBufferSize;
__u32 MaxRawSize;
__u32 SessionKey;
__u32 Capabilities; /* see below */
__u32 SystemTimeLow;
__u32 SystemTimeHigh;
__u16 ServerTimeZone;
__le16 MaxMpxCount;
__le16 MaxNumberVcs;
__le32 MaxBufferSize;
__le32 MaxRawSize;
__le32 SessionKey;
__le32 Capabilities; /* see below */
__le32 SystemTimeLow;
__le32 SystemTimeHigh;
__le16 ServerTimeZone;
__u8 EncryptionKeyLength;
__u16 ByteCount;
union {
......
......@@ -183,6 +183,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
int rc = 0;
int bytes_returned;
struct TCP_Server_Info * server;
u16 count;
if(ses->server)
server = ses->server;
......@@ -199,12 +200,12 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
if (extended_security)
pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC;
pSMB->ByteCount = strlen(protocols[0].name) + 1;
count = strlen(protocols[0].name) + 1;
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->ByteCount = cpu_to_le16(pSMB->ByteCount);
pSMB->hdr.smb_buf_length += count;
pSMB->ByteCount = cpu_to_le16(count);
rc = SendReceive(xid, ses, (struct smb_hdr *) pSMB,
(struct smb_hdr *) pSMBr, &bytes_returned, 0);
......@@ -236,7 +237,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
if ((pSMBr->hdr.Flags2 & SMBFLG2_EXT_SEC) &&
(server->capabilities & CAP_EXTENDED_SECURITY)) {
__u16 count = le16_to_cpu(pSMBr->ByteCount);
count = pSMBr->ByteCount;
if (count < 16)
rc = -EIO;
else if (count == 16) {
......
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