+done:
+ tree1->session = session1;
+
+ smb2_util_close(tree1, h_client1_file1);
+ smb2_util_close(tree1, h_client1_file2);
+ smb2_util_close(tree1, h_client1_file3);
+ if (tree2A != NULL) {
+ smb2_util_close(tree2A, h_client2_file1);
+ smb2_util_close(tree2A, h_client2_file2);
+ smb2_util_close(tree2A, h_client2_file3);
+ }
+
+ smb2_util_unlink(tree1, fname1);
+ smb2_util_unlink(tree1, fname2);
+ smb2_util_unlink(tree1, fname3);
+ smb2_deltree(tree1, BASEDIR);
+
+ test_multichannel_free_channels2(tree2A, tree2B, tree2C);
+ talloc_free(tree1);
+ talloc_free(mem_ctx);
+
+ return ret;
+}
+
+/**
+ * Test Oplock Break with Multi Channel
+ */
+static bool test_multichannel_oplock_break(struct torture_context *tctx,
+ struct smb2_tree *tree1)
+{
+ const char *host = torture_setting_string(tctx, "host", NULL);
+ const char *share = torture_setting_string(tctx, "share", NULL);
+ struct cli_credentials *credentials = popt_get_cmdline_credentials();
+ NTSTATUS status;
+ TALLOC_CTX *mem_ctx = talloc_new(tctx);
+ struct smb2_handle _h;
+ struct smb2_handle *h = NULL;
+ struct smb2_handle h_client1_file1 = { 0 };
+ struct smb2_handle h_client1_file2 = { 0 };
+ struct smb2_handle h_client1_file3 = { 0 };
+ struct smb2_handle h_client2_file1 = { 0 };
+ struct smb2_handle h_client2_file2 = { 0 };
+ struct smb2_handle h_client2_file3 = { 0 };
+ struct smb2_create io1, io2, io3;
+ bool ret = true;
+ int rval;
+ const char *fname1 = BASEDIR "\\oplock_break_test1.dat";
+ const char *fname2 = BASEDIR "\\oplock_break_test2.dat";
+ const char *fname3 = BASEDIR "\\oplock_break_test3.dat";
+ struct smb2_tree *tree2A = NULL;
+ struct smb2_tree *tree2B = NULL;
+ struct smb2_tree *tree2C = NULL;
+ struct smb2_transport *transport1 = tree1->session->transport;
+ struct smb2_transport *transport2B = NULL;
+ struct smb2_transport *transport2C = NULL;
+ struct smbcli_options transport2_options;
+ struct smb2_session *session1 = tree1->session;
+ uint16_t local_port = 0;
+ bool block_ok = false;
+ bool unblock_ok = false;
+ DATA_BLOB blob;
+
+ if (!test_multichannel_initial_checks(tctx, tree1))
+ return true;
+
+ torture_reset_break_info(tctx, &break_info);
+
+ transport1->oplock.handler = torture_oplock_ack_handler;
+ transport1->oplock.private_data = tree1;
+ torture_comment(tctx, "transport1 [%p]\n", transport1);
+ local_port = torture_get_local_port_from_transport(transport1);
+ torture_comment(tctx, "transport1 uses tcp port: %d\n", local_port);
+
+ status = torture_smb2_testdir(tree1, BASEDIR, &_h);
+ CHECK_STATUS(status, NT_STATUS_OK);
+ smb2_util_close(tree1, _h);
+ smb2_util_unlink(tree1, fname1);
+ smb2_util_unlink(tree1, fname2);
+ smb2_util_unlink(tree1, fname3);
+ CHECK_VAL(break_info.count, 0);
+
+ smb2_oplock_create_share(&io1, fname1,
+ smb2_util_share_access("RWD"),
+ smb2_util_oplock_level("b"));
+ test_multichannel_init_smb_create(&io1);
+
+ smb2_oplock_create_share(&io2, fname2,
+ smb2_util_share_access("RWD"),
+ smb2_util_oplock_level("b"));
+ test_multichannel_init_smb_create(&io2);
+
+ smb2_oplock_create_share(&io3, fname3,
+ smb2_util_share_access("RWD"),
+ smb2_util_oplock_level("b"));
+ test_multichannel_init_smb_create(&io3);
+
+ transport2_options = transport1->options;