]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: assert fsp->fsp_flags.posix_append and offset in smbd_smb2_write_send()
authorRalph Boehme <slow@samba.org>
Fri, 22 Nov 2024 18:41:51 +0000 (19:41 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 7 Jan 2025 22:04:33 +0000 (22:04 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/smb2_write.c

index 4db146caad54eecd4b8cb288a6145f1dfb28791b..87f6640a0857030cfde2b102bfadb08f9555fdf9 100644 (file)
@@ -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,