]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:smbd: handle 0 length writes as no-op.
authorStefan Metzmacher <metze@samba.org>
Mon, 11 May 2020 16:18:24 +0000 (18:18 +0200)
committerJeremy Allison <jra@samba.org>
Tue, 12 May 2020 19:53:44 +0000 (19:53 +0000)
They should never touch the SMB_VFS layer
and they never trigger an DISK_FULL error.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14361

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/aio.c
source3/smbd/fileio.c

index 7ed2691cfbff48d79bc3dea336880afece0c72b2..f89ce8537a058c38f6d31c135ffd142e900bfcf2 100644 (file)
@@ -337,6 +337,11 @@ static struct tevent_req *pwrite_fsync_send(TALLOC_CTX *mem_ctx,
        state->fsp = fsp;
        state->write_through = write_through;
 
+       if (n == 0) {
+               tevent_req_done(req);
+               return tevent_req_post(req, ev);
+       }
+
        subreq = SMB_VFS_PWRITE_SEND(state, ev, fsp, data, n, offset);
        if (tevent_req_nomem(subreq, req)) {
                return tevent_req_post(req, ev);
index 6d58bdbbc97eeef3ec1c142f4ef9a5a2f071e886..079d414db05f19363789f1e3c618c11fbaaf675a 100644 (file)
@@ -70,6 +70,10 @@ static ssize_t real_write_file(struct smb_request *req,
 {
        ssize_t ret;
 
+       if (n == 0) {
+               return 0;
+       }
+
        fsp->fh->pos = pos;
        if (pos &&
            lp_strict_allocate(SNUM(fsp->conn)) &&