From b8a543f2ccb9af5765ec5bee8ea16f5f439267d9 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Mon, 26 Aug 2024 10:48:34 +0200 Subject: [PATCH] smbd: return correct error for compound related requests that went async 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 Reviewed-by: Stefan Metzmacher (cherry picked from commit a5635791cfdb10f64bf2bf7c72c58f7591249a0d) --- selftest/knownfail | 2 -- source3/smbd/smb2_server.c | 10 ++++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/selftest/knownfail b/selftest/knownfail index 31e70a1a9d3..5f64e4edad0 100644 --- a/selftest/knownfail +++ b/selftest/knownfail @@ -215,8 +215,6 @@ ^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\) diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index b37829e8c4f..287d9844e84 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -4076,6 +4076,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);