Commit 53cb19c4 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] cifs: annotate smb_hdr

Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent bc837c2a
...@@ -107,13 +107,11 @@ int cifs_verify_signature(struct smb_hdr * cifs_pdu, const char * mac_key, ...@@ -107,13 +107,11 @@ int cifs_verify_signature(struct smb_hdr * cifs_pdu, const char * mac_key,
if(memcmp(cifs_pdu->Signature.SecuritySignature,"BSRSPYL ",8)==0) if(memcmp(cifs_pdu->Signature.SecuritySignature,"BSRSPYL ",8)==0)
cFYI(1,("dummy signature received for smb command 0x%x",cifs_pdu->Command)); cFYI(1,("dummy signature received for smb command 0x%x",cifs_pdu->Command));
expected_sequence_number = cpu_to_le32(expected_sequence_number);
/* save off the origiginal signature so we can modify the smb and check /* save off the origiginal signature so we can modify the smb and check
its signature against what the server sent */ its signature against what the server sent */
memcpy(server_response_sig,cifs_pdu->Signature.SecuritySignature,8); memcpy(server_response_sig,cifs_pdu->Signature.SecuritySignature,8);
cifs_pdu->Signature.Sequence.SequenceNumber = expected_sequence_number; cifs_pdu->Signature.Sequence.SequenceNumber = cpu_to_le32(expected_sequence_number);
cifs_pdu->Signature.Sequence.Reserved = 0; cifs_pdu->Signature.Sequence.Reserved = 0;
rc = cifs_calculate_signature(cifs_pdu, mac_key, rc = cifs_calculate_signature(cifs_pdu, mac_key,
......
...@@ -303,23 +303,23 @@ struct smb_hdr { ...@@ -303,23 +303,23 @@ struct smb_hdr {
struct { struct {
__u8 ErrorClass; __u8 ErrorClass;
__u8 Reserved; __u8 Reserved;
__u16 Error; /* note: treated as little endian (le) on wire */ __le16 Error;
} DosError; } DosError;
__u32 CifsError; /* note: le */ __le32 CifsError;
} Status; } Status;
__u8 Flags; __u8 Flags;
__u16 Flags2; /* note: le */ __u16 Flags2; /* note: le */
__u16 PidHigh; /* note: le */ __le16 PidHigh;
union { union {
struct { struct {
__u32 SequenceNumber; /* le */ __le32 SequenceNumber; /* le */
__u32 Reserved; /* zero */ __u32 Reserved; /* zero */
} Sequence; } Sequence;
__u8 SecuritySignature[8]; /* le */ __u8 SecuritySignature[8]; /* le */
} Signature; } Signature;
__u8 pad[2]; __u8 pad[2];
__u16 Tid; __u16 Tid;
__u16 Pid; /* note: le */ __le16 Pid;
__u16 Uid; __u16 Uid;
__u16 Mid; __u16 Mid;
__u8 WordCount; __u8 WordCount;
......
...@@ -2612,7 +2612,6 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, ...@@ -2612,7 +2612,6 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
struct file_end_of_file_info *parm_data; struct file_end_of_file_info *parm_data;
int rc = 0; int rc = 0;
int bytes_returned = 0; int bytes_returned = 0;
__u32 tmp;
__u16 params, param_offset, offset, byte_count, count; __u16 params, param_offset, offset, byte_count, count;
cFYI(1, ("SetFileSize (via SetFileInfo) %lld", cFYI(1, ("SetFileSize (via SetFileInfo) %lld",
...@@ -2622,11 +2621,8 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size, ...@@ -2622,11 +2621,8 @@ CIFSSMBSetFileSize(const int xid, struct cifsTconInfo *tcon, __u64 size,
if (rc) if (rc)
return rc; return rc;
tmp = cpu_to_le32(pid_of_opener); /* override pid of current process pSMB->hdr.Pid = cpu_to_le16((__u16)pid_of_opener);
so network fid will be valid */ pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid_of_opener >> 16));
pSMB->hdr.Pid = tmp & 0xFFFF;
tmp >>= 16;
pSMB->hdr.PidHigh = tmp & 0xFFFF;
params = 6; params = 6;
pSMB->MaxSetupCount = 0; pSMB->MaxSetupCount = 0;
......
...@@ -2158,7 +2158,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid, ...@@ -2158,7 +2158,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
&bytes_returned, 1); &bytes_returned, 1);
if (smb_buffer_response->Status.CifsError == if (smb_buffer_response->Status.CifsError ==
(NT_STATUS_MORE_PROCESSING_REQUIRED)) cpu_to_le32(NT_STATUS_MORE_PROCESSING_REQUIRED))
rc = 0; rc = 0;
if (rc) { if (rc) {
......
...@@ -189,7 +189,6 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , ...@@ -189,7 +189,6 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
) )
{ {
int i; int i;
__u32 tmp;
struct list_head* temp_item; struct list_head* temp_item;
struct cifsSesInfo * ses; struct cifsSesInfo * ses;
char *temp = (char *) buffer; char *temp = (char *) buffer;
...@@ -211,10 +210,8 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , ...@@ -211,10 +210,8 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ ,
buffer->Command = smb_command; buffer->Command = smb_command;
buffer->Flags = 0x00; /* case sensitive */ buffer->Flags = 0x00; /* case sensitive */
buffer->Flags2 = SMBFLG2_KNOWS_LONG_NAMES; buffer->Flags2 = SMBFLG2_KNOWS_LONG_NAMES;
tmp = cpu_to_le32(current->tgid); buffer->Pid = cpu_to_le16((__u16)current->tgid);
buffer->Pid = tmp & 0xFFFF; buffer->PidHigh = cpu_to_le16((__u16)(current->tgid >> 16));
tmp >>= 16;
buffer->PidHigh = tmp & 0xFFFF;
spin_lock(&GlobalMid_Lock); spin_lock(&GlobalMid_Lock);
GlobalMid++; GlobalMid++;
buffer->Mid = GlobalMid; buffer->Mid = GlobalMid;
......
...@@ -810,16 +810,13 @@ map_smb_to_linux_error(struct smb_hdr *smb) ...@@ -810,16 +810,13 @@ map_smb_to_linux_error(struct smb_hdr *smb)
if (smb->Flags2 & SMBFLG2_ERR_STATUS) { if (smb->Flags2 & SMBFLG2_ERR_STATUS) {
/* translate the newer STATUS codes to old style errors and then to POSIX errors */ /* translate the newer STATUS codes to old style errors and then to POSIX errors */
smb->Status.CifsError = le32_to_cpu(smb->Status.CifsError); __u32 err = le32_to_cpu(smb->Status.CifsError);
if(cifsFYI) if(cifsFYI)
cifs_print_status(smb->Status.CifsError); cifs_print_status(err);
ntstatus_to_dos(smb->Status.CifsError, &smberrclass, ntstatus_to_dos(err, &smberrclass, &smberrcode);
&smberrcode);
} else { } else {
smberrclass = smb->Status.DosError.ErrorClass; smberrclass = smb->Status.DosError.ErrorClass;
smb->Status.DosError.Error = smberrcode = le16_to_cpu(smb->Status.DosError.Error);
le16_to_cpu(smb->Status.DosError.Error);
smberrcode = smb->Status.DosError.Error;
} }
/* old style errors */ /* old style errors */
......
...@@ -385,11 +385,6 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, ...@@ -385,11 +385,6 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
if (out_buf->smb_buf_length > 12) if (out_buf->smb_buf_length > 12)
out_buf->Flags2 = le16_to_cpu(out_buf->Flags2); out_buf->Flags2 = le16_to_cpu(out_buf->Flags2);
if (out_buf->smb_buf_length > 28)
out_buf->Pid = le16_to_cpu(out_buf->Pid);
if (out_buf->smb_buf_length > 28)
out_buf->PidHigh =
le16_to_cpu(out_buf->PidHigh);
*pbytes_returned = out_buf->smb_buf_length; *pbytes_returned = out_buf->smb_buf_length;
......
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