From: Volker Lendecke Date: Mon, 5 Aug 2019 12:59:18 +0000 (+0200) Subject: smbd: Slightly simplify set_share_mode() X-Git-Tag: tdb-1.4.2~288 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e4d5c53e8083406552f361d2df27528d1c2ea061;p=thirdparty%2Fsamba.git smbd: Slightly simplify set_share_mode() The fsp carries all required information also for leases. There's no need to pass that as additional parameters Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/locking/locking.c b/source3/locking/locking.c index 45399b65f1f..5ef844c51c6 100644 --- a/source3/locking/locking.c +++ b/source3/locking/locking.c @@ -795,9 +795,7 @@ bool set_share_mode(struct share_mode_lock *lck, uint64_t mid, uint16_t op_type, uint32_t share_access, - uint32_t access_mask, - const struct GUID *client_guid, - const struct smb2_lease_key *lease_key) + uint32_t access_mask) { struct share_mode_data *d = lck->data; struct share_mode_entry *tmp, *e; @@ -821,8 +819,9 @@ bool set_share_mode(struct share_mode_lock *lck, e->op_type = op_type; if (op_type == LEASE_OPLOCK) { + const struct GUID *client_guid = fsp_client_guid(fsp); e->client_guid = *client_guid; - e->lease_key = *lease_key; + e->lease_key = fsp->lease->lease.lease_key; } e->time.tv_sec = fsp->open_time.tv_sec; diff --git a/source3/locking/proto.h b/source3/locking/proto.h index 57619b81866..37f36870751 100644 --- a/source3/locking/proto.h +++ b/source3/locking/proto.h @@ -161,9 +161,7 @@ bool set_share_mode(struct share_mode_lock *lck, uint64_t mid, uint16_t op_type, uint32_t share_access, - uint32_t access_mask, - const struct GUID *client_guid, - const struct smb2_lease_key *lease_key); + uint32_t access_mask); void remove_stale_share_mode_entries(struct share_mode_data *d); bool del_share_mode(struct share_mode_lock *lck, files_struct *fsp); bool mark_share_mode_disconnected(struct share_mode_lock *lck, diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 850b69fcba8..01f62223ddb 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -2231,8 +2231,6 @@ static NTSTATUS grant_fsp_oplock_type(struct smb_request *req, bool got_oplock = false; uint32_t i; uint32_t granted; - const struct GUID *client_guid = NULL; - const struct smb2_lease_key *lease_key = NULL; bool ok; NTSTATUS status; @@ -2330,9 +2328,6 @@ static NTSTATUS grant_fsp_oplock_type(struct smb_request *req, } *lease = fsp->lease->lease; - lease_key = &fsp->lease->lease.lease_key; - client_guid = fsp_client_guid(fsp); - DEBUG(10, ("lease_state=%d\n", lease->lease_state)); } else { if (got_handle_lease) { @@ -2357,9 +2352,7 @@ static NTSTATUS grant_fsp_oplock_type(struct smb_request *req, req ? req->mid : 0, fsp->oplock_type, share_access, - access_mask, - client_guid, - lease_key); + access_mask); if (!ok) { return NT_STATUS_NO_MEMORY; } @@ -4210,9 +4203,7 @@ static NTSTATUS open_directory(connection_struct *conn, req ? req->mid : 0, NO_OPLOCK, share_access, - fsp->access_mask, - NULL, - NULL); + fsp->access_mask); if (!ok) { TALLOC_FREE(lck); fd_close(fsp);