From: Ralph Boehme Date: Wed, 19 May 2021 14:58:21 +0000 (+0200) Subject: smbd: add fsp_get_smb2_lease() X-Git-Tag: tdb-1.4.13~718 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5dd40ef535ac035485a31cb6493615daeebcec6;p=thirdparty%2Fsamba.git smbd: add fsp_get_smb2_lease() Signed-off-by: Ralph Boehme Reviewed-by: Stefan Metzmacher --- 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; +}