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