smb2_server: don't let SMB2_OP_IOCTL force FILE_CLOSED for invalid file ids
authorStefan Metzmacher <metze@samba.org>
Wed, 15 Sep 2021 18:27:12 +0000 (20:27 +0200)
committerJule Anger <janger@samba.org>
Mon, 6 Dec 2021 10:42:10 +0000 (10:42 +0000)
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)

selftest/knownfail.d/smb2.ioctl.bug14788 [deleted file]
source3/smbd/smb2_server.c

diff --git a/selftest/knownfail.d/smb2.ioctl.bug14788 b/selftest/knownfail.d/smb2.ioctl.bug14788
deleted file mode 100644 (file)
index b228bfa..0000000
+++ /dev/null
@@ -1 +0,0 @@
-^samba3.smb2.ioctl.*.bug14788.NETWORK_INTERFACE
index b2dbc3a6d5d6dd132b9c1ac4d4c3c3850fbe5082..78b48d5a9bf4abb0c3e39260ab690763985b5e04 100644 (file)
@@ -66,7 +66,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
@@ -131,7 +130,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),
@@ -3322,16 +3320,12 @@ skipped_signing:
                                return smbd_smb2_request_error(req,
                                                req->compound_create_err);
                        }
-                       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);
                        }