smbd: Pass share_access/access_mask explicitly to grant_fsp_oplock_type()
authorVolker Lendecke <vl@samba.org>
Thu, 25 Jul 2019 14:08:35 +0000 (16:08 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 6 Aug 2019 21:49:29 +0000 (21:49 +0000)
Why? While restructuring open_file_ntcreate() I found the data flow for
these values confusing: grant_fsp_oplock_type() depends on
fsp->access_mask, which changes its value inside
open_file_ntcreate(). I find the data flow easier to follow if it
happens in explicit variables.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/open.c

index e376cb8c836705242d73cc7c54efea2de5dcde82..d599b867cb40beea1897dbbed7067af0f7409c32 100644 (file)
@@ -2222,7 +2222,9 @@ static NTSTATUS grant_fsp_oplock_type(struct smb_request *req,
                                      struct files_struct *fsp,
                                      struct share_mode_lock *lck,
                                      int oplock_request,
-                                     struct smb2_lease *lease)
+                                     struct smb2_lease *lease,
+                                     uint32_t share_access,
+                                     uint32_t access_mask)
 {
        struct share_mode_data *d = lck->data;
        bool got_handle_lease = false;
@@ -2354,8 +2356,8 @@ static NTSTATUS grant_fsp_oplock_type(struct smb_request *req,
                get_current_uid(fsp->conn),
                req ? req->mid : 0,
                fsp->oplock_type,
-               fsp->share_access,
-               fsp->access_mask,
+               share_access,
+               access_mask,
                client_guid,
                lease_key);
        if (!ok) {
@@ -3667,7 +3669,14 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
         * Setup the oplock info in both the shared memory and
         * file structs.
         */
-       status = grant_fsp_oplock_type(req, fsp, lck, oplock_request, lease);
+       status = grant_fsp_oplock_type(
+               req,
+               fsp,
+               lck,
+               oplock_request,
+               lease,
+               fsp->share_access,
+               fsp->access_mask);
        if (!NT_STATUS_IS_OK(status)) {
                TALLOC_FREE(lck);
                fd_close(fsp);