From 69cdd233b5d2690f7aa19e6c3fedfaf3e8bd6f99 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Fri, 22 Nov 2024 19:41:51 +0100 Subject: [PATCH] smbd: assert fsp->fsp_flags.posix_append and offset in smbd_smb2_write_send() Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- source3/smbd/smb2_write.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source3/smbd/smb2_write.c b/source3/smbd/smb2_write.c index 4db146caad5..87f6640a085 100644 --- a/source3/smbd/smb2_write.c +++ b/source3/smbd/smb2_write.c @@ -346,6 +346,18 @@ static struct tevent_req *smbd_smb2_write_send(TALLOC_CTX *mem_ctx, return tevent_req_post(req, ev); } + if (state->in_offset == VFS_PWRITE_APPEND_OFFSET && + !fsp->fsp_flags.posix_append) + { + tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); + return tevent_req_post(req, ev); + } else if (fsp->fsp_flags.posix_append && + state->in_offset != VFS_PWRITE_APPEND_OFFSET) + { + tevent_req_nterror(req, NT_STATUS_INVALID_PARAMETER); + return tevent_req_post(req, ev); + } + /* Try and do an asynchronous write. */ status = schedule_aio_smb2_write(conn, smbreq, -- 2.47.3