From d5dd40ef535ac035485a31cb6493615daeebcec6 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Wed, 19 May 2021 16:58:21 +0200 Subject: [PATCH] smbd: add fsp_get_smb2_lease() Signed-off-by: Ralph Boehme Reviewed-by: Stefan Metzmacher --- source3/smbd/proto.h | 1 + source3/smbd/smb2_oplock.c | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 5743fc1f6c9..5fffa34cd72 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -719,6 +719,7 @@ void release_file_oplock(files_struct *fsp); bool remove_oplock(files_struct *fsp); bool downgrade_oplock(files_struct *fsp); bool fsp_lease_update(struct files_struct *fsp); +const struct smb2_lease *fsp_get_smb2_lease(const struct files_struct *fsp); NTSTATUS downgrade_lease(struct smbXsrv_client *client, uint32_t num_file_ids, const struct file_id *ids, diff --git a/source3/smbd/smb2_oplock.c b/source3/smbd/smb2_oplock.c index b7ab6195af2..aa1053d0064 100644 --- a/source3/smbd/smb2_oplock.c +++ b/source3/smbd/smb2_oplock.c @@ -1893,3 +1893,14 @@ NTSTATUS delay_for_handle_lease_break_recv(struct tevent_req *req, tevent_req_received(req); return NT_STATUS_OK; } + +const struct smb2_lease *fsp_get_smb2_lease(const struct files_struct *fsp) +{ + if (fsp == NULL) { + return NULL; + } + if (fsp->lease == NULL) { + return NULL; + } + return &fsp->lease->lease; +} -- 2.47.3