From: Volker Lendecke Date: Thu, 25 Jul 2019 14:08:35 +0000 (+0200) Subject: smbd: Pass share_access/access_mask explicitly to grant_fsp_oplock_type() X-Git-Tag: tdb-1.4.2~295 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=71c6da46eee4acc245bd326865f84336f457f538;p=thirdparty%2Fsamba.git smbd: Pass share_access/access_mask explicitly to grant_fsp_oplock_type() 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 Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/open.c b/source3/smbd/open.c index e376cb8c836..d599b867cb4 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -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);