From: Ralph Boehme Date: Mon, 9 Mar 2020 10:31:00 +0000 (+0100) Subject: smbd: call tevent_req_nterror() for directories when cleaning up pending aio X-Git-Tag: ldb-2.2.0~1476 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f94cd10a211e2eae966ba4bd26921556bbe513fc;p=thirdparty%2Fsamba.git smbd: call tevent_req_nterror() for directories when cleaning up pending aio smbd_smb2_query_directory_recv() calls tevent_req_is_nterror() which requires a NTSTATUS error code. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- diff --git a/source3/smbd/close.c b/source3/smbd/close.c index 928adefbfa2..639c4844b35 100644 --- a/source3/smbd/close.c +++ b/source3/smbd/close.c @@ -31,6 +31,7 @@ #include "auth.h" #include "messages.h" #include "../librpc/gen_ndr/open_files.h" +#include "lib/util/tevent_ntstatus.h" /**************************************************************************** Run a file if it is a magic script. @@ -678,7 +679,7 @@ static void close_free_pending_aio(struct files_struct *fsp, * directly) and also leaves the SMB2 request * outstanding on the processing queue. * - * Using tevent_req_error() instead + * Using tevent_req_[nt]error() instead * causes the outstanding SMB1/2/3 request to * return with NT_STATUS_INVALID_HANDLE * and removes it from the processing queue. @@ -687,7 +688,12 @@ static void close_free_pending_aio(struct files_struct *fsp, * calls talloc_free(req). The destructor will remove * itself from the fsp and the aio_requests array. */ - tevent_req_error(fsp->aio_requests[0], EBADF); + if (fsp->is_directory) { + tevent_req_nterror(fsp->aio_requests[0], + NT_STATUS_INVALID_HANDLE); + } else { + tevent_req_error(fsp->aio_requests[0], EBADF); + } /* Paranoia to ensure we don't spin. */ num_requests--;