summaryrefslogtreecommitdiff
path: root/source3/smbd/smb2_server.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2021-09-15 20:27:12 +0200
committerJule Anger <janger@samba.org>2021-12-13 09:44:15 +0000
commit08eb470b9c580d3353c64dad34ba1c1109e1c042 (patch)
tree10a514baa8f7cda4ac74c427ca75cd86edd4d979 /source3/smbd/smb2_server.c
parent25c97fc3a0f13515ad6910814dc8f19fc862e329 (diff)
downloadsamba-08eb470b9c580d3353c64dad34ba1c1109e1c042.tar.gz
smb2_server: don't let SMB2_OP_IOCTL force FILE_CLOSED for invalid file ids
smbd_smb2_request_process_ioctl() already detailed checks for file_ids, which not reached before. .allow_invalid_fileid = true was only used for SMB2_OP_IOCTL. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14788 Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org> (cherry picked from commit 1744dd8c5bc342a74e397951506468636275fe45) Autobuild-User(v4-14-test): Jule Anger <janger@samba.org> Autobuild-Date(v4-14-test): Mon Dec 13 09:44:15 UTC 2021 on sn-devel-184
Diffstat (limited to 'source3/smbd/smb2_server.c')
-rw-r--r--source3/smbd/smb2_server.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c
index f1c615b2240..b5a831f6df0 100644
--- a/source3/smbd/smb2_server.c
+++ b/source3/smbd/smb2_server.c
@@ -64,7 +64,6 @@ static const struct smbd_smb2_dispatch_table {
bool need_tcon;
bool as_root;
uint16_t fileid_ofs;
- bool allow_invalid_fileid;
bool modify;
} smbd_smb2_table[] = {
#define _OP(o) .opcode = o, .name = #o
@@ -129,7 +128,6 @@ static const struct smbd_smb2_dispatch_table {
.need_session = true,
.need_tcon = true,
.fileid_ofs = 0x08,
- .allow_invalid_fileid = true,
.modify = true,
},{
_OP(SMB2_OP_CANCEL),
@@ -3218,16 +3216,12 @@ NTSTATUS smbd_smb2_request_dispatch(struct smbd_smb2_request *req)
fsp = file_fsp_smb2(req, file_id_persistent, file_id_volatile);
if (fsp == NULL) {
- if (!call->allow_invalid_fileid) {
- return smbd_smb2_request_error(req,
- NT_STATUS_FILE_CLOSED);
- }
-
- if (file_id_persistent != UINT64_MAX) {
- return smbd_smb2_request_error(req,
- NT_STATUS_FILE_CLOSED);
- }
- if (file_id_volatile != UINT64_MAX) {
+ /*
+ * smbd_smb2_request_process_ioctl()
+ * has more checks in order to return more
+ * detailed error codes...
+ */
+ if (opcode != SMB2_OP_IOCTL) {
return smbd_smb2_request_error(req,
NT_STATUS_FILE_CLOSED);
}