summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2021-11-29 19:56:20 +0100
committerJule Anger <janger@samba.org>2021-12-06 10:42:10 +0000
commit2306c9e7d18fe9080a20c2989144a35d43ef2a1d (patch)
tree5b6aa05ab6c3bf10cd94634e2d765c60c6c906b3
parenta68e2904eaee1d7185bfe6981193a4bdeae7a2db (diff)
downloadsamba-2306c9e7d18fe9080a20c2989144a35d43ef2a1d.tar.gz
s4:torture/smb2: FSCTL_QUERY_NETWORK_INTERFACE_INFO gives INVALID_PARAMETER with invalid file ids
An invalid file id for FSCTL_QUERY_NETWORK_INTERFACE_INFO gives INVALID_PARAMETER instead of FILE_CLOSED. 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 fb33f145ff598b03a08098b7f12f3c53491f6c04)
-rw-r--r--selftest/knownfail.d/smb2.ioctl.bug147881
-rw-r--r--source4/torture/smb2/ioctl.c53
2 files changed, 54 insertions, 0 deletions
diff --git a/selftest/knownfail.d/smb2.ioctl.bug14788 b/selftest/knownfail.d/smb2.ioctl.bug14788
new file mode 100644
index 00000000000..b228bfafe47
--- /dev/null
+++ b/selftest/knownfail.d/smb2.ioctl.bug14788
@@ -0,0 +1 @@
+^samba3.smb2.ioctl.*.bug14788.NETWORK_INTERFACE
diff --git a/source4/torture/smb2/ioctl.c b/source4/torture/smb2/ioctl.c
index c9ebc35314b..35c413dc57c 100644
--- a/source4/torture/smb2/ioctl.c
+++ b/source4/torture/smb2/ioctl.c
@@ -7126,6 +7126,59 @@ static bool test_ioctl_bug14788_NETWORK_INTERFACE(struct torture_context *tortur
NT_STATUS_BUFFER_TOO_SMALL,
"FSCTL_QUERY_NETWORK_INTERFACE_INFO");
+ /*
+ * An invalid FSCTL_QUERY_NETWORK_INTERFACE_INFO,
+ * with file_id_* not being UINT64_MAX.
+ *
+ * This gives INVALID_PARAMETER instead
+ * of FILE_CLOSED.
+ */
+ status = smb2cli_ioctl(transport->conn,
+ timeout_msec,
+ session->smbXcli,
+ tree->smbXcli,
+ INT64_MAX, /* in_fid_persistent */
+ INT64_MAX, /* in_fid_volatile */
+ FSCTL_QUERY_NETWORK_INTERFACE_INFO,
+ 0, /* in_max_input_length */
+ NULL, /* in_input_buffer */
+ UINT16_MAX, /* in_max_output_length */
+ NULL, /* in_output_buffer */
+ SMB2_IOCTL_FLAG_IS_FSCTL,
+ torture,
+ &out_input_buffer,
+ &out_output_buffer);
+ torture_assert_ntstatus_equal(torture, status,
+ NT_STATUS_INVALID_PARAMETER,
+ "FSCTL_QUERY_NETWORK_INTERFACE_INFO");
+
+ /*
+ * An invalid FSCTL_QUERY_NETWORK_INTERFACE_INFO,
+ * with file_id_* not being UINT64_MAX and
+ * in_max_output_length = 1.
+ *
+ * This proves INVALID_PARAMETER instead
+ * of BUFFER_TOO_SMALL.
+ */
+ status = smb2cli_ioctl(transport->conn,
+ timeout_msec,
+ session->smbXcli,
+ tree->smbXcli,
+ INT64_MAX, /* in_fid_persistent */
+ INT64_MAX, /* in_fid_volatile */
+ FSCTL_QUERY_NETWORK_INTERFACE_INFO,
+ 0, /* in_max_input_length */
+ NULL, /* in_input_buffer */
+ 1, /* in_max_output_length */
+ NULL, /* in_output_buffer */
+ SMB2_IOCTL_FLAG_IS_FSCTL,
+ torture,
+ &out_input_buffer,
+ &out_output_buffer);
+ torture_assert_ntstatus_equal(torture, status,
+ NT_STATUS_INVALID_PARAMETER,
+ "FSCTL_QUERY_NETWORK_INTERFACE_INFO");
+
return true;
}