The branch, master has been updated
       via  ea9dc21a230 s3: smbd: Remove now redundent lock_flav parameter from 
smbd_do_unlocking().
       via  07c74582c0f s3: smbd: Remove lock_flav argument from 
smbd_smb1_brl_finish_by_lock().
       via  8ec30dade11 s3: smbd: Remove lock_flav argument from internal 
function smbd_smb1_do_locks_check()
       via  b03e0da5288 s3: smbd: Remove lock_flav argument from 
smbd_smb1_do_locks_send().
       via  c1d59934894 s3: smbd: In smbd_smb1_do_locks_send() move access of 
lock_flav until after we know we have locks in the array.
       via  4a567652422 s3: smbd: Remove lock_flav parameter from 
smbd_do_locks_try().
       via  85e131b54ba s3: smbd: Move implicit call to 
lp_posix_cifsu_locktype() out of init_strict_lock_struct().
       via  9a0212800cb s3: smbd: Add "enum brl_flavour" to struct 
smbd_lock_element.
      from  099c62a654d s3: smbclient: In do_host_query(), if we need SMB1, 
ensure we select NT1 as the client max protocol" before continuing.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit ea9dc21a2308b9d8ad51d3205327e9e91ade9d84
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Nov 16 17:04:02 2021 -0800

    s3: smbd: Remove now redundent lock_flav parameter from smbd_do_unlocking().
    
    We already stored this in struct smbd_lock_element.
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power <npo...@samba.org>
    
    Autobuild-User(master): Noel Power <npo...@samba.org>
    Autobuild-Date(master): Thu Jan  6 16:03:28 UTC 2022 on sn-devel-184

commit 07c74582c0f9fd74d00a667879787cdde1de3fb3
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Nov 16 16:56:02 2021 -0800

    s3: smbd: Remove lock_flav argument from smbd_smb1_brl_finish_by_lock().
    
    We lookup the lock array from the state stored in the passed-in req
    and all the locks in an array are always the same flavour, so this
    isn't needed.
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power <npo...@samba.org>

commit 8ec30dade11c85b6f6b55a3ab564167f79ba3b0f
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Nov 16 16:48:58 2021 -0800

    s3: smbd: Remove lock_flav argument from internal function 
smbd_smb1_do_locks_check()
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power <npo...@samba.org>

commit b03e0da5288667933d69b8a162534cdec8bc9b25
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Nov 16 16:41:09 2021 -0800

    s3: smbd: Remove lock_flav argument from smbd_smb1_do_locks_send().
    
    And also inside struct smbd_smb1_do_locks_state.
    All calls to this always (a) have one or more locks of the same type.
    (the setup for smbd_smb1_do_locks_send() ensures there is always
    at least one lock) and (b) always set locks[0].lock_flav correctly before 
calling.
    
    lock_flav is thus a redundent argument. Removing it means
    we can never drift out of sync with the lock_flav element
    in the passed in locks array.
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power <npo...@samba.org>

commit c1d5993489472ac857f83729c901004f26866d6f
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Nov 16 16:15:54 2021 -0800

    s3: smbd: In smbd_smb1_do_locks_send() move access of lock_flav until after 
we know we have locks in the array.
    
    When we remove the lock_flav parameter this will need to look into the 
array itself.
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power <npo...@samba.org>

commit 4a567652422f8fcf507fa8e5ec7300d7014268a0
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Nov 16 15:06:59 2021 -0800

    s3: smbd: Remove lock_flav parameter from smbd_do_locks_try().
    
    This is now contained in the struct smbd_lock_element for
    each lock.
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power <npo...@samba.org>

commit 85e131b54ba91f349316d9d637b4344d1a642bc5
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Nov 16 15:00:03 2021 -0800

    s3: smbd: Move implicit call to lp_posix_cifsu_locktype() out of 
init_strict_lock_struct().
    
    Make it explicit. When we add POSIX handles to SMB2 we will only
    look at the handle type. lp_posix_cifsu_locktype() already does this,
    but hidden inside init_strict_lock_struct() makes it hard to see.
    
    No logic change.
    
    Signed-off-by: Jeremy Allison <j...@samba.org>
    Reviewed-by: Noel Power <npo...@samba.org>

commit 9a0212800cbc51e51e069334f1d5f3aa0e239086
Author: Jeremy Allison <j...@samba.org>
Date:   Tue Nov 16 14:26:44 2021 -0800

    s3: smbd: Add "enum brl_flavour" to struct smbd_lock_element.
    
    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 <j...@samba.org>
    Reviewed-by: Noel Power <npo...@samba.org>

-----------------------------------------------------------------------

Summary of changes:
 source3/include/locking.h         |   1 +
 source3/locking/locking.c         |   1 +
 source3/locking/proto.h           |   1 +
 source3/modules/vfs_btrfs.c       |   2 +
 source3/modules/vfs_default.c     |   4 ++
 source3/smbd/aio.c                |  40 ++++++++++-----
 source3/smbd/blocking.c           |  38 +++++---------
 source3/smbd/globals.h            |   3 +-
 source3/smbd/proto.h              |   3 --
 source3/smbd/reply.c              | 105 ++++++++++++++++++++++++--------------
 source3/smbd/smb2_ioctl_filesys.c |   1 +
 source3/smbd/smb2_lock.c          |   4 +-
 source3/smbd/smb2_read.c          |   2 +
 source3/smbd/smb2_write.c         |   1 +
 source3/smbd/trans2.c             |   5 +-
 15 files changed, 127 insertions(+), 84 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/locking.h b/source3/include/locking.h
index 3629d86c556..f9eb502b758 100644
--- a/source3/include/locking.h
+++ b/source3/include/locking.h
@@ -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;
 };
diff --git a/source3/locking/locking.c b/source3/locking/locking.c
index 5fd117ac31e..b002e80fee4 100644
--- a/source3/locking/locking.c
+++ b/source3/locking/locking.c
@@ -90,6 +90,7 @@ void init_strict_lock_struct(files_struct *fsp,
                                br_off start,
                                br_off size,
                                enum brl_type lock_type,
+                               enum brl_flavour lock_flav,
                                struct lock_struct *plock)
 {
        SMB_ASSERT(lock_type == READ_LOCK || lock_type == WRITE_LOCK);
diff --git a/source3/locking/proto.h b/source3/locking/proto.h
index 72d037040f2..d6e7a54a766 100644
--- a/source3/locking/proto.h
+++ b/source3/locking/proto.h
@@ -98,6 +98,7 @@ void init_strict_lock_struct(files_struct *fsp,
                                br_off start,
                                br_off size,
                                enum brl_type lock_type,
+                               enum brl_flavour lock_flav,
                                struct lock_struct *plock);
 bool strict_lock_check_default(files_struct *fsp,
                               struct lock_struct *plock);
diff --git a/source3/modules/vfs_btrfs.c b/source3/modules/vfs_btrfs.c
index 53e6a3fd7c7..309923a9320 100644
--- a/source3/modules/vfs_btrfs.c
+++ b/source3/modules/vfs_btrfs.c
@@ -343,6 +343,7 @@ static struct tevent_req *btrfs_offload_write_send(struct 
vfs_handle_struct *han
                                        src_off,
                                        num,
                                        READ_LOCK,
+                                       lp_posix_cifsu_locktype(src_fsp),
                                        &src_lck);
                if (!SMB_VFS_STRICT_LOCK_CHECK(src_fsp->conn, src_fsp, 
&src_lck)) {
                        tevent_req_nterror(req, NT_STATUS_FILE_LOCK_CONFLICT);
@@ -360,6 +361,7 @@ static struct tevent_req *btrfs_offload_write_send(struct 
vfs_handle_struct *han
                                        dest_off,
                                        num,
                                        WRITE_LOCK,
+                                       lp_posix_cifsu_locktype(dest_fsp),
                                        &dest_lck);
 
                if (!SMB_VFS_STRICT_LOCK_CHECK(dest_fsp->conn, dest_fsp, 
&dest_lck)) {
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index db25527bfd6..c52d29dc2fe 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -2245,6 +2245,7 @@ static NTSTATUS vfswrap_offload_copy_file_range(struct 
tevent_req *req)
                                state->src_off,
                                state->remaining,
                                READ_LOCK,
+                               lp_posix_cifsu_locktype(state->src_fsp),
                                &lck);
 
        ok = SMB_VFS_STRICT_LOCK_CHECK(state->src_fsp->conn,
@@ -2264,6 +2265,7 @@ static NTSTATUS vfswrap_offload_copy_file_range(struct 
tevent_req *req)
                                state->dst_off,
                                state->remaining,
                                WRITE_LOCK,
+                               lp_posix_cifsu_locktype(state->dst_fsp),
                                &lck);
 
        ok = SMB_VFS_STRICT_LOCK_CHECK(state->dst_fsp->conn,
@@ -2358,6 +2360,7 @@ static NTSTATUS vfswrap_offload_write_loop(struct 
tevent_req *req)
                                state->src_off,
                                state->next_io_size,
                                READ_LOCK,
+                               lp_posix_cifsu_locktype(state->src_fsp),
                                &read_lck);
 
        ok = SMB_VFS_STRICT_LOCK_CHECK(state->src_fsp->conn,
@@ -2421,6 +2424,7 @@ static void vfswrap_offload_write_read_done(struct 
tevent_req *subreq)
                                state->dst_off,
                                state->next_io_size,
                                WRITE_LOCK,
+                               lp_posix_cifsu_locktype(state->dst_fsp),
                                &write_lck);
 
        ok = SMB_VFS_STRICT_LOCK_CHECK(state->dst_fsp->conn,
diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c
index 038487ad4ba..95f18217868 100644
--- a/source3/smbd/aio.c
+++ b/source3/smbd/aio.c
@@ -207,9 +207,13 @@ NTSTATUS schedule_aio_read_and_X(connection_struct *conn,
        SCVAL(aio_ex->outbuf.data,smb_vwv0,0xFF); /* Never a chained reply. */
        SCVAL(smb_buf(aio_ex->outbuf.data), 0, 0); /* padding byte */
 
-       init_strict_lock_struct(fsp, (uint64_t)smbreq->smbpid,
-               (uint64_t)startpos, (uint64_t)smb_maxcnt, READ_LOCK,
-               &aio_ex->lock);
+       init_strict_lock_struct(fsp,
+                       (uint64_t)smbreq->smbpid,
+                       (uint64_t)startpos,
+                       (uint64_t)smb_maxcnt,
+                       READ_LOCK,
+                       lp_posix_cifsu_locktype(fsp),
+                       &aio_ex->lock);
 
        /* Take the lock until the AIO completes. */
        if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &aio_ex->lock)) {
@@ -472,9 +476,13 @@ NTSTATUS schedule_aio_write_and_X(connection_struct *conn,
        srv_set_message((char *)aio_ex->outbuf.data, 6, 0, True);
        SCVAL(aio_ex->outbuf.data,smb_vwv0,0xFF); /* Never a chained reply. */
 
-       init_strict_lock_struct(fsp, (uint64_t)smbreq->smbpid,
-               (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
-               &aio_ex->lock);
+       init_strict_lock_struct(fsp,
+                       (uint64_t)smbreq->smbpid,
+                       (uint64_t)startpos,
+                       (uint64_t)numtowrite,
+                       WRITE_LOCK,
+                       lp_posix_cifsu_locktype(fsp),
+                       &aio_ex->lock);
 
        /* Take the lock until the AIO completes. */
        if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &aio_ex->lock)) {
@@ -720,9 +728,13 @@ NTSTATUS schedule_smb2_aio_read(connection_struct *conn,
                return NT_STATUS_NO_MEMORY;
        }
 
-       init_strict_lock_struct(fsp, fsp->op->global->open_persistent_id,
-               (uint64_t)startpos, (uint64_t)smb_maxcnt, READ_LOCK,
-               &aio_ex->lock);
+       init_strict_lock_struct(fsp,
+                       fsp->op->global->open_persistent_id,
+                       (uint64_t)startpos,
+                       (uint64_t)smb_maxcnt,
+                       READ_LOCK,
+                       lp_posix_cifsu_locktype(fsp),
+                       &aio_ex->lock);
 
        /* Take the lock until the AIO completes. */
        if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &aio_ex->lock)) {
@@ -857,9 +869,13 @@ NTSTATUS schedule_aio_smb2_write(connection_struct *conn,
 
        aio_ex->write_through = write_through;
 
-       init_strict_lock_struct(fsp, fsp->op->global->open_persistent_id,
-               in_offset, (uint64_t)in_data.length, WRITE_LOCK,
-               &aio_ex->lock);
+       init_strict_lock_struct(fsp,
+                       fsp->op->global->open_persistent_id,
+                       in_offset,
+                       (uint64_t)in_data.length,
+                       WRITE_LOCK,
+                       lp_posix_cifsu_locktype(fsp),
+                       &aio_ex->lock);
 
        /* Take the lock until the AIO completes. */
        if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &aio_ex->lock)) {
diff --git a/source3/smbd/blocking.c b/source3/smbd/blocking.c
index ef2fe321f5c..10d657bb838 100644
--- a/source3/smbd/blocking.c
+++ b/source3/smbd/blocking.c
@@ -31,7 +31,6 @@
 
 NTSTATUS smbd_do_locks_try(
        struct files_struct *fsp,
-       enum brl_flavour lock_flav,
        uint16_t num_locks,
        struct smbd_lock_element *locks,
        uint16_t *blocker_idx,
@@ -52,7 +51,7 @@ NTSTATUS smbd_do_locks_try(
                        e->count,
                        e->offset,
                        e->brltype,
-                       lock_flav,
+                       e->lock_flav,
                        blocking_pid,
                        blocking_smblctx);
                if (!NT_STATUS_IS_OK(status)) {
@@ -75,7 +74,7 @@ NTSTATUS smbd_do_locks_try(
                          e->smblctx,
                          e->count,
                          e->offset,
-                         lock_flav);
+                         e->lock_flav);
        }
 
        return status;
@@ -109,7 +108,6 @@ struct smbd_smb1_do_locks_state {
        uint32_t retry_msecs;
        struct timeval endtime;
        bool large_offset;      /* required for correct cancel */
-       enum brl_flavour lock_flav;
        uint16_t num_locks;
        struct smbd_lock_element *locks;
        uint16_t blocker;
@@ -122,7 +120,6 @@ static void smbd_smb1_blocked_locks_cleanup(
        struct tevent_req *req, enum tevent_req_state req_state);
 static NTSTATUS smbd_smb1_do_locks_check(
        struct files_struct *fsp,
-       enum brl_flavour lock_flav,
        uint16_t num_locks,
        struct smbd_lock_element *locks,
        uint16_t *blocker_idx,
@@ -251,7 +248,6 @@ struct tevent_req *smbd_smb1_do_locks_send(
        struct files_struct *fsp,
        uint32_t lock_timeout,
        bool large_offset,
-       enum brl_flavour lock_flav,
        uint16_t num_locks,
        struct smbd_lock_element *locks)
 {
@@ -269,28 +265,26 @@ struct tevent_req *smbd_smb1_do_locks_send(
        state->fsp = fsp;
        state->timeout = lock_timeout;
        state->large_offset = large_offset;
-       state->lock_flav = lock_flav;
        state->num_locks = num_locks;
        state->locks = locks;
-
-       if (lock_flav == POSIX_LOCK) {
-               /*
-                * SMB1 posix locks always use
-                * NT_STATUS_FILE_LOCK_CONFLICT.
-                */
-               state->deny_status = NT_STATUS_FILE_LOCK_CONFLICT;
-       } else {
-               state->deny_status = NT_STATUS_LOCK_NOT_GRANTED;
-       }
+       state->deny_status = NT_STATUS_LOCK_NOT_GRANTED;
 
        DBG_DEBUG("state=%p, state->smbreq=%p\n", state, state->smbreq);
 
-       if (num_locks == 0) {
+       if (num_locks == 0 || locks == NULL) {
                DBG_DEBUG("no locks\n");
                tevent_req_done(req);
                return tevent_req_post(req, ev);
        }
 
+       if (state->locks[0].lock_flav == POSIX_LOCK) {
+               /*
+                * SMB1 posix locks always use
+                * NT_STATUS_FILE_LOCK_CONFLICT.
+                */
+               state->deny_status = NT_STATUS_FILE_LOCK_CONFLICT;
+       }
+
        smbd_smb1_do_locks_try(req);
        if (!tevent_req_is_in_progress(req)) {
                return tevent_req_post(req, ev);
@@ -386,7 +380,6 @@ static NTSTATUS smbd_smb1_do_locks_check_blocked(
 
 static NTSTATUS smbd_smb1_do_locks_check(
        struct files_struct *fsp,
-       enum brl_flavour lock_flav,
        uint16_t num_locks,
        struct smbd_lock_element *locks,
        uint16_t *blocker_idx,
@@ -413,7 +406,6 @@ static NTSTATUS smbd_smb1_do_locks_check(
 
                if (blocked_state->locks == locks) {
                        SMB_ASSERT(blocked_state->num_locks == num_locks);
-                       SMB_ASSERT(blocked_state->lock_flav == lock_flav);
 
                        /*
                         * We found ourself...
@@ -437,7 +429,6 @@ static NTSTATUS smbd_smb1_do_locks_check(
 
        status = smbd_do_locks_try(
                fsp,
-               lock_flav,
                num_locks,
                locks,
                blocker_idx,
@@ -472,7 +463,6 @@ static void smbd_smb1_do_locks_try(struct tevent_req *req)
 
        status = smbd_smb1_do_locks_check(
                fsp,
-               state->lock_flav,
                state->num_locks,
                state->locks,
                &state->blocker,
@@ -697,7 +687,6 @@ void smbd_smb1_brl_finish_by_req(struct tevent_req *req, 
NTSTATUS status)
 bool smbd_smb1_brl_finish_by_lock(
        struct files_struct *fsp,
        bool large_offset,
-       enum brl_flavour lock_flav,
        struct smbd_lock_element lock,
        NTSTATUS finish_status)
 {
@@ -715,8 +704,7 @@ bool smbd_smb1_brl_finish_by_lock(
 
                DBG_DEBUG("i=%zu, req=%p\n", i, req);
 
-               if ((state->large_offset != large_offset) ||
-                   (state->lock_flav != lock_flav)) {
+               if (state->large_offset != large_offset) {
                        continue;
                }
 
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h
index 4fa8ebd8355..eef38f00a4e 100644
--- a/source3/smbd/globals.h
+++ b/source3/smbd/globals.h
@@ -118,8 +118,7 @@ struct GUID smbd_request_guid(struct smb_request *smb1req, 
uint16_t idx);
 NTSTATUS smbd_do_unlocking(struct smb_request *req,
                           files_struct *fsp,
                           uint16_t num_ulocks,
-                          struct smbd_lock_element *ulocks,
-                          enum brl_flavour lock_flav);
+                          struct smbd_lock_element *ulocks);
 
 NTSTATUS smbd_do_qfilepathinfo(connection_struct *conn,
                               TALLOC_CTX *mem_ctx,
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 3b0d34514c9..0a73c82bad3 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -99,7 +99,6 @@ bool aio_add_req_to_fsp(files_struct *fsp, struct tevent_req 
*req);
 
 NTSTATUS smbd_do_locks_try(
        struct files_struct *fsp,
-       enum brl_flavour lock_flav,
        uint16_t num_locks,
        struct smbd_lock_element *locks,
        uint16_t *blocker_idx,
@@ -112,7 +111,6 @@ struct tevent_req *smbd_smb1_do_locks_send(
        struct files_struct *fsp,
        uint32_t lock_timeout,
        bool large_offset,
-       enum brl_flavour lock_flav,
        uint16_t num_locks,
        struct smbd_lock_element *locks);
 NTSTATUS smbd_smb1_do_locks_recv(struct tevent_req *req);
@@ -124,7 +122,6 @@ void smbd_smb1_brl_finish_by_req(struct tevent_req *req, 
NTSTATUS status);
 bool smbd_smb1_brl_finish_by_lock(
        struct files_struct *fsp,
        bool large_offset,
-       enum brl_flavour lock_flav,
        struct smbd_lock_element lock,
        NTSTATUS finish_status);
 bool smbd_smb1_brl_finish_by_mid(
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index eeae563766a..ac5f253b353 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -3697,9 +3697,13 @@ void reply_readbraw(struct smb_request *req)
        /* ensure we don't overrun the packet size */
        maxcount = MIN(65535,maxcount);
 
-       init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
-           (uint64_t)startpos, (uint64_t)maxcount, READ_LOCK,
-           &lock);
+       init_strict_lock_struct(fsp,
+                       (uint64_t)req->smbpid,
+                       (uint64_t)startpos,
+                       (uint64_t)maxcount,
+                       READ_LOCK,
+                       lp_posix_cifsu_locktype(fsp),
+                       &lock);
 
        if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) {
                reply_readbraw_error(xconn);
@@ -3794,6 +3798,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),
        };
@@ -3805,7 +3810,6 @@ void reply_lockread(struct smb_request *req)
                fsp,
                0,
                false,          /* large_offset */
-               WINDOWS_LOCK,
                1,
                lck);
        if (subreq == NULL) {
@@ -3964,9 +3968,13 @@ Returning short read of maximum allowed for 
compatibility with Windows 2000.\n",
 
        data = smb_buf(req->outbuf) + 3;
 
-       init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
-           (uint64_t)startpos, (uint64_t)numtoread, READ_LOCK,
-           &lock);
+       init_strict_lock_struct(fsp,
+                       (uint64_t)req->smbpid,
+                       (uint64_t)startpos,
+                       (uint64_t)numtoread,
+                       READ_LOCK,
+                       lp_posix_cifsu_locktype(fsp),
+                       &lock);
 
        if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) {
                reply_nterror(req, NT_STATUS_FILE_LOCK_CONFLICT);
@@ -4041,9 +4049,13 @@ static void send_file_readX(connection_struct *conn, 
struct smb_request *req,
        int saved_errno = 0;
        NTSTATUS status;
 
-       init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
-           (uint64_t)startpos, (uint64_t)smb_maxcnt, READ_LOCK,
-           &lock);
+       init_strict_lock_struct(fsp,
+                       (uint64_t)req->smbpid,
+                       (uint64_t)startpos,
+                       (uint64_t)smb_maxcnt,
+                       READ_LOCK,
+                       lp_posix_cifsu_locktype(fsp),
+                       &lock);
 
        if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) {
                reply_nterror(req, NT_STATUS_FILE_LOCK_CONFLICT);
@@ -4564,9 +4576,13 @@ void reply_writebraw(struct smb_request *req)
        }
 
        if (!fsp->print_file) {
-               init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
-                   (uint64_t)startpos, (uint64_t)tcount, WRITE_LOCK,
-                   &lock);
+               init_strict_lock_struct(fsp,
+                               (uint64_t)req->smbpid,
+                               (uint64_t)startpos,
+                               (uint64_t)tcount,
+                               WRITE_LOCK,
+                               lp_posix_cifsu_locktype(fsp),
+                               &lock);
 
                if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) {
                        reply_nterror(req, NT_STATUS_FILE_LOCK_CONFLICT);
@@ -4779,9 +4795,13 @@ void reply_writeunlock(struct smb_request *req)
        }
 
        if (!fsp->print_file && numtowrite > 0) {
-               init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
-                   (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
-                   &lock);
+               init_strict_lock_struct(fsp,
+                               (uint64_t)req->smbpid,
+                               (uint64_t)startpos,
+                               (uint64_t)numtowrite,
+                               WRITE_LOCK,
+                               lp_posix_cifsu_locktype(fsp),
+                               &lock);
 
                if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) {
                        reply_nterror(req, NT_STATUS_FILE_LOCK_CONFLICT);
@@ -4823,10 +4843,11 @@ 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,
                };
-               status = smbd_do_unlocking(req, fsp, 1, &l, WINDOWS_LOCK);
+               status = smbd_do_unlocking(req, fsp, 1, &l);
                if (NT_STATUS_V(status)) {
                        reply_nterror(req, status);
                        goto out;
@@ -4909,9 +4930,13 @@ void reply_write(struct smb_request *req)
        }
 
        if (!fsp->print_file) {
-               init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
-                       (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
-                       &lock);
+               init_strict_lock_struct(fsp,
+                               (uint64_t)req->smbpid,
+                               (uint64_t)startpos,
+                               (uint64_t)numtowrite,
+                               WRITE_LOCK,
+                               lp_posix_cifsu_locktype(fsp),
+                               &lock);
 
                if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) {
                        reply_nterror(req, NT_STATUS_FILE_LOCK_CONFLICT);
@@ -5205,9 +5230,13 @@ void reply_write_and_X(struct smb_request *req)
                        /* NT_STATUS_RETRY - fall through to sync write. */
                }
 
-               init_strict_lock_struct(fsp, (uint64_t)req->smbpid,
-                   (uint64_t)startpos, (uint64_t)numtowrite, WRITE_LOCK,
-                   &lock);
+               init_strict_lock_struct(fsp,
+                               (uint64_t)req->smbpid,
+                               (uint64_t)startpos,
+                               (uint64_t)numtowrite,
+                               WRITE_LOCK,
+                               lp_posix_cifsu_locktype(fsp),
+                               &lock);
 
                if (!SMB_VFS_STRICT_LOCK_CHECK(conn, fsp, &lock)) {


-- 
Samba Shared Repository

Reply via email to