]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: Add "enum brl_flavour" to struct smbd_lock_element.
authorJeremy Allison <jra@samba.org>
Tue, 16 Nov 2021 22:26:44 +0000 (14:26 -0800)
committerNoel Power <npower@samba.org>
Thu, 6 Jan 2022 15:11:38 +0000 (15:11 +0000)
Initialized correctly but not yet used.
Will allow 'brl_flavour' to be removed from lock calls.
This will allow SMB2 POSIX handles to call with POSIX_LOCK
flavour instead of always using WINDOWS_LOCK (as now).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
source3/include/locking.h
source3/smbd/reply.c
source3/smbd/smb2_lock.c
source3/smbd/trans2.c

index 3629d86c556f48d40f30b510772aee3368d1b93f..f9eb502b7582623020be833f0b1c29640b004824 100644 (file)
@@ -67,6 +67,7 @@ struct smbd_lock_element {
        struct GUID req_guid;
        uint64_t smblctx;
        enum brl_type brltype;
+       enum brl_flavour lock_flav;
        uint64_t offset;
        uint64_t count;
 };
index eeae563766a55637ecff87d9b6e70773c04b7993..0e0b22008300c1144a64d5872e8a449ef5f8935e 100644 (file)
@@ -3794,6 +3794,7 @@ void reply_lockread(struct smb_request *req)
                .req_guid = smbd_request_guid(req, 0),
                .smblctx = req->smbpid,
                .brltype = WRITE_LOCK,
+               .lock_flav = WINDOWS_LOCK,
                .count = SVAL(req->vwv+1, 0),
                .offset = IVAL_TO_SMB_OFF_T(req->vwv+2, 0),
        };
@@ -4823,6 +4824,7 @@ void reply_writeunlock(struct smb_request *req)
                        .req_guid = smbd_request_guid(req, 0),
                        .smblctx = req->smbpid,
                        .brltype = UNLOCK_LOCK,
+                       .lock_flav = WINDOWS_LOCK,
                        .offset = startpos,
                        .count = numtowrite,
                };
@@ -6000,6 +6002,7 @@ void reply_lock(struct smb_request *req)
                .req_guid = smbd_request_guid(req, 0),
                .smblctx = req->smbpid,
                .brltype = WRITE_LOCK,
+               .lock_flav = WINDOWS_LOCK,
                .count = IVAL(req->vwv+1, 0),
                .offset = IVAL(req->vwv+3, 0),
        };
@@ -6092,6 +6095,7 @@ void reply_unlock(struct smb_request *req)
                .req_guid = smbd_request_guid(req, 0),
                .smblctx = req->smbpid,
                .brltype = UNLOCK_LOCK,
+               .lock_flav = WINDOWS_LOCK,
                .offset = IVAL(req->vwv+3, 0),
                .count = IVAL(req->vwv+1, 0),
        };
@@ -8316,6 +8320,7 @@ void reply_lockingX(struct smb_request *req)
                        ulocks[i].offset = get_lock_offset(
                                data, i, large_file_format);
                        ulocks[i].brltype = UNLOCK_LOCK;
+                       ulocks[i].lock_flav = WINDOWS_LOCK;
                }
 
                /*
@@ -8371,6 +8376,7 @@ void reply_lockingX(struct smb_request *req)
                locks[i].count = get_lock_count(data, i, large_file_format);
                locks[i].offset = get_lock_offset(data, i, large_file_format);
                locks[i].brltype = brltype;
+               locks[i].lock_flav = WINDOWS_LOCK;
        }
 
        if (locktype & LOCKING_ANDX_CANCEL_LOCK) {
index b07c9ff93c0a01f763526e3f4f57591d2fb6db89..23f76e1a205f754ae1b44b393b2419fe7ed4a76f 100644 (file)
@@ -441,6 +441,7 @@ static struct tevent_req *smbd_smb2_lock_send(TALLOC_CTX *mem_ctx,
                } else {
                        locks[i].brltype = UNLOCK_LOCK;
                }
+               locks[i].lock_flav = WINDOWS_LOCK;
 
                DBG_DEBUG("index %"PRIu16" offset=%"PRIu64", count=%"PRIu64", "
                          "smblctx = %"PRIu64" type %d\n",
index cf602d88fba2a3bcc10cc6e49b74e10fbde7b794..c7fa5cd0d36e65c8c72832fc5015b5e5f75d3e77 100644 (file)
@@ -7673,6 +7673,7 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn,
                        .req_guid = smbd_request_guid(req, 0),
                        .smblctx = smblctx,
                        .brltype = UNLOCK_LOCK,
+                       .lock_flav = POSIX_LOCK,
                        .offset = offset,
                        .count = count,
                };
@@ -7689,6 +7690,7 @@ static NTSTATUS smb_set_posix_lock(connection_struct *conn,
                .req_guid = smbd_request_guid(req, 0),
                .smblctx = smblctx,
                .brltype = lock_type,
+               .lock_flav = POSIX_LOCK,
                .count = count,
                .offset = offset,
        };