]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: return correct error for compound related requests that went async
authorRalph Boehme <slow@samba.org>
Mon, 26 Aug 2024 08:48:34 +0000 (10:48 +0200)
committerJule Anger <janger@samba.org>
Mon, 9 Dec 2024 08:36:19 +0000 (08:36 +0000)
For a compound related request chain of eg CREATE+NOTIFY+GETINFO, the NOTIFY
will typically go async. When this is noted in smbd_smb2_request_pending_queue()
the pending async tevent_req is cancelled which means we return
NT_STATUS_CANCELLED to the client while Windows returns
NT_STATUS_INTERNAL_ERROR.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit a5635791cfdb10f64bf2bf7c72c58f7591249a0d)

selftest/knownfail
source3/smbd/smb2_server.c

index d993b350091d463e84873c9db5a9f3865de33e92..140d4a95069e2dae3f9c349a7ab167df5cb6ac57 100644 (file)
 ^samba3.smb2.getinfo.fsinfo # quotas don't work yet
 ^samba3.smb2.setinfo.setinfo
 ^samba3.smb2.session.*reauth5 # some special anonymous checks?
-^samba3.smb2.compound.interim2 # wrong return code (STATUS_CANCELLED)
-^samba3.smb2.compound.aio.interim2 # wrong return code (STATUS_CANCELLED)
 ^samba3.smb2.lock.*replay_broken_windows # This tests the windows behaviour
 ^samba3.smb2.lease.unlink # we currently do not downgrade RH lease to R after unlink
 ^samba4.smb2.ioctl.compress_notsup.*\(ad_dc_ntvfs\)
index 9eba42dfcf209c32bc215b51595637f06bff36b5..8079f4f3f476011049ea35fa8f0a3330e3a7e578 100644 (file)
@@ -4074,6 +4074,16 @@ NTSTATUS smbd_smb2_request_error_ex(struct smbd_smb2_request *req,
                }
        }
 
+       if (req->compound_related &&
+           NT_STATUS_EQUAL(status, NT_STATUS_CANCELLED))
+       {
+               /*
+                * A compound request went async but was cancelled as it was not
+                * one of the allowed async compound requests.
+                */
+               status = NT_STATUS_INTERNAL_ERROR;
+       }
+
        body.data = outhdr + SMB2_HDR_BODY;
        body.length = 8;
        SSVAL(body.data, 0, 9);