2 * Unix SMB/CIFS implementation.
4 * test SMB2 multichannel operations
6 * Copyright (C) Guenther Deschner, 2016
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 3 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23 #include "libcli/smb2/smb2.h"
24 #include "libcli/smb2/smb2_calls.h"
25 #include "torture/torture.h"
26 #include "torture/util.h"
27 #include "torture/smb2/proto.h"
28 #include "libcli/security/security.h"
29 #include "librpc/gen_ndr/ndr_security.h"
30 #include "librpc/gen_ndr/ndr_ioctl.h"
31 #include "../libcli/smb/smbXcli_base.h"
33 #define CHECK_STATUS(status, correct) do { \
34 if (!NT_STATUS_EQUAL(status, correct)) { \
35 torture_result(tctx, TORTURE_FAIL, \
36 "(%s) Incorrect status %s - should be %s\n", \
37 __location__, nt_errstr(status), nt_errstr(correct)); \
41 static bool test_ioctl_network_interface_info(struct torture_context *tctx,
42 struct smb2_tree *tree,
43 struct fsctl_net_iface_info *info)
45 union smb_ioctl ioctl;
46 struct smb2_handle fh;
49 caps = smb2cli_conn_server_capabilities(tree->session->transport->conn);
50 if (!(caps & SMB2_CAP_MULTI_CHANNEL)) {
52 "server doesn't support SMB2_CAP_MULTI_CHANNEL\n");
57 ioctl.smb2.level = RAW_IOCTL_SMB2;
59 fh.data[0] = UINT64_MAX;
60 fh.data[1] = UINT64_MAX;
62 ioctl.smb2.in.file.handle = fh;
63 ioctl.smb2.in.function = FSCTL_QUERY_NETWORK_INTERFACE_INFO;
64 /* Windows client sets this to 64KiB */
65 ioctl.smb2.in.max_output_response = 0x10000;
66 ioctl.smb2.in.flags = SMB2_IOCTL_FLAG_IS_FSCTL;
68 torture_assert_ntstatus_ok(tctx,
69 smb2_ioctl(tree, tctx, &ioctl.smb2),
70 "FSCTL_QUERY_NETWORK_INTERFACE_INFO failed");
73 (ioctl.smb2.out.out.length != 0),
74 "no interface info returned???");
76 torture_assert_ndr_success(tctx,
77 ndr_pull_struct_blob(&ioctl.smb2.out.out, tctx, info,
78 (ndr_pull_flags_fn_t)ndr_pull_fsctl_net_iface_info),
79 "failed to ndr pull");
82 NDR_PRINT_DEBUG(fsctl_net_iface_info, info);
88 static bool test_multichannel_interface_info(struct torture_context *tctx,
89 struct smb2_tree *tree)
91 struct fsctl_net_iface_info info;
93 return test_ioctl_network_interface_info(tctx, tree, &info);
96 struct torture_suite *torture_smb2_multichannel_init(TALLOC_CTX *ctx)
98 struct torture_suite *suite = torture_suite_create(ctx, "multichannel");
100 torture_suite_add_1smb2_test(suite, "interface_info",
101 test_multichannel_interface_info);
103 suite->description = talloc_strdup(suite, "SMB2 Multichannel tests");