From: Ralph Boehme Date: Tue, 23 Sep 2025 09:33:43 +0000 (+0200) Subject: vfs: add lease arg to SMB_VFS_DURABLE_RECONNECT() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9caa947c74a14200968de21364da5e1e71724f16;p=thirdparty%2Fsamba.git vfs: add lease arg to SMB_VFS_DURABLE_RECONNECT() This is needed with Persistent Handles to properly deal with reestablishing leases associated with a Persistend Handle. Signed-off-by: Ralph Boehme Reviewed-by: Anoop C S --- diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 5d90f6c27cb..529cbb44aa5 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -939,6 +939,7 @@ static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle, struct smb_request *smb1req, struct smbXsrv_open *op, const DATA_BLOB old_cookie, + const struct smb2_lease *lease, TALLOC_CTX *mem_ctx, struct files_struct **fsp, DATA_BLOB *new_cookie) diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index ad85032ba51..7b716aee0d1 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -1244,6 +1244,7 @@ static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle, struct smb_request *smb1req, struct smbXsrv_open *op, const DATA_BLOB old_cookie, + const struct smb2_lease *lease, TALLOC_CTX *mem_ctx, struct files_struct **fsp, DATA_BLOB *new_cookie) @@ -1252,6 +1253,7 @@ static NTSTATUS skel_durable_reconnect(struct vfs_handle_struct *handle, smb1req, op, old_cookie, + lease, mem_ctx, fsp, new_cookie); diff --git a/source3/include/vfs.h b/source3/include/vfs.h index a9a121b7b14..6a800d94cde 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -1352,6 +1352,7 @@ struct vfs_fn_pointers { struct smb_request *smb1req, struct smbXsrv_open *op, const DATA_BLOB old_cookie, + const struct smb2_lease *lease, TALLOC_CTX *mem_ctx, struct files_struct **fsp, DATA_BLOB *new_cookie); @@ -1847,6 +1848,7 @@ NTSTATUS smb_vfs_call_durable_reconnect(struct vfs_handle_struct *handle, struct smb_request *smb1req, struct smbXsrv_open *op, const DATA_BLOB old_cookie, + const struct smb2_lease *lease, TALLOC_CTX *mem_ctx, struct files_struct **fsp, DATA_BLOB *new_cookie); @@ -2272,6 +2274,7 @@ NTSTATUS vfs_not_implemented_durable_reconnect(struct vfs_handle_struct *handle, struct smb_request *smb1req, struct smbXsrv_open *op, const DATA_BLOB old_cookie, + const struct smb2_lease *lease, TALLOC_CTX *mem_ctx, struct files_struct **fsp, DATA_BLOB *new_cookie); diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index d338ad15374..0e4c5aac8cd 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -593,13 +593,13 @@ smb_vfs_call_durable_disconnect((handle)->next, \ (fsp), (old_cookie), (mem_ctx), (new_cookie)) -#define SMB_VFS_DURABLE_RECONNECT(conn, smb1req, op, old_cookie, mem_ctx, fsp, new_cookie) \ +#define SMB_VFS_DURABLE_RECONNECT(conn, smb1req, op, old_cookie, lease, mem_ctx, fsp, new_cookie) \ smb_vfs_call_durable_reconnect((conn)->vfs_handles, \ - (smb1req), (op), (old_cookie), \ + (smb1req), (op), (old_cookie), (lease), \ (mem_ctx), (fsp), (new_cookie)) -#define SMB_VFS_NEXT_DURABLE_RECONNECT(handle, smb1req, op, old_cookie, mem_ctx, fsp, new_cookie) \ +#define SMB_VFS_NEXT_DURABLE_RECONNECT(handle, smb1req, op, old_cookie, lease, mem_ctx, fsp, new_cookie) \ smb_vfs_call_durable_reconnect((handle)->next, \ - (smb1req), (op), (old_cookie), \ + (smb1req), (op), (old_cookie), (lease), \ (mem_ctx), (fsp), (new_cookie)) #define SMB_VFS_FREADDIR_ATTR(fsp, mem_ctx, attr_data) \ diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index c34a0384ded..0c4835c7a72 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -4043,12 +4043,13 @@ static NTSTATUS vfswrap_durable_reconnect(struct vfs_handle_struct *handle, struct smb_request *smb1req, struct smbXsrv_open *op, const DATA_BLOB old_cookie, + const struct smb2_lease *lease, TALLOC_CTX *mem_ctx, struct files_struct **fsp, DATA_BLOB *new_cookie) { return vfs_default_durable_reconnect(handle->conn, smb1req, op, - old_cookie, mem_ctx, + old_cookie, lease, mem_ctx, fsp, new_cookie); } diff --git a/source3/modules/vfs_error_inject.c b/source3/modules/vfs_error_inject.c index dcf0de0a2d9..1bf34597de8 100644 --- a/source3/modules/vfs_error_inject.c +++ b/source3/modules/vfs_error_inject.c @@ -209,6 +209,7 @@ static NTSTATUS vfs_error_inject_durable_reconnect(struct vfs_handle_struct *han struct smb_request *smb1req, struct smbXsrv_open *op, const DATA_BLOB old_cookie, + const struct smb2_lease *lease, TALLOC_CTX *mem_ctx, struct files_struct **fsp, DATA_BLOB *new_cookie) @@ -229,6 +230,7 @@ static NTSTATUS vfs_error_inject_durable_reconnect(struct vfs_handle_struct *han smb1req, op, old_cookie, + lease, mem_ctx, fsp, new_cookie); @@ -258,6 +260,7 @@ static NTSTATUS vfs_error_inject_durable_reconnect(struct vfs_handle_struct *han smb1req, op, old_cookie, + lease, mem_ctx, fsp, new_cookie); @@ -274,6 +277,7 @@ static NTSTATUS vfs_error_inject_durable_reconnect(struct vfs_handle_struct *han smb1req, op, modified_cookie, + lease, mem_ctx, fsp, new_cookie); diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index 1b65e714eb5..7d2d1e76ffa 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -3099,6 +3099,7 @@ static NTSTATUS smb_full_audit_durable_reconnect( struct smb_request *smb1req, struct smbXsrv_open *op, const DATA_BLOB old_cookie, + const struct smb2_lease *lease, TALLOC_CTX *mem_ctx, struct files_struct **fsp, DATA_BLOB *new_cookie) @@ -3109,6 +3110,7 @@ static NTSTATUS smb_full_audit_durable_reconnect( smb1req, op, old_cookie, + lease, mem_ctx, fsp, new_cookie); diff --git a/source3/modules/vfs_not_implemented.c b/source3/modules/vfs_not_implemented.c index c256e2ba457..7004229a190 100644 --- a/source3/modules/vfs_not_implemented.c +++ b/source3/modules/vfs_not_implemented.c @@ -1032,6 +1032,7 @@ NTSTATUS vfs_not_implemented_durable_reconnect(struct vfs_handle_struct *handle, struct smb_request *smb1req, struct smbXsrv_open *op, const DATA_BLOB old_cookie, + const struct smb2_lease *lease, TALLOC_CTX *mem_ctx, struct files_struct **fsp, DATA_BLOB *new_cookie) diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index a834902b3e4..6f0853c5c2b 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -2639,6 +2639,7 @@ static NTSTATUS smb_time_audit_durable_reconnect(struct vfs_handle_struct *handl struct smb_request *smb1req, struct smbXsrv_open *op, const DATA_BLOB old_cookie, + const struct smb2_lease *lease, TALLOC_CTX *mem_ctx, struct files_struct **fsp, DATA_BLOB *new_cookie) @@ -2649,7 +2650,7 @@ static NTSTATUS smb_time_audit_durable_reconnect(struct vfs_handle_struct *handl clock_gettime_mono(&ts1); result = SMB_VFS_NEXT_DURABLE_RECONNECT(handle, smb1req, op, old_cookie, - mem_ctx, fsp, new_cookie); + lease, mem_ctx, fsp, new_cookie); clock_gettime_mono(&ts2); timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9; diff --git a/source3/smbd/durable.c b/source3/smbd/durable.c index 5feb68b37aa..22479ba56ec 100644 --- a/source3/smbd/durable.c +++ b/source3/smbd/durable.c @@ -788,6 +788,7 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn, struct smb_request *smb1req, struct smbXsrv_open *op, const DATA_BLOB old_cookie, + const struct smb2_lease *lease, TALLOC_CTX *mem_ctx, files_struct **result, DATA_BLOB *new_cookie) diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h index 02492817dad..08772a91acb 100644 --- a/source3/smbd/proto.h +++ b/source3/smbd/proto.h @@ -1202,6 +1202,7 @@ NTSTATUS vfs_default_durable_reconnect(struct connection_struct *conn, struct smb_request *smb1req, struct smbXsrv_open *op, const DATA_BLOB old_cookie, + const struct smb2_lease *lease, TALLOC_CTX *mem_ctx, files_struct **result, DATA_BLOB *new_cookie); diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c index 7f61514defc..a3a1edb00ba 100644 --- a/source3/smbd/smb2_create.c +++ b/source3/smbd/smb2_create.c @@ -1138,6 +1138,7 @@ static struct tevent_req *smbd_smb2_create_send(TALLOC_CTX *mem_ctx, smb1req, state->op, /* smbXsrv_open input */ state->op->global->backend_cookie, + state->lease_ptr, state->op, /* TALLOC_CTX */ &state->result, &new_cookie); diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 9f7b2cb40bf..e7f3f68b158 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -2472,13 +2472,14 @@ NTSTATUS smb_vfs_call_durable_reconnect(struct vfs_handle_struct *handle, struct smb_request *smb1req, struct smbXsrv_open *op, const DATA_BLOB old_cookie, + const struct smb2_lease *lease, TALLOC_CTX *mem_ctx, struct files_struct **fsp, DATA_BLOB *new_cookie) { VFS_FIND(durable_reconnect); return handle->fns->durable_reconnect_fn(handle, smb1req, op, - old_cookie, mem_ctx, fsp, + old_cookie, lease, mem_ctx, fsp, new_cookie); }