summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2016-01-19 15:39:34 +0100
committerJeremy Allison <jra@samba.org>2019-04-19 17:27:13 +0000
commit1739468cd92ac1c20fba5886857feb275cb52772 (patch)
treea12c93d8ad9c3e86729c89ca14ca1c550f4fa27e /source4
parentf115b53c7266a780ab492df483ebfa4704e3e003 (diff)
downloadsamba-1739468cd92ac1c20fba5886857feb275cb52772.tar.gz
s4-torture: add test for interface information retrieval for multichannel.
Signed-off-by: Guenther Deschner <gd@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/smb2/multichannel.c58
1 files changed, 54 insertions, 4 deletions
diff --git a/source4/torture/smb2/multichannel.c b/source4/torture/smb2/multichannel.c
index 2c72bd779d5..0a4203aa5fb 100644
--- a/source4/torture/smb2/multichannel.c
+++ b/source4/torture/smb2/multichannel.c
@@ -27,6 +27,8 @@
#include "torture/smb2/proto.h"
#include "libcli/security/security.h"
#include "librpc/gen_ndr/ndr_security.h"
+#include "librpc/gen_ndr/ndr_ioctl.h"
+#include "../libcli/smb/smbXcli_base.h"
#define CHECK_STATUS(status, correct) do { \
if (!NT_STATUS_EQUAL(status, correct)) { \
@@ -36,19 +38,67 @@
return false; \
} } while (0)
-static bool test_session_bind(struct torture_context *tctx,
- struct smb2_tree *tree)
+static bool test_ioctl_network_interface_info(struct torture_context *tctx,
+ struct smb2_tree *tree,
+ struct fsctl_net_iface_info *info)
{
- /* TODO */
+ union smb_ioctl ioctl;
+ struct smb2_handle fh;
+ uint32_t caps;
+
+ caps = smb2cli_conn_server_capabilities(tree->session->transport->conn);
+ if (!(caps & SMB2_CAP_MULTI_CHANNEL)) {
+ torture_skip(tctx,
+ "server doesn't support SMB2_CAP_MULTI_CHANNEL\n");
+ }
+
+ ZERO_STRUCT(ioctl);
+
+ ioctl.smb2.level = RAW_IOCTL_SMB2;
+
+ fh.data[0] = UINT64_MAX;
+ fh.data[1] = UINT64_MAX;
+
+ ioctl.smb2.in.file.handle = fh;
+ ioctl.smb2.in.function = FSCTL_QUERY_NETWORK_INTERFACE_INFO;
+ /* Windows client sets this to 64KiB */
+ ioctl.smb2.in.max_output_response = 0x10000;
+ ioctl.smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL;
+
+ torture_assert_ntstatus_ok(tctx,
+ smb2_ioctl(tree, tctx, &ioctl.smb2),
+ "FSCTL_QUERY_NETWORK_INTERFACE_INFO failed");
+
+ torture_assert(tctx,
+ (ioctl.smb2.out.out.length != 0),
+ "no interface info returned???");
+
+ torture_assert_ndr_success(tctx,
+ ndr_pull_struct_blob(&ioctl.smb2.out.out, tctx, info,
+ (ndr_pull_flags_fn_t)ndr_pull_fsctl_net_iface_info),
+ "failed to ndr pull");
+
+ if (DEBUGLVL(1)) {
+ NDR_PRINT_DEBUG(fsctl_net_iface_info, info);
+ }
return true;
}
+static bool test_multichannel_interface_info(struct torture_context *tctx,
+ struct smb2_tree *tree)
+{
+ struct fsctl_net_iface_info info;
+
+ return test_ioctl_network_interface_info(tctx, tree, &info);
+}
+
struct torture_suite *torture_smb2_multichannel_init(TALLOC_CTX *ctx)
{
struct torture_suite *suite = torture_suite_create(ctx, "multichannel");
- torture_suite_add_1smb2_test(suite, "session-bind", test_session_bind);
+ torture_suite_add_1smb2_test(suite, "interface_info",
+ test_multichannel_interface_info);
suite->description = talloc_strdup(suite, "SMB2 Multichannel tests");