]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: call tevent_req_nterror() for directories when cleaning up pending aio
authorRalph Boehme <slow@samba.org>
Mon, 9 Mar 2020 10:31:00 +0000 (11:31 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 9 Mar 2020 18:07:34 +0000 (18:07 +0000)
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 <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/close.c

index 928adefbfa230ed7efed1be6f170c0114ec655a6..639c4844b35645b74de71261093b32f5278a2d08 100644 (file)
@@ -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--;