From: Stefan Metzmacher Date: Mon, 11 May 2020 16:18:24 +0000 (+0200) Subject: s3:smbd: handle 0 length writes as no-op. X-Git-Tag: ldb-2.2.0~545 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ba68f21286c2c2f1fef8bf8c9cd500a622077887;p=thirdparty%2Fsamba.git s3:smbd: handle 0 length writes as no-op. 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 Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/aio.c b/source3/smbd/aio.c index 7ed2691cfbf..f89ce8537a0 100644 --- a/source3/smbd/aio.c +++ b/source3/smbd/aio.c @@ -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); diff --git a/source3/smbd/fileio.c b/source3/smbd/fileio.c index 6d58bdbbc97..079d414db05 100644 --- a/source3/smbd/fileio.c +++ b/source3/smbd/fileio.c @@ -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)) &&