8
8
*
9
9
*/
10
10
#include <linux/ctype.h>
11
- #include "smb2pdu.h"
12
11
#include "cifsglob.h"
13
12
#include "cifsproto.h"
14
13
#include "smb2proto.h"
19
18
#include "nterr.h"
20
19
21
20
static int
22
- check_smb2_hdr (struct smb2_sync_hdr * shdr , __u64 mid )
21
+ check_smb2_hdr (struct smb2_hdr * shdr , __u64 mid )
23
22
{
24
23
__u64 wire_mid = le64_to_cpu (shdr -> MessageId );
25
24
@@ -81,9 +80,9 @@ static const __le16 smb2_rsp_struct_sizes[NUMBER_OF_SMB2_COMMANDS] = {
81
80
/* SMB2_OPLOCK_BREAK */ cpu_to_le16 (24 )
82
81
};
83
82
84
- #define SMB311_NEGPROT_BASE_SIZE (sizeof(struct smb2_sync_hdr ) + sizeof(struct smb2_negotiate_rsp))
83
+ #define SMB311_NEGPROT_BASE_SIZE (sizeof(struct smb2_hdr ) + sizeof(struct smb2_negotiate_rsp))
85
84
86
- static __u32 get_neg_ctxt_len (struct smb2_sync_hdr * hdr , __u32 len ,
85
+ static __u32 get_neg_ctxt_len (struct smb2_hdr * hdr , __u32 len ,
87
86
__u32 non_ctxlen )
88
87
{
89
88
__u16 neg_count ;
@@ -135,13 +134,13 @@ static __u32 get_neg_ctxt_len(struct smb2_sync_hdr *hdr, __u32 len,
135
134
int
136
135
smb2_check_message (char * buf , unsigned int len , struct TCP_Server_Info * srvr )
137
136
{
138
- struct smb2_sync_hdr * shdr = (struct smb2_sync_hdr * )buf ;
139
- struct smb2_sync_pdu * pdu = (struct smb2_sync_pdu * )shdr ;
137
+ struct smb2_hdr * shdr = (struct smb2_hdr * )buf ;
138
+ struct smb2_pdu * pdu = (struct smb2_pdu * )shdr ;
140
139
__u64 mid ;
141
140
__u32 clc_len ; /* calculated length */
142
141
int command ;
143
- int pdu_size = sizeof (struct smb2_sync_pdu );
144
- int hdr_size = sizeof (struct smb2_sync_hdr );
142
+ int pdu_size = sizeof (struct smb2_pdu );
143
+ int hdr_size = sizeof (struct smb2_hdr );
145
144
146
145
/*
147
146
* Add function to do table lookup of StructureSize by command
@@ -155,7 +154,7 @@ smb2_check_message(char *buf, unsigned int len, struct TCP_Server_Info *srvr)
155
154
/* decrypt frame now that it is completely read in */
156
155
spin_lock (& cifs_tcp_ses_lock );
157
156
list_for_each_entry (ses , & srvr -> smb_ses_list , smb_ses_list ) {
158
- if (ses -> Suid == thdr -> SessionId )
157
+ if (ses -> Suid == le64_to_cpu ( thdr -> SessionId ) )
159
158
break ;
160
159
}
161
160
spin_unlock (& cifs_tcp_ses_lock );
@@ -296,7 +295,7 @@ static const bool has_smb2_data_area[NUMBER_OF_SMB2_COMMANDS] = {
296
295
* area and the offset to it (from the beginning of the smb are also returned.
297
296
*/
298
297
char *
299
- smb2_get_data_area_len (int * off , int * len , struct smb2_sync_hdr * shdr )
298
+ smb2_get_data_area_len (int * off , int * len , struct smb2_hdr * shdr )
300
299
{
301
300
* off = 0 ;
302
301
* len = 0 ;
@@ -401,8 +400,8 @@ smb2_get_data_area_len(int *off, int *len, struct smb2_sync_hdr *shdr)
401
400
unsigned int
402
401
smb2_calc_size (void * buf , struct TCP_Server_Info * srvr )
403
402
{
404
- struct smb2_sync_pdu * pdu = (struct smb2_sync_pdu * )buf ;
405
- struct smb2_sync_hdr * shdr = & pdu -> sync_hdr ;
403
+ struct smb2_pdu * pdu = (struct smb2_pdu * )buf ;
404
+ struct smb2_hdr * shdr = & pdu -> hdr ;
406
405
int offset ; /* the offset from the beginning of SMB to data area */
407
406
int data_length ; /* the length of the variable length data area */
408
407
/* Structure Size has already been checked to make sure it is 64 */
@@ -669,7 +668,7 @@ smb2_is_valid_oplock_break(char *buffer, struct TCP_Server_Info *server)
669
668
670
669
cifs_dbg (FYI , "Checking for oplock break\n" );
671
670
672
- if (rsp -> sync_hdr .Command != SMB2_OPLOCK_BREAK )
671
+ if (rsp -> hdr .Command != SMB2_OPLOCK_BREAK )
673
672
return false;
674
673
675
674
if (rsp -> StructureSize !=
@@ -816,23 +815,23 @@ smb2_handle_cancelled_close(struct cifs_tcon *tcon, __u64 persistent_fid,
816
815
int
817
816
smb2_handle_cancelled_mid (struct mid_q_entry * mid , struct TCP_Server_Info * server )
818
817
{
819
- struct smb2_sync_hdr * sync_hdr = mid -> resp_buf ;
818
+ struct smb2_hdr * hdr = mid -> resp_buf ;
820
819
struct smb2_create_rsp * rsp = mid -> resp_buf ;
821
820
struct cifs_tcon * tcon ;
822
821
int rc ;
823
822
824
- if ((mid -> optype & CIFS_CP_CREATE_CLOSE_OP ) || sync_hdr -> Command != SMB2_CREATE ||
825
- sync_hdr -> Status != STATUS_SUCCESS )
823
+ if ((mid -> optype & CIFS_CP_CREATE_CLOSE_OP ) || hdr -> Command != SMB2_CREATE ||
824
+ hdr -> Status != STATUS_SUCCESS )
826
825
return 0 ;
827
826
828
- tcon = smb2_find_smb_tcon (server , sync_hdr -> SessionId ,
829
- sync_hdr -> TreeId );
827
+ tcon = smb2_find_smb_tcon (server , le64_to_cpu ( hdr -> SessionId ) ,
828
+ le32_to_cpu ( hdr -> Id . SyncId . TreeId ) );
830
829
if (!tcon )
831
830
return - ENOENT ;
832
831
833
832
rc = __smb2_handle_cancelled_cmd (tcon ,
834
- le16_to_cpu (sync_hdr -> Command ),
835
- le64_to_cpu (sync_hdr -> MessageId ),
833
+ le16_to_cpu (hdr -> Command ),
834
+ le64_to_cpu (hdr -> MessageId ),
836
835
rsp -> PersistentFileId ,
837
836
rsp -> VolatileFileId );
838
837
if (rc )
@@ -856,10 +855,10 @@ smb311_update_preauth_hash(struct cifs_ses *ses, struct kvec *iov, int nvec)
856
855
{
857
856
int i , rc ;
858
857
struct sdesc * d ;
859
- struct smb2_sync_hdr * hdr ;
858
+ struct smb2_hdr * hdr ;
860
859
struct TCP_Server_Info * server = cifs_ses_server (ses );
861
860
862
- hdr = (struct smb2_sync_hdr * )iov [0 ].iov_base ;
861
+ hdr = (struct smb2_hdr * )iov [0 ].iov_base ;
863
862
/* neg prot are always taken */
864
863
if (hdr -> Command == SMB2_NEGOTIATE )
865
864
goto ok ;
0 commit comments