2 Unix SMB/CIFS implementation.
4 test suite for SMB2 durable opens
6 Copyright (C) Stefan Metzmacher 2008
7 Copyright (C) Michael Adam 2011-2012
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #include "libcli/smb2/smb2.h"
25 #include "libcli/smb2/smb2_calls.h"
26 #include "../libcli/smb/smbXcli_base.h"
27 #include "torture/torture.h"
28 #include "torture/smb2/proto.h"
29 #include "../libcli/smb/smbXcli_base.h"
31 #define CHECK_VAL(v, correct) do { \
32 if ((v) != (correct)) { \
33 torture_result(tctx, TORTURE_FAIL, "(%s): wrong value for %s got 0x%llx - should be 0x%llx\n", \
34 __location__, #v, (unsigned long long)v, (unsigned long long)correct); \
38 #define CHECK_NOT_VAL(v, correct) do { \
39 if ((v) == (correct)) { \
40 torture_result(tctx, TORTURE_FAIL, "(%s): wrong value for %s got 0x%llx - should not be 0x%llx\n", \
41 __location__, #v, (unsigned long long)v, (unsigned long long)correct); \
45 #define CHECK_STATUS(status, correct) do { \
46 if (!NT_STATUS_EQUAL(status, correct)) { \
47 torture_result(tctx, TORTURE_FAIL, __location__": Incorrect status %s - should be %s", \
48 nt_errstr(status), nt_errstr(correct)); \
53 #define CHECK_CREATED(__io, __created, __attribute) \
55 CHECK_VAL((__io)->out.create_action, NTCREATEX_ACTION_ ## __created); \
56 CHECK_VAL((__io)->out.alloc_size, 0); \
57 CHECK_VAL((__io)->out.size, 0); \
58 CHECK_VAL((__io)->out.file_attr, (__attribute)); \
59 CHECK_VAL((__io)->out.reserved2, 0); \
64 * basic durable_open test.
65 * durable state should only be granted when requested
66 * along with a batch oplock or a handle lease.
68 * This test tests durable open with all possible oplock types.
71 struct durable_open_vs_oplock
{
73 const char *share_mode
;
77 #define NUM_OPLOCK_TYPES 4
78 #define NUM_SHARE_MODES 8
79 #define NUM_OPLOCK_OPEN_TESTS ( NUM_OPLOCK_TYPES * NUM_SHARE_MODES )
80 static struct durable_open_vs_oplock durable_open_vs_oplock_table
[NUM_OPLOCK_OPEN_TESTS
] =
98 { "s", "RWD", false },
104 { "x", "RD", false },
105 { "x", "RW", false },
106 { "x", "WD", false },
107 { "x", "RWD", false },
116 { "b", "RWD", true },
119 static bool test_one_durable_open_open_oplock(struct torture_context
*tctx
,
120 struct smb2_tree
*tree
,
122 struct durable_open_vs_oplock test
)
125 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
126 struct smb2_handle _h
;
127 struct smb2_handle
*h
= NULL
;
129 struct smb2_create io
;
131 smb2_util_unlink(tree
, fname
);
133 smb2_oplock_create_share(&io
, fname
,
134 smb2_util_share_access(test
.share_mode
),
135 smb2_util_oplock_level(test
.level
));
136 io
.in
.durable_open
= true;
138 status
= smb2_create(tree
, mem_ctx
, &io
);
139 CHECK_STATUS(status
, NT_STATUS_OK
);
140 _h
= io
.out
.file
.handle
;
142 CHECK_CREATED(&io
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
143 CHECK_VAL(io
.out
.durable_open
, test
.expected
);
144 CHECK_VAL(io
.out
.oplock_level
, smb2_util_oplock_level(test
.level
));
148 smb2_util_close(tree
, *h
);
150 smb2_util_unlink(tree
, fname
);
151 talloc_free(mem_ctx
);
156 bool test_durable_open_open_oplock(struct torture_context
*tctx
,
157 struct smb2_tree
*tree
)
159 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
164 /* Choose a random name in case the state is left a little funky. */
165 snprintf(fname
, 256, "durable_open_open_oplock_%s.dat", generate_random_str(tctx
, 8));
167 smb2_util_unlink(tree
, fname
);
169 /* test various oplock levels with durable open */
171 for (i
= 0; i
< NUM_OPLOCK_OPEN_TESTS
; i
++) {
172 ret
= test_one_durable_open_open_oplock(tctx
,
175 durable_open_vs_oplock_table
[i
]);
182 smb2_util_unlink(tree
, fname
);
184 talloc_free(mem_ctx
);
190 * basic durable_open test.
191 * durable state should only be granted when requested
192 * along with a batch oplock or a handle lease.
194 * This test tests durable open with all valid lease types.
197 struct durable_open_vs_lease
{
199 const char *share_mode
;
203 #define NUM_LEASE_TYPES 5
204 #define NUM_LEASE_OPEN_TESTS ( NUM_LEASE_TYPES * NUM_SHARE_MODES )
205 static struct durable_open_vs_lease durable_open_vs_lease_table
[NUM_LEASE_OPEN_TESTS
] =
214 { "", "RWD", false },
220 { "R", "RW", false },
221 { "R", "RD", false },
222 { "R", "DW", false },
223 { "R", "RWD", false },
226 { "RW", "R", false },
227 { "RW", "W", false },
228 { "RW", "D", false },
229 { "RW", "RW", false },
230 { "RW", "RD", false },
231 { "RW", "WD", false },
232 { "RW", "RWD", false },
238 { "RH", "RW", true },
239 { "RH", "RD", true },
240 { "RH", "WD", true },
241 { "RH", "RWD", true },
244 { "RHW", "R", true },
245 { "RHW", "W", true },
246 { "RHW", "D", true },
247 { "RHW", "RW", true },
248 { "RHW", "RD", true },
249 { "RHW", "WD", true },
250 { "RHW", "RWD", true },
253 static bool test_one_durable_open_open_lease(struct torture_context
*tctx
,
254 struct smb2_tree
*tree
,
256 struct durable_open_vs_lease test
)
259 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
260 struct smb2_handle _h
;
261 struct smb2_handle
*h
= NULL
;
263 struct smb2_create io
;
264 struct smb2_lease ls
;
268 caps
= smb2cli_conn_server_capabilities(tree
->session
->transport
->conn
);
269 if (!(caps
& SMB2_CAP_LEASING
)) {
270 torture_skip(tctx
, "leases are not supported");
273 smb2_util_unlink(tree
, fname
);
277 smb2_lease_create_share(&io
, &ls
, false /* dir */, fname
,
278 smb2_util_share_access(test
.share_mode
),
280 smb2_util_lease_state(test
.type
));
281 io
.in
.durable_open
= true;
283 status
= smb2_create(tree
, mem_ctx
, &io
);
284 CHECK_STATUS(status
, NT_STATUS_OK
);
285 _h
= io
.out
.file
.handle
;
287 CHECK_CREATED(&io
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
288 CHECK_VAL(io
.out
.durable_open
, test
.expected
);
289 CHECK_VAL(io
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_LEASE
);
290 CHECK_VAL(io
.out
.lease_response
.lease_key
.data
[0], lease
);
291 CHECK_VAL(io
.out
.lease_response
.lease_key
.data
[1], ~lease
);
292 CHECK_VAL(io
.out
.lease_response
.lease_state
,
293 smb2_util_lease_state(test
.type
));
296 smb2_util_close(tree
, *h
);
298 smb2_util_unlink(tree
, fname
);
299 talloc_free(mem_ctx
);
304 bool test_durable_open_open_lease(struct torture_context
*tctx
,
305 struct smb2_tree
*tree
)
307 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
313 caps
= smb2cli_conn_server_capabilities(tree
->session
->transport
->conn
);
314 if (!(caps
& SMB2_CAP_LEASING
)) {
315 torture_skip(tctx
, "leases are not supported");
318 /* Choose a random name in case the state is left a little funky. */
319 snprintf(fname
, 256, "durable_open_open_lease_%s.dat", generate_random_str(tctx
, 8));
321 smb2_util_unlink(tree
, fname
);
324 /* test various oplock levels with durable open */
326 for (i
= 0; i
< NUM_LEASE_OPEN_TESTS
; i
++) {
327 ret
= test_one_durable_open_open_lease(tctx
,
330 durable_open_vs_lease_table
[i
]);
337 smb2_util_unlink(tree
, fname
);
339 talloc_free(mem_ctx
);
345 * basic test for doing a durable open
346 * and do a durable reopen on the same connection
347 * while the first open is still active (fails)
349 bool test_durable_open_reopen1(struct torture_context
*tctx
,
350 struct smb2_tree
*tree
)
353 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
355 struct smb2_handle _h
;
356 struct smb2_handle
*h
= NULL
;
357 struct smb2_create io1
, io2
;
360 /* Choose a random name in case the state is left a little funky. */
361 snprintf(fname
, 256, "durable_open_reopen1_%s.dat",
362 generate_random_str(tctx
, 8));
364 smb2_util_unlink(tree
, fname
);
366 smb2_oplock_create_share(&io1
, fname
,
367 smb2_util_share_access(""),
368 smb2_util_oplock_level("b"));
369 io1
.in
.durable_open
= true;
371 status
= smb2_create(tree
, mem_ctx
, &io1
);
372 CHECK_STATUS(status
, NT_STATUS_OK
);
373 _h
= io1
.out
.file
.handle
;
375 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
376 CHECK_VAL(io1
.out
.durable_open
, true);
377 CHECK_VAL(io1
.out
.oplock_level
, smb2_util_oplock_level("b"));
379 /* try a durable reconnect while the file is still open */
381 io2
.in
.fname
= fname
;
382 io2
.in
.durable_handle
= h
;
384 status
= smb2_create(tree
, mem_ctx
, &io2
);
385 CHECK_STATUS(status
, NT_STATUS_OBJECT_NAME_NOT_FOUND
);
389 smb2_util_close(tree
, *h
);
392 smb2_util_unlink(tree
, fname
);
396 talloc_free(mem_ctx
);
402 * basic test for doing a durable open
403 * tcp disconnect, reconnect, do a durable reopen (succeeds)
405 bool test_durable_open_reopen2(struct torture_context
*tctx
,
406 struct smb2_tree
*tree
)
409 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
411 struct smb2_handle _h
;
412 struct smb2_handle
*h
= NULL
;
413 struct smb2_create io1
, io2
;
416 /* Choose a random name in case the state is left a little funky. */
417 snprintf(fname
, 256, "durable_open_reopen2_%s.dat",
418 generate_random_str(tctx
, 8));
420 smb2_util_unlink(tree
, fname
);
422 smb2_oplock_create_share(&io1
, fname
,
423 smb2_util_share_access(""),
424 smb2_util_oplock_level("b"));
425 io1
.in
.durable_open
= true;
427 status
= smb2_create(tree
, mem_ctx
, &io1
);
428 CHECK_STATUS(status
, NT_STATUS_OK
);
429 _h
= io1
.out
.file
.handle
;
431 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
432 CHECK_VAL(io1
.out
.durable_open
, true);
433 CHECK_VAL(io1
.out
.oplock_level
, smb2_util_oplock_level("b"));
435 /* disconnect, reconnect and then do durable reopen */
439 if (!torture_smb2_connection(tctx
, &tree
)) {
440 torture_warning(tctx
, "couldn't reconnect, bailing\n");
446 io2
.in
.fname
= fname
;
447 io2
.in
.durable_handle
= h
;
450 status
= smb2_create(tree
, mem_ctx
, &io2
);
451 CHECK_STATUS(status
, NT_STATUS_OK
);
452 CHECK_CREATED(&io2
, EXISTED
, FILE_ATTRIBUTE_ARCHIVE
);
453 CHECK_VAL(io2
.out
.durable_open
, true);
454 CHECK_VAL(io2
.out
.oplock_level
, smb2_util_oplock_level("b"));
455 _h
= io2
.out
.file
.handle
;
460 smb2_util_close(tree
, *h
);
463 smb2_util_unlink(tree
, fname
);
467 talloc_free(mem_ctx
);
473 * basic test for doing a durable open
474 * tcp disconnect, reconnect with a session reconnect and
475 * do a durable reopen (succeeds)
477 bool test_durable_open_reopen2a(struct torture_context
*tctx
,
478 struct smb2_tree
*tree
)
481 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
483 struct smb2_handle _h
;
484 struct smb2_handle
*h
= NULL
;
485 struct smb2_create io1
, io2
;
486 uint64_t previous_session_id
;
489 /* Choose a random name in case the state is left a little funky. */
490 snprintf(fname
, 256, "durable_open_reopen2_%s.dat",
491 generate_random_str(tctx
, 8));
493 smb2_util_unlink(tree
, fname
);
495 smb2_oplock_create_share(&io1
, fname
,
496 smb2_util_share_access(""),
497 smb2_util_oplock_level("b"));
498 io1
.in
.durable_open
= true;
500 status
= smb2_create(tree
, mem_ctx
, &io1
);
501 CHECK_STATUS(status
, NT_STATUS_OK
);
502 _h
= io1
.out
.file
.handle
;
504 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
505 CHECK_VAL(io1
.out
.durable_open
, true);
506 CHECK_VAL(io1
.out
.oplock_level
, smb2_util_oplock_level("b"));
508 /* disconnect, reconnect and then do durable reopen */
509 previous_session_id
= smb2cli_session_current_id(tree
->session
->smbXcli
);
513 if (!torture_smb2_connection_ext(tctx
, previous_session_id
, &tree
)) {
514 torture_warning(tctx
, "couldn't reconnect, bailing\n");
520 io2
.in
.fname
= fname
;
521 io2
.in
.durable_handle
= h
;
524 status
= smb2_create(tree
, mem_ctx
, &io2
);
525 CHECK_STATUS(status
, NT_STATUS_OK
);
526 CHECK_CREATED(&io2
, EXISTED
, FILE_ATTRIBUTE_ARCHIVE
);
527 CHECK_VAL(io2
.out
.durable_open
, true);
528 CHECK_VAL(io2
.out
.oplock_level
, smb2_util_oplock_level("b"));
529 _h
= io2
.out
.file
.handle
;
534 smb2_util_close(tree
, *h
);
537 smb2_util_unlink(tree
, fname
);
541 talloc_free(mem_ctx
);
548 * basic test for doing a durable open:
549 * tdis, new tcon, try durable reopen (fails)
551 bool test_durable_open_reopen3(struct torture_context
*tctx
,
552 struct smb2_tree
*tree
)
555 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
557 struct smb2_handle _h
;
558 struct smb2_handle
*h
= NULL
;
559 struct smb2_create io1
, io2
;
561 struct smb2_tree
*tree2
;
563 /* Choose a random name in case the state is left a little funky. */
564 snprintf(fname
, 256, "durable_open_reopen3_%s.dat",
565 generate_random_str(tctx
, 8));
567 smb2_util_unlink(tree
, fname
);
569 smb2_oplock_create_share(&io1
, fname
,
570 smb2_util_share_access(""),
571 smb2_util_oplock_level("b"));
572 io1
.in
.durable_open
= true;
574 status
= smb2_create(tree
, mem_ctx
, &io1
);
575 CHECK_STATUS(status
, NT_STATUS_OK
);
576 _h
= io1
.out
.file
.handle
;
578 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
579 CHECK_VAL(io1
.out
.durable_open
, true);
580 CHECK_VAL(io1
.out
.oplock_level
, smb2_util_oplock_level("b"));
582 /* disconnect, reconnect and then do durable reopen */
583 status
= smb2_tdis(tree
);
584 CHECK_STATUS(status
, NT_STATUS_OK
);
586 if (!torture_smb2_tree_connect(tctx
, tree
->session
, mem_ctx
, &tree2
)) {
587 torture_warning(tctx
, "couldn't reconnect to share, bailing\n");
594 io2
.in
.fname
= fname
;
595 io2
.in
.durable_handle
= h
;
597 status
= smb2_create(tree2
, mem_ctx
, &io2
);
598 CHECK_STATUS(status
, NT_STATUS_OBJECT_NAME_NOT_FOUND
);
602 smb2_util_close(tree
, *h
);
605 smb2_util_unlink(tree2
, fname
);
609 talloc_free(mem_ctx
);
615 * basic test for doing a durable open:
616 * logoff, create a new session, do a durable reopen (succeeds)
618 bool test_durable_open_reopen4(struct torture_context
*tctx
,
619 struct smb2_tree
*tree
)
622 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
624 struct smb2_handle _h
;
625 struct smb2_handle
*h
= NULL
;
626 struct smb2_create io1
, io2
;
628 struct smb2_transport
*transport
;
629 struct smb2_session
*session2
;
630 struct smb2_tree
*tree2
;
632 /* Choose a random name in case the state is left a little funky. */
633 snprintf(fname
, 256, "durable_open_reopen4_%s.dat",
634 generate_random_str(tctx
, 8));
636 smb2_util_unlink(tree
, fname
);
638 smb2_oplock_create_share(&io1
, fname
,
639 smb2_util_share_access(""),
640 smb2_util_oplock_level("b"));
641 io1
.in
.durable_open
= true;
642 io1
.in
.create_options
|= NTCREATEX_OPTIONS_DELETE_ON_CLOSE
;
644 status
= smb2_create(tree
, mem_ctx
, &io1
);
645 CHECK_STATUS(status
, NT_STATUS_OK
);
646 _h
= io1
.out
.file
.handle
;
648 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
649 CHECK_VAL(io1
.out
.durable_open
, true);
650 CHECK_VAL(io1
.out
.oplock_level
, smb2_util_oplock_level("b"));
653 * do a session logoff, establish a new session and tree
654 * connect on the same transport, and try a durable reopen
656 transport
= tree
->session
->transport
;
657 status
= smb2_logoff(tree
->session
);
658 CHECK_STATUS(status
, NT_STATUS_OK
);
660 if (!torture_smb2_session_setup(tctx
, transport
,
661 0, /* previous_session_id */
664 torture_warning(tctx
, "session setup failed.\n");
670 * the session setup has talloc-stolen the transport,
671 * so we can safely free the old tree+session for clarity
675 if (!torture_smb2_tree_connect(tctx
, session2
, mem_ctx
, &tree2
)) {
676 torture_warning(tctx
, "tree connect failed.\n");
682 io2
.in
.fname
= fname
;
683 io2
.in
.durable_handle
= h
;
686 status
= smb2_create(tree2
, mem_ctx
, &io2
);
687 CHECK_STATUS(status
, NT_STATUS_OK
);
689 _h
= io2
.out
.file
.handle
;
691 CHECK_CREATED(&io2
, EXISTED
, FILE_ATTRIBUTE_ARCHIVE
);
692 CHECK_VAL(io2
.out
.durable_open
, true);
693 CHECK_VAL(io2
.out
.oplock_level
, smb2_util_oplock_level("b"));
697 smb2_util_close(tree2
, *h
);
700 smb2_util_unlink(tree2
, fname
);
704 talloc_free(mem_ctx
);
709 bool test_durable_open_delete_on_close1(struct torture_context
*tctx
,
710 struct smb2_tree
*tree
)
713 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
715 struct smb2_handle _h
;
716 struct smb2_handle
*h
= NULL
;
717 struct smb2_create io1
, io2
, io3
;
719 struct smb2_transport
*transport
;
720 struct smb2_session
*session2
;
721 struct smb2_tree
*tree2
;
722 union smb_fileinfo info1
, info2
;
724 /* Choose a random name in case the state is left a little funky. */
725 snprintf(fname
, 256, "durable_open_delete_on_close1_%s.dat",
726 generate_random_str(tctx
, 8));
728 smb2_util_unlink(tree
, fname
);
730 smb2_oplock_create_share(&io1
, fname
,
731 smb2_util_share_access(""),
732 smb2_util_oplock_level("b"));
733 io1
.in
.durable_open
= true;
734 io1
.in
.create_options
|= NTCREATEX_OPTIONS_DELETE_ON_CLOSE
;
736 status
= smb2_create(tree
, mem_ctx
, &io1
);
737 CHECK_STATUS(status
, NT_STATUS_OK
);
738 _h
= io1
.out
.file
.handle
;
740 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
741 CHECK_VAL(io1
.out
.durable_open
, true);
742 CHECK_VAL(io1
.out
.oplock_level
, smb2_util_oplock_level("b"));
745 info1
.internal_information
.level
= RAW_FILEINFO_INTERNAL_INFORMATION
;
746 info1
.internal_information
.in
.file
.handle
= _h
;
747 status
= smb2_getinfo_file(tree
, tree
, &info1
);
748 CHECK_STATUS(status
, NT_STATUS_OK
);
751 * do a session logoff, establish a new session and tree
752 * connect on the same transport, and try a durable reopen
754 transport
= tree
->session
->transport
;
755 status
= smb2_logoff(tree
->session
);
756 CHECK_STATUS(status
, NT_STATUS_OK
);
758 if (!torture_smb2_session_setup(tctx
, transport
,
759 0, /* previous_session_id */
762 torture_warning(tctx
, "session setup failed.\n");
768 * the session setup has talloc-stolen the transport,
769 * so we can safely free the old tree+session for clarity
773 if (!torture_smb2_tree_connect(tctx
, session2
, mem_ctx
, &tree2
)) {
774 torture_warning(tctx
, "tree connect failed.\n");
780 io3
.in
.fname
= fname
;
781 io3
.in
.durable_handle
= h
;
784 smb2_oplock_create_share(&io2
, fname
,
785 smb2_util_share_access(""),
786 smb2_util_oplock_level("b"));
787 io2
.in
.create_options
|= NTCREATEX_OPTIONS_DELETE_ON_CLOSE
;
789 status
= smb2_create(tree2
, mem_ctx
, &io2
);
790 CHECK_STATUS(status
, NT_STATUS_OK
);
791 _h
= io2
.out
.file
.handle
;
793 CHECK_CREATED(&io2
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
794 CHECK_VAL(io2
.out
.durable_open
, false);
795 CHECK_VAL(io2
.out
.oplock_level
, smb2_util_oplock_level("b"));
798 info2
.internal_information
.level
= RAW_FILEINFO_INTERNAL_INFORMATION
;
799 info2
.internal_information
.in
.file
.handle
= _h
;
800 status
= smb2_getinfo_file(tree2
, tree2
, &info2
);
801 CHECK_STATUS(status
, NT_STATUS_OK
);
803 CHECK_NOT_VAL(info1
.internal_information
.out
.file_id
,
804 info2
.internal_information
.out
.file_id
);
806 status
= smb2_create(tree2
, mem_ctx
, &io3
);
807 CHECK_STATUS(status
, NT_STATUS_OBJECT_NAME_NOT_FOUND
);
811 smb2_util_close(tree2
, *h
);
814 smb2_util_unlink(tree2
, fname
);
819 talloc_free(mem_ctx
);
825 basic testing of SMB2 durable opens
826 regarding the position information on the handle
828 bool test_durable_open_file_position(struct torture_context
*tctx
,
829 struct smb2_tree
*tree1
,
830 struct smb2_tree
*tree2
)
832 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
833 struct smb2_handle h1
, h2
;
834 struct smb2_create io1
, io2
;
836 const char *fname
= "durable_open_position.dat";
837 union smb_fileinfo qfinfo
;
838 union smb_setfileinfo sfinfo
;
842 smb2_util_unlink(tree1
, fname
);
844 smb2_oplock_create(&io1
, fname
, SMB2_OPLOCK_LEVEL_BATCH
);
845 io1
.in
.durable_open
= true;
847 status
= smb2_create(tree1
, mem_ctx
, &io1
);
848 CHECK_STATUS(status
, NT_STATUS_OK
);
849 h1
= io1
.out
.file
.handle
;
850 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
851 CHECK_VAL(io1
.out
.durable_open
, true);
852 CHECK_VAL(io1
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_BATCH
);
854 /* TODO: check extra blob content */
857 qfinfo
.generic
.level
= RAW_FILEINFO_POSITION_INFORMATION
;
858 qfinfo
.generic
.in
.file
.handle
= h1
;
859 status
= smb2_getinfo_file(tree1
, mem_ctx
, &qfinfo
);
860 CHECK_STATUS(status
, NT_STATUS_OK
);
861 CHECK_VAL(qfinfo
.position_information
.out
.position
, 0);
862 pos
= qfinfo
.position_information
.out
.position
;
863 torture_comment(tctx
, "position: %llu\n",
864 (unsigned long long)pos
);
867 sfinfo
.generic
.level
= RAW_SFILEINFO_POSITION_INFORMATION
;
868 sfinfo
.generic
.in
.file
.handle
= h1
;
869 sfinfo
.position_information
.in
.position
= 0x1000;
870 status
= smb2_setinfo_file(tree1
, &sfinfo
);
871 CHECK_STATUS(status
, NT_STATUS_OK
);
874 qfinfo
.generic
.level
= RAW_FILEINFO_POSITION_INFORMATION
;
875 qfinfo
.generic
.in
.file
.handle
= h1
;
876 status
= smb2_getinfo_file(tree1
, mem_ctx
, &qfinfo
);
877 CHECK_STATUS(status
, NT_STATUS_OK
);
878 CHECK_VAL(qfinfo
.position_information
.out
.position
, 0x1000);
879 pos
= qfinfo
.position_information
.out
.position
;
880 torture_comment(tctx
, "position: %llu\n",
881 (unsigned long long)pos
);
887 qfinfo
.generic
.level
= RAW_FILEINFO_POSITION_INFORMATION
;
888 qfinfo
.generic
.in
.file
.handle
= h1
;
889 status
= smb2_getinfo_file(tree2
, mem_ctx
, &qfinfo
);
890 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
893 io2
.in
.fname
= fname
;
894 io2
.in
.durable_handle
= &h1
;
896 status
= smb2_create(tree2
, mem_ctx
, &io2
);
897 CHECK_STATUS(status
, NT_STATUS_OK
);
898 CHECK_VAL(io2
.out
.durable_open
, true);
899 CHECK_VAL(io2
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_BATCH
);
900 CHECK_VAL(io2
.out
.reserved
, 0x00);
901 CHECK_VAL(io2
.out
.create_action
, NTCREATEX_ACTION_EXISTED
);
902 CHECK_VAL(io2
.out
.alloc_size
, 0);
903 CHECK_VAL(io2
.out
.size
, 0);
904 CHECK_VAL(io2
.out
.file_attr
, FILE_ATTRIBUTE_ARCHIVE
);
905 CHECK_VAL(io2
.out
.reserved2
, 0);
907 h2
= io2
.out
.file
.handle
;
910 qfinfo
.generic
.level
= RAW_FILEINFO_POSITION_INFORMATION
;
911 qfinfo
.generic
.in
.file
.handle
= h2
;
912 status
= smb2_getinfo_file(tree2
, mem_ctx
, &qfinfo
);
913 CHECK_STATUS(status
, NT_STATUS_OK
);
914 CHECK_VAL(qfinfo
.position_information
.out
.position
, 0x1000);
915 pos
= qfinfo
.position_information
.out
.position
;
916 torture_comment(tctx
, "position: %llu\n",
917 (unsigned long long)pos
);
919 smb2_util_close(tree2
, h2
);
921 talloc_free(mem_ctx
);
923 smb2_util_unlink(tree2
, fname
);
932 Open, disconnect, oplock break, reconnect.
934 bool test_durable_open_oplock(struct torture_context
*tctx
,
935 struct smb2_tree
*tree1
,
936 struct smb2_tree
*tree2
)
938 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
939 struct smb2_create io1
, io2
;
940 struct smb2_handle h1
, h2
;
945 /* Choose a random name in case the state is left a little funky. */
946 snprintf(fname
, 256, "durable_open_oplock_%s.dat", generate_random_str(tctx
, 8));
949 smb2_util_unlink(tree1
, fname
);
951 /* Create with batch oplock */
952 smb2_oplock_create(&io1
, fname
, SMB2_OPLOCK_LEVEL_BATCH
);
953 io1
.in
.durable_open
= true;
956 io2
.in
.create_disposition
= NTCREATEX_DISP_OPEN
;
958 status
= smb2_create(tree1
, mem_ctx
, &io1
);
959 CHECK_STATUS(status
, NT_STATUS_OK
);
960 h1
= io1
.out
.file
.handle
;
961 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
962 CHECK_VAL(io1
.out
.durable_open
, true);
963 CHECK_VAL(io1
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_BATCH
);
965 /* Disconnect after getting the batch */
970 * Windows7 (build 7000) will break a batch oplock immediately if the
971 * original client is gone. (ZML: This seems like a bug. It should give
972 * some time for the client to reconnect!)
974 status
= smb2_create(tree2
, mem_ctx
, &io2
);
975 CHECK_STATUS(status
, NT_STATUS_OK
);
976 h2
= io2
.out
.file
.handle
;
977 CHECK_CREATED(&io2
, EXISTED
, FILE_ATTRIBUTE_ARCHIVE
);
978 CHECK_VAL(io2
.out
.durable_open
, true);
979 CHECK_VAL(io2
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_BATCH
);
981 /* What if tree1 tries to come back and reclaim? */
982 if (!torture_smb2_connection(tctx
, &tree1
)) {
983 torture_warning(tctx
, "couldn't reconnect, bailing\n");
989 io1
.in
.fname
= fname
;
990 io1
.in
.durable_handle
= &h1
;
992 status
= smb2_create(tree1
, mem_ctx
, &io1
);
993 CHECK_STATUS(status
, NT_STATUS_OBJECT_NAME_NOT_FOUND
);
996 smb2_util_close(tree2
, h2
);
997 smb2_util_unlink(tree2
, fname
);
1006 Open, disconnect, lease break, reconnect.
1008 bool test_durable_open_lease(struct torture_context
*tctx
,
1009 struct smb2_tree
*tree1
,
1010 struct smb2_tree
*tree2
)
1012 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
1013 struct smb2_create io1
, io2
;
1014 struct smb2_lease ls1
, ls2
;
1015 struct smb2_handle h1
, h2
;
1019 uint64_t lease1
, lease2
;
1022 caps
= smb2cli_conn_server_capabilities(tree1
->session
->transport
->conn
);
1023 if (!(caps
& SMB2_CAP_LEASING
)) {
1024 torture_skip(tctx
, "leases are not supported");
1028 * Choose a random name and random lease in case the state is left a
1033 snprintf(fname
, 256, "durable_open_lease_%s.dat", generate_random_str(tctx
, 8));
1036 smb2_util_unlink(tree1
, fname
);
1038 /* Create with lease */
1039 smb2_lease_create(&io1
, &ls1
, false /* dir */, fname
,
1040 lease1
, smb2_util_lease_state("RHW"));
1041 io1
.in
.durable_open
= true;
1043 smb2_lease_create(&io2
, &ls2
, false /* dir */, fname
,
1044 lease2
, smb2_util_lease_state("RHW"));
1045 io2
.in
.durable_open
= true;
1046 io2
.in
.create_disposition
= NTCREATEX_DISP_OPEN
;
1048 status
= smb2_create(tree1
, mem_ctx
, &io1
);
1049 CHECK_STATUS(status
, NT_STATUS_OK
);
1050 h1
= io1
.out
.file
.handle
;
1051 CHECK_VAL(io1
.out
.durable_open
, true);
1052 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
1054 CHECK_VAL(io1
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_LEASE
);
1055 CHECK_VAL(io1
.out
.lease_response
.lease_key
.data
[0], lease1
);
1056 CHECK_VAL(io1
.out
.lease_response
.lease_key
.data
[1], ~lease1
);
1057 CHECK_VAL(io1
.out
.lease_response
.lease_state
,
1058 SMB2_LEASE_READ
|SMB2_LEASE_HANDLE
|SMB2_LEASE_WRITE
);
1060 /* Disconnect after getting the lease */
1065 * Windows7 (build 7000) will grant an RH lease immediate (not an RHW?)
1066 * even if the original client is gone. (ZML: This seems like a bug. It
1067 * should give some time for the client to reconnect! And why RH?)
1069 * obnox: Current windows 7 and w2k8r2 grant RHW instead of RH.
1070 * Test is adapted accordingly.
1072 status
= smb2_create(tree2
, mem_ctx
, &io2
);
1073 CHECK_STATUS(status
, NT_STATUS_OK
);
1074 h2
= io2
.out
.file
.handle
;
1075 CHECK_VAL(io2
.out
.durable_open
, true);
1076 CHECK_CREATED(&io2
, EXISTED
, FILE_ATTRIBUTE_ARCHIVE
);
1078 CHECK_VAL(io2
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_LEASE
);
1079 CHECK_VAL(io2
.out
.lease_response
.lease_key
.data
[0], lease2
);
1080 CHECK_VAL(io2
.out
.lease_response
.lease_key
.data
[1], ~lease2
);
1081 CHECK_VAL(io2
.out
.lease_response
.lease_state
,
1082 SMB2_LEASE_READ
|SMB2_LEASE_HANDLE
|SMB2_LEASE_WRITE
);
1084 /* What if tree1 tries to come back and reclaim? */
1085 if (!torture_smb2_connection(tctx
, &tree1
)) {
1086 torture_warning(tctx
, "couldn't reconnect, bailing\n");
1092 io1
.in
.fname
= fname
;
1093 io1
.in
.durable_handle
= &h1
;
1094 io1
.in
.lease_request
= &ls1
;
1096 status
= smb2_create(tree1
, mem_ctx
, &io1
);
1097 CHECK_STATUS(status
, NT_STATUS_OBJECT_NAME_NOT_FOUND
);
1100 smb2_util_close(tree2
, h2
);
1101 smb2_util_unlink(tree2
, fname
);
1109 bool test_durable_open_lock_oplock(struct torture_context
*tctx
,
1110 struct smb2_tree
*tree
)
1112 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
1113 struct smb2_create io
;
1114 struct smb2_handle h
;
1115 struct smb2_lock lck
;
1116 struct smb2_lock_element el
[2];
1123 snprintf(fname
, 256, "durable_open_oplock_lock_%s.dat", generate_random_str(tctx
, 8));
1126 smb2_util_unlink(tree
, fname
);
1128 /* Create with lease */
1130 smb2_oplock_create_share(&io
, fname
,
1131 smb2_util_share_access(""),
1132 smb2_util_oplock_level("b"));
1133 io
.in
.durable_open
= true;
1135 status
= smb2_create(tree
, mem_ctx
, &io
);
1136 CHECK_STATUS(status
, NT_STATUS_OK
);
1137 h
= io
.out
.file
.handle
;
1138 CHECK_CREATED(&io
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
1140 CHECK_VAL(io
.out
.durable_open
, true);
1141 CHECK_VAL(io
.out
.oplock_level
, smb2_util_oplock_level("b"));
1146 lck
.in
.lock_count
= 0x0001;
1147 lck
.in
.lock_sequence
= 0x00000000;
1148 lck
.in
.file
.handle
= h
;
1151 el
[0].reserved
= 0x00000000;
1152 el
[0].flags
= SMB2_LOCK_FLAG_EXCLUSIVE
;
1153 status
= smb2_lock(tree
, &lck
);
1154 CHECK_STATUS(status
, NT_STATUS_OK
);
1156 /* Disconnect/Reconnect. */
1160 if (!torture_smb2_connection(tctx
, &tree
)) {
1161 torture_warning(tctx
, "couldn't reconnect, bailing\n");
1167 io
.in
.fname
= fname
;
1168 io
.in
.durable_handle
= &h
;
1170 status
= smb2_create(tree
, mem_ctx
, &io
);
1171 CHECK_STATUS(status
, NT_STATUS_OK
);
1172 h
= io
.out
.file
.handle
;
1174 lck
.in
.file
.handle
= h
;
1175 el
[0].flags
= SMB2_LOCK_FLAG_UNLOCK
;
1176 status
= smb2_lock(tree
, &lck
);
1177 CHECK_STATUS(status
, NT_STATUS_OK
);
1180 smb2_util_close(tree
, h
);
1181 smb2_util_unlink(tree
, fname
);
1188 Open, take BRL, disconnect, reconnect.
1190 bool test_durable_open_lock_lease(struct torture_context
*tctx
,
1191 struct smb2_tree
*tree
)
1193 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
1194 struct smb2_create io
;
1195 struct smb2_lease ls
;
1196 struct smb2_handle h
;
1197 struct smb2_lock lck
;
1198 struct smb2_lock_element el
[2];
1205 caps
= smb2cli_conn_server_capabilities(tree
->session
->transport
->conn
);
1206 if (!(caps
& SMB2_CAP_LEASING
)) {
1207 torture_skip(tctx
, "leases are not supported");
1211 * Choose a random name and random lease in case the state is left a
1215 snprintf(fname
, 256, "durable_open_lease_lock_%s.dat", generate_random_str(tctx
, 8));
1218 smb2_util_unlink(tree
, fname
);
1220 /* Create with lease */
1222 smb2_lease_create(&io
, &ls
, false /* dir */, fname
, lease
,
1223 smb2_util_lease_state("RWH"));
1224 io
.in
.durable_open
= true;
1226 status
= smb2_create(tree
, mem_ctx
, &io
);
1227 CHECK_STATUS(status
, NT_STATUS_OK
);
1228 h
= io
.out
.file
.handle
;
1229 CHECK_CREATED(&io
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
1231 CHECK_VAL(io
.out
.durable_open
, true);
1232 CHECK_VAL(io
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_LEASE
);
1233 CHECK_VAL(io
.out
.lease_response
.lease_key
.data
[0], lease
);
1234 CHECK_VAL(io
.out
.lease_response
.lease_key
.data
[1], ~lease
);
1235 CHECK_VAL(io
.out
.lease_response
.lease_state
,
1236 SMB2_LEASE_READ
|SMB2_LEASE_HANDLE
|SMB2_LEASE_WRITE
);
1241 lck
.in
.lock_count
= 0x0001;
1242 lck
.in
.lock_sequence
= 0x00000000;
1243 lck
.in
.file
.handle
= h
;
1246 el
[0].reserved
= 0x00000000;
1247 el
[0].flags
= SMB2_LOCK_FLAG_EXCLUSIVE
;
1248 status
= smb2_lock(tree
, &lck
);
1249 CHECK_STATUS(status
, NT_STATUS_OK
);
1251 /* Disconnect/Reconnect. */
1255 if (!torture_smb2_connection(tctx
, &tree
)) {
1256 torture_warning(tctx
, "couldn't reconnect, bailing\n");
1262 io
.in
.fname
= fname
;
1263 io
.in
.durable_handle
= &h
;
1264 io
.in
.lease_request
= &ls
;
1266 status
= smb2_create(tree
, mem_ctx
, &io
);
1267 CHECK_STATUS(status
, NT_STATUS_OK
);
1268 h
= io
.out
.file
.handle
;
1270 lck
.in
.file
.handle
= h
;
1271 el
[0].flags
= SMB2_LOCK_FLAG_UNLOCK
;
1272 status
= smb2_lock(tree
, &lck
);
1273 CHECK_STATUS(status
, NT_STATUS_OK
);
1276 smb2_util_close(tree
, h
);
1277 smb2_util_unlink(tree
, fname
);
1284 * Open with a RH lease, disconnect, open in another tree, reconnect.
1286 * This test actually demonstrates a minimum level of respect for the durable
1287 * open in the face of another open. As long as this test shows an inability to
1288 * reconnect after an open, the oplock/lease tests above will certainly
1289 * demonstrate an error on reconnect.
1291 bool test_durable_open_open2_lease(struct torture_context
*tctx
,
1292 struct smb2_tree
*tree1
,
1293 struct smb2_tree
*tree2
)
1295 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
1296 struct smb2_create io1
, io2
;
1297 struct smb2_lease ls
;
1298 struct smb2_handle h1
, h2
;
1305 caps
= smb2cli_conn_server_capabilities(tree1
->session
->transport
->conn
);
1306 if (!(caps
& SMB2_CAP_LEASING
)) {
1307 torture_skip(tctx
, "leases are not supported");
1311 * Choose a random name and random lease in case the state is left a
1315 snprintf(fname
, 256, "durable_open_open2_lease_%s.dat",
1316 generate_random_str(tctx
, 8));
1319 smb2_util_unlink(tree1
, fname
);
1321 /* Create with lease */
1322 smb2_lease_create_share(&io1
, &ls
, false /* dir */, fname
,
1323 smb2_util_share_access(""),
1325 smb2_util_lease_state("RH"));
1326 io1
.in
.durable_open
= true;
1328 status
= smb2_create(tree1
, mem_ctx
, &io1
);
1329 CHECK_STATUS(status
, NT_STATUS_OK
);
1330 h1
= io1
.out
.file
.handle
;
1331 CHECK_VAL(io1
.out
.durable_open
, true);
1332 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
1334 CHECK_VAL(io1
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_LEASE
);
1335 CHECK_VAL(io1
.out
.lease_response
.lease_key
.data
[0], lease
);
1336 CHECK_VAL(io1
.out
.lease_response
.lease_key
.data
[1], ~lease
);
1337 CHECK_VAL(io1
.out
.lease_response
.lease_state
,
1338 smb2_util_lease_state("RH"));
1344 /* Open the file in tree2 */
1345 smb2_oplock_create(&io2
, fname
, SMB2_OPLOCK_LEVEL_NONE
);
1347 status
= smb2_create(tree2
, mem_ctx
, &io2
);
1348 CHECK_STATUS(status
, NT_STATUS_OK
);
1349 h2
= io2
.out
.file
.handle
;
1350 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
1353 if (!torture_smb2_connection(tctx
, &tree1
)) {
1354 torture_warning(tctx
, "couldn't reconnect, bailing\n");
1360 io1
.in
.fname
= fname
;
1361 io1
.in
.durable_handle
= &h1
;
1362 io1
.in
.lease_request
= &ls
;
1365 * Windows7 (build 7000) will give away an open immediately if the
1366 * original client is gone. (ZML: This seems like a bug. It should give
1367 * some time for the client to reconnect!)
1369 status
= smb2_create(tree1
, mem_ctx
, &io1
);
1370 CHECK_STATUS(status
, NT_STATUS_OBJECT_NAME_NOT_FOUND
);
1371 h1
= io1
.out
.file
.handle
;
1374 smb2_util_close(tree2
, h2
);
1375 smb2_util_unlink(tree2
, fname
);
1376 smb2_util_close(tree1
, h1
);
1377 smb2_util_unlink(tree1
, fname
);
1386 * Open with a batch oplock, disconnect, open in another tree, reconnect.
1388 * This test actually demonstrates a minimum level of respect for the durable
1389 * open in the face of another open. As long as this test shows an inability to
1390 * reconnect after an open, the oplock/lease tests above will certainly
1391 * demonstrate an error on reconnect.
1393 bool test_durable_open_open2_oplock(struct torture_context
*tctx
,
1394 struct smb2_tree
*tree1
,
1395 struct smb2_tree
*tree2
)
1397 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
1398 struct smb2_create io1
, io2
;
1399 struct smb2_handle h1
, h2
;
1405 * Choose a random name and random lease in case the state is left a
1408 snprintf(fname
, 256, "durable_open_open2_oplock_%s.dat",
1409 generate_random_str(tctx
, 8));
1412 smb2_util_unlink(tree1
, fname
);
1414 /* Create with batch oplock */
1415 smb2_oplock_create(&io1
, fname
, SMB2_OPLOCK_LEVEL_BATCH
);
1416 io1
.in
.durable_open
= true;
1418 status
= smb2_create(tree1
, mem_ctx
, &io1
);
1419 CHECK_STATUS(status
, NT_STATUS_OK
);
1420 h1
= io1
.out
.file
.handle
;
1421 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
1422 CHECK_VAL(io1
.out
.durable_open
, true);
1423 CHECK_VAL(io1
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_BATCH
);
1429 /* Open the file in tree2 */
1430 smb2_oplock_create(&io2
, fname
, SMB2_OPLOCK_LEVEL_NONE
);
1432 status
= smb2_create(tree2
, mem_ctx
, &io2
);
1433 CHECK_STATUS(status
, NT_STATUS_OK
);
1434 h2
= io2
.out
.file
.handle
;
1435 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
1438 if (!torture_smb2_connection(tctx
, &tree1
)) {
1439 torture_warning(tctx
, "couldn't reconnect, bailing\n");
1445 io1
.in
.fname
= fname
;
1446 io1
.in
.durable_handle
= &h1
;
1448 status
= smb2_create(tree1
, mem_ctx
, &io1
);
1449 CHECK_STATUS(status
, NT_STATUS_OBJECT_NAME_NOT_FOUND
);
1450 h1
= io1
.out
.file
.handle
;
1453 smb2_util_close(tree2
, h2
);
1454 smb2_util_unlink(tree2
, fname
);
1455 smb2_util_close(tree1
, h1
);
1456 smb2_util_unlink(tree1
, fname
);
1464 struct torture_suite
*torture_smb2_durable_open_init(void)
1466 struct torture_suite
*suite
=
1467 torture_suite_create(talloc_autofree_context(), "durable-open");
1469 torture_suite_add_1smb2_test(suite
, "open-oplock", test_durable_open_open_oplock
);
1470 torture_suite_add_1smb2_test(suite
, "open-lease", test_durable_open_open_lease
);
1471 torture_suite_add_1smb2_test(suite
, "reopen1", test_durable_open_reopen1
);
1472 torture_suite_add_1smb2_test(suite
, "reopen2", test_durable_open_reopen2
);
1473 torture_suite_add_1smb2_test(suite
, "reopen2a", test_durable_open_reopen2a
);
1474 torture_suite_add_1smb2_test(suite
, "reopen3", test_durable_open_reopen3
);
1475 torture_suite_add_1smb2_test(suite
, "reopen4", test_durable_open_reopen4
);
1476 torture_suite_add_1smb2_test(suite
, "delete_on_close1",
1477 test_durable_open_delete_on_close1
);
1478 torture_suite_add_2smb2_test(suite
, "file-position",
1479 test_durable_open_file_position
);
1480 torture_suite_add_2smb2_test(suite
, "oplock", test_durable_open_oplock
);
1481 torture_suite_add_2smb2_test(suite
, "lease", test_durable_open_lease
);
1482 torture_suite_add_1smb2_test(suite
, "lock-oplock", test_durable_open_lock_oplock
);
1483 torture_suite_add_1smb2_test(suite
, "lock-lease", test_durable_open_lock_lease
);
1484 torture_suite_add_2smb2_test(suite
, "open2-lease",
1485 test_durable_open_open2_lease
);
1486 torture_suite_add_2smb2_test(suite
, "open2-oplock",
1487 test_durable_open_open2_oplock
);
1489 suite
->description
= talloc_strdup(suite
, "SMB2-DURABLE-OPEN tests");