1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-22 22:04:08 +03:00

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
This commit is contained in:
Stefan Metzmacher 2021-09-15 20:27:12 +02:00 committed by Jule Anger
parent 25c97fc3a0
commit 08eb470b9c

View File

@ -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);
}