s3:smb2_lock: pass in_lock_sequence to smbd_smb2_lock_send()
authorStefan Metzmacher <metze@samba.org>
Wed, 24 Oct 2012 12:53:05 +0000 (14:53 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 13 Aug 2018 15:34:53 +0000 (17:34 +0200)
Take the value from the client if the dialect is SMB2_10 or higher,
otherwise default to 0.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
source3/smbd/smb2_lock.c

index da5a54df623349c15e38ea829ff0384559c84a1e..8b19c416fb04a19ced33b10864b150bc39aee402 100644 (file)
@@ -50,6 +50,7 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
                                                 struct tevent_context *ev,
                                                 struct smbd_smb2_request *smb2req,
                                                 struct files_struct *in_fsp,
+                                                uint32_t in_lock_sequence,
                                                 uint16_t in_lock_count,
                                                 struct smbd_smb2_lock_element *in_locks);
 static NTSTATUS smbd_smb2_lock_recv(struct tevent_req *req);
@@ -59,6 +60,7 @@ NTSTATUS smbd_smb2_request_process_lock(struct smbd_smb2_request *req)
 {
        const uint8_t *inbody;
        uint16_t in_lock_count;
+       uint32_t in_lock_sequence;
        uint64_t in_file_id_persistent;
        uint64_t in_file_id_volatile;
        struct files_struct *in_fsp;
@@ -75,7 +77,12 @@ NTSTATUS smbd_smb2_request_process_lock(struct smbd_smb2_request *req)
        inbody = SMBD_SMB2_IN_BODY_PTR(req);
 
        in_lock_count                   = CVAL(inbody, 0x02);
-       /* 0x04 - 4 bytes reserved */
+       if (req->sconn->conn->protocol >= PROTOCOL_SMB2_10) {
+               in_lock_sequence        = IVAL(inbody, 0x04);
+       } else {
+               /* 0x04 - 4 bytes reserved */
+               in_lock_sequence        = 0;
+       }
        in_file_id_persistent           = BVAL(inbody, 0x08);
        in_file_id_volatile             = BVAL(inbody, 0x10);
 
@@ -136,6 +143,7 @@ NTSTATUS smbd_smb2_request_process_lock(struct smbd_smb2_request *req)
 
        subreq = smbd_smb2_lock_send(req, req->ev_ctx,
                                     req, in_fsp,
+                                    in_lock_sequence,
                                     in_lock_count,
                                     in_locks);
        if (subreq == NULL) {
@@ -192,6 +200,7 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
                                                 struct tevent_context *ev,
                                                 struct smbd_smb2_request *smb2req,
                                                 struct files_struct *fsp,
+                                                uint32_t in_lock_sequence,
                                                 uint16_t in_lock_count,
                                                 struct smbd_smb2_lock_element *in_locks)
 {