]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: pass fsp to open_mode_check()
authorRalph Boehme <slow@samba.org>
Fri, 21 Mar 2025 14:28:58 +0000 (15:28 +0100)
committerRalph Boehme <slow@samba.org>
Fri, 17 Jul 2026 10:18:37 +0000 (10:18 +0000)
No change in behaviour.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source3/smbd/open.c

index 043a5b18d404d19be868a68df4f81697a9b8c01e..eaf9aaaa3873cb857891842258204b727c6f96fb 100644 (file)
@@ -1720,8 +1720,7 @@ static bool open_mode_check_fn(
        return false;
 }
 
-static NTSTATUS open_mode_check(connection_struct *conn,
-                               struct file_id fid,
+static NTSTATUS open_mode_check(struct files_struct *fsp,
                                struct share_mode_lock *lck,
                                uint32_t access_mask,
                                uint32_t share_access)
@@ -1743,9 +1742,9 @@ static NTSTATUS open_mode_check(connection_struct *conn,
 #if defined(DEVELOPER)
        {
                struct validate_my_share_entries_state validate_state = {
-                       .sconn = conn->sconn,
-                       .fid = fid,
-                       .self = messaging_server_id(conn->sconn->msg_ctx),
+                       .sconn = fsp->conn->sconn,
+                       .fid = fsp->file_id,
+                       .self = messaging_server_id(fsp->conn->sconn->msg_ctx),
                };
                ok = share_mode_forall_entries(
                        lck, validate_my_share_entries_fn, &validate_state);
@@ -1767,7 +1766,7 @@ static NTSTATUS open_mode_check(connection_struct *conn,
        }
 
        state = (struct open_mode_check_state) {
-               .fid = fid,
+               .fid = fsp->file_id,
                .share_access = (FILE_SHARE_READ|
                                 FILE_SHARE_WRITE|
                                 FILE_SHARE_DELETE),
@@ -2811,8 +2810,7 @@ static NTSTATUS handle_share_mode_lease(
        *poplock_type = NO_OPLOCK;
        *pgranted = 0;
 
-       status = open_mode_check(
-               fsp->conn, fsp->file_id, lck, access_mask, share_access);
+       status = open_mode_check(fsp, lck, access_mask, share_access);
        if (NT_STATUS_EQUAL(status, NT_STATUS_SHARING_VIOLATION)) {
                sharing_violation = true;
                status = NT_STATUS_OK; /* handled later */