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
.oplock_level
, smb2_util_oplock_level("b"));
454 _h
= io2
.out
.file
.handle
;
459 smb2_util_close(tree
, *h
);
462 smb2_util_unlink(tree
, fname
);
466 talloc_free(mem_ctx
);
472 * basic test for doing a durable open
473 * tcp disconnect, reconnect with a session reconnect and
474 * do a durable reopen (succeeds)
476 bool test_durable_open_reopen2a(struct torture_context
*tctx
,
477 struct smb2_tree
*tree
)
480 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
482 struct smb2_handle _h
;
483 struct smb2_handle
*h
= NULL
;
484 struct smb2_create io1
, io2
;
485 uint64_t previous_session_id
;
488 /* Choose a random name in case the state is left a little funky. */
489 snprintf(fname
, 256, "durable_open_reopen2_%s.dat",
490 generate_random_str(tctx
, 8));
492 smb2_util_unlink(tree
, fname
);
494 smb2_oplock_create_share(&io1
, fname
,
495 smb2_util_share_access(""),
496 smb2_util_oplock_level("b"));
497 io1
.in
.durable_open
= true;
499 status
= smb2_create(tree
, mem_ctx
, &io1
);
500 CHECK_STATUS(status
, NT_STATUS_OK
);
501 _h
= io1
.out
.file
.handle
;
503 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
504 CHECK_VAL(io1
.out
.durable_open
, true);
505 CHECK_VAL(io1
.out
.oplock_level
, smb2_util_oplock_level("b"));
507 /* disconnect, reconnect and then do durable reopen */
508 previous_session_id
= smb2cli_session_current_id(tree
->session
->smbXcli
);
512 if (!torture_smb2_connection_ext(tctx
, previous_session_id
, &tree
)) {
513 torture_warning(tctx
, "couldn't reconnect, bailing\n");
519 io2
.in
.fname
= fname
;
520 io2
.in
.durable_handle
= h
;
523 status
= smb2_create(tree
, mem_ctx
, &io2
);
524 CHECK_STATUS(status
, NT_STATUS_OK
);
525 CHECK_CREATED(&io2
, EXISTED
, FILE_ATTRIBUTE_ARCHIVE
);
526 CHECK_VAL(io2
.out
.oplock_level
, smb2_util_oplock_level("b"));
527 _h
= io2
.out
.file
.handle
;
532 smb2_util_close(tree
, *h
);
535 smb2_util_unlink(tree
, fname
);
539 talloc_free(mem_ctx
);
546 * basic test for doing a durable open:
547 * tdis, new tcon, try durable reopen (fails)
549 bool test_durable_open_reopen3(struct torture_context
*tctx
,
550 struct smb2_tree
*tree
)
553 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
555 struct smb2_handle _h
;
556 struct smb2_handle
*h
= NULL
;
557 struct smb2_create io1
, io2
;
559 struct smb2_tree
*tree2
;
561 /* Choose a random name in case the state is left a little funky. */
562 snprintf(fname
, 256, "durable_open_reopen3_%s.dat",
563 generate_random_str(tctx
, 8));
565 smb2_util_unlink(tree
, fname
);
567 smb2_oplock_create_share(&io1
, fname
,
568 smb2_util_share_access(""),
569 smb2_util_oplock_level("b"));
570 io1
.in
.durable_open
= true;
572 status
= smb2_create(tree
, mem_ctx
, &io1
);
573 CHECK_STATUS(status
, NT_STATUS_OK
);
574 _h
= io1
.out
.file
.handle
;
576 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
577 CHECK_VAL(io1
.out
.durable_open
, true);
578 CHECK_VAL(io1
.out
.oplock_level
, smb2_util_oplock_level("b"));
580 /* disconnect, reconnect and then do durable reopen */
581 status
= smb2_tdis(tree
);
582 CHECK_STATUS(status
, NT_STATUS_OK
);
584 if (!torture_smb2_tree_connect(tctx
, tree
->session
, mem_ctx
, &tree2
)) {
585 torture_warning(tctx
, "couldn't reconnect to share, bailing\n");
592 io2
.in
.fname
= fname
;
593 io2
.in
.durable_handle
= h
;
595 status
= smb2_create(tree2
, mem_ctx
, &io2
);
596 CHECK_STATUS(status
, NT_STATUS_OBJECT_NAME_NOT_FOUND
);
600 smb2_util_close(tree
, *h
);
603 smb2_util_unlink(tree2
, fname
);
607 talloc_free(mem_ctx
);
613 * basic test for doing a durable open:
614 * logoff, create a new session, do a durable reopen (succeeds)
616 bool test_durable_open_reopen4(struct torture_context
*tctx
,
617 struct smb2_tree
*tree
)
620 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
622 struct smb2_handle _h
;
623 struct smb2_handle
*h
= NULL
;
624 struct smb2_create io1
, io2
;
626 struct smb2_transport
*transport
;
627 struct smb2_session
*session2
;
628 struct smb2_tree
*tree2
;
630 /* Choose a random name in case the state is left a little funky. */
631 snprintf(fname
, 256, "durable_open_reopen4_%s.dat",
632 generate_random_str(tctx
, 8));
634 smb2_util_unlink(tree
, fname
);
636 smb2_oplock_create_share(&io1
, fname
,
637 smb2_util_share_access(""),
638 smb2_util_oplock_level("b"));
639 io1
.in
.durable_open
= true;
640 io1
.in
.create_options
|= NTCREATEX_OPTIONS_DELETE_ON_CLOSE
;
642 status
= smb2_create(tree
, mem_ctx
, &io1
);
643 CHECK_STATUS(status
, NT_STATUS_OK
);
644 _h
= io1
.out
.file
.handle
;
646 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
647 CHECK_VAL(io1
.out
.durable_open
, true);
648 CHECK_VAL(io1
.out
.oplock_level
, smb2_util_oplock_level("b"));
651 * do a session logoff, establish a new session and tree
652 * connect on the same transport, and try a durable reopen
654 transport
= tree
->session
->transport
;
655 status
= smb2_logoff(tree
->session
);
656 CHECK_STATUS(status
, NT_STATUS_OK
);
658 if (!torture_smb2_session_setup(tctx
, transport
,
659 0, /* previous_session_id */
662 torture_warning(tctx
, "session setup failed.\n");
668 * the session setup has talloc-stolen the transport,
669 * so we can safely free the old tree+session for clarity
673 if (!torture_smb2_tree_connect(tctx
, session2
, mem_ctx
, &tree2
)) {
674 torture_warning(tctx
, "tree connect failed.\n");
680 io2
.in
.fname
= fname
;
681 io2
.in
.durable_handle
= h
;
684 status
= smb2_create(tree2
, mem_ctx
, &io2
);
685 CHECK_STATUS(status
, NT_STATUS_OK
);
687 _h
= io2
.out
.file
.handle
;
689 CHECK_CREATED(&io2
, EXISTED
, FILE_ATTRIBUTE_ARCHIVE
);
690 CHECK_VAL(io2
.out
.oplock_level
, smb2_util_oplock_level("b"));
694 smb2_util_close(tree2
, *h
);
697 smb2_util_unlink(tree2
, fname
);
701 talloc_free(mem_ctx
);
706 bool test_durable_open_delete_on_close1(struct torture_context
*tctx
,
707 struct smb2_tree
*tree
)
710 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
712 struct smb2_handle _h
;
713 struct smb2_handle
*h
= NULL
;
714 struct smb2_create io1
, io2
, io3
;
716 struct smb2_transport
*transport
;
717 struct smb2_session
*session2
;
718 struct smb2_tree
*tree2
;
719 union smb_fileinfo info1
, info2
;
721 /* Choose a random name in case the state is left a little funky. */
722 snprintf(fname
, 256, "durable_open_delete_on_close1_%s.dat",
723 generate_random_str(tctx
, 8));
725 smb2_util_unlink(tree
, fname
);
727 smb2_oplock_create_share(&io1
, fname
,
728 smb2_util_share_access(""),
729 smb2_util_oplock_level("b"));
730 io1
.in
.durable_open
= true;
731 io1
.in
.create_options
|= NTCREATEX_OPTIONS_DELETE_ON_CLOSE
;
733 status
= smb2_create(tree
, mem_ctx
, &io1
);
734 CHECK_STATUS(status
, NT_STATUS_OK
);
735 _h
= io1
.out
.file
.handle
;
737 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
738 CHECK_VAL(io1
.out
.durable_open
, true);
739 CHECK_VAL(io1
.out
.oplock_level
, smb2_util_oplock_level("b"));
742 info1
.internal_information
.level
= RAW_FILEINFO_INTERNAL_INFORMATION
;
743 info1
.internal_information
.in
.file
.handle
= _h
;
744 status
= smb2_getinfo_file(tree
, tree
, &info1
);
745 CHECK_STATUS(status
, NT_STATUS_OK
);
748 * do a session logoff, establish a new session and tree
749 * connect on the same transport, and try a durable reopen
751 transport
= tree
->session
->transport
;
752 status
= smb2_logoff(tree
->session
);
753 CHECK_STATUS(status
, NT_STATUS_OK
);
755 if (!torture_smb2_session_setup(tctx
, transport
,
756 0, /* previous_session_id */
759 torture_warning(tctx
, "session setup failed.\n");
765 * the session setup has talloc-stolen the transport,
766 * so we can safely free the old tree+session for clarity
770 if (!torture_smb2_tree_connect(tctx
, session2
, mem_ctx
, &tree2
)) {
771 torture_warning(tctx
, "tree connect failed.\n");
777 io3
.in
.fname
= fname
;
778 io3
.in
.durable_handle
= h
;
781 smb2_oplock_create_share(&io2
, fname
,
782 smb2_util_share_access(""),
783 smb2_util_oplock_level("b"));
784 io2
.in
.create_options
|= NTCREATEX_OPTIONS_DELETE_ON_CLOSE
;
786 status
= smb2_create(tree2
, mem_ctx
, &io2
);
787 CHECK_STATUS(status
, NT_STATUS_OK
);
788 _h
= io2
.out
.file
.handle
;
790 CHECK_CREATED(&io2
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
791 CHECK_VAL(io2
.out
.durable_open
, false);
792 CHECK_VAL(io2
.out
.oplock_level
, smb2_util_oplock_level("b"));
795 info2
.internal_information
.level
= RAW_FILEINFO_INTERNAL_INFORMATION
;
796 info2
.internal_information
.in
.file
.handle
= _h
;
797 status
= smb2_getinfo_file(tree2
, tree2
, &info2
);
798 CHECK_STATUS(status
, NT_STATUS_OK
);
800 CHECK_NOT_VAL(info1
.internal_information
.out
.file_id
,
801 info2
.internal_information
.out
.file_id
);
803 status
= smb2_create(tree2
, mem_ctx
, &io3
);
804 CHECK_STATUS(status
, NT_STATUS_OBJECT_NAME_NOT_FOUND
);
808 smb2_util_close(tree2
, *h
);
811 smb2_util_unlink(tree2
, fname
);
816 talloc_free(mem_ctx
);
822 basic testing of SMB2 durable opens
823 regarding the position information on the handle
825 bool test_durable_open_file_position(struct torture_context
*tctx
,
826 struct smb2_tree
*tree1
,
827 struct smb2_tree
*tree2
)
829 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
830 struct smb2_handle h1
, h2
;
831 struct smb2_create io1
, io2
;
833 const char *fname
= "durable_open_position.dat";
834 union smb_fileinfo qfinfo
;
835 union smb_setfileinfo sfinfo
;
839 smb2_util_unlink(tree1
, fname
);
841 smb2_oplock_create(&io1
, fname
, SMB2_OPLOCK_LEVEL_BATCH
);
842 io1
.in
.durable_open
= true;
844 status
= smb2_create(tree1
, mem_ctx
, &io1
);
845 CHECK_STATUS(status
, NT_STATUS_OK
);
846 h1
= io1
.out
.file
.handle
;
847 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
848 CHECK_VAL(io1
.out
.durable_open
, true);
849 CHECK_VAL(io1
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_BATCH
);
851 /* TODO: check extra blob content */
854 qfinfo
.generic
.level
= RAW_FILEINFO_POSITION_INFORMATION
;
855 qfinfo
.generic
.in
.file
.handle
= h1
;
856 status
= smb2_getinfo_file(tree1
, mem_ctx
, &qfinfo
);
857 CHECK_STATUS(status
, NT_STATUS_OK
);
858 CHECK_VAL(qfinfo
.position_information
.out
.position
, 0);
859 pos
= qfinfo
.position_information
.out
.position
;
860 torture_comment(tctx
, "position: %llu\n",
861 (unsigned long long)pos
);
864 sfinfo
.generic
.level
= RAW_SFILEINFO_POSITION_INFORMATION
;
865 sfinfo
.generic
.in
.file
.handle
= h1
;
866 sfinfo
.position_information
.in
.position
= 0x1000;
867 status
= smb2_setinfo_file(tree1
, &sfinfo
);
868 CHECK_STATUS(status
, NT_STATUS_OK
);
871 qfinfo
.generic
.level
= RAW_FILEINFO_POSITION_INFORMATION
;
872 qfinfo
.generic
.in
.file
.handle
= h1
;
873 status
= smb2_getinfo_file(tree1
, mem_ctx
, &qfinfo
);
874 CHECK_STATUS(status
, NT_STATUS_OK
);
875 CHECK_VAL(qfinfo
.position_information
.out
.position
, 0x1000);
876 pos
= qfinfo
.position_information
.out
.position
;
877 torture_comment(tctx
, "position: %llu\n",
878 (unsigned long long)pos
);
884 qfinfo
.generic
.level
= RAW_FILEINFO_POSITION_INFORMATION
;
885 qfinfo
.generic
.in
.file
.handle
= h1
;
886 status
= smb2_getinfo_file(tree2
, mem_ctx
, &qfinfo
);
887 CHECK_STATUS(status
, NT_STATUS_FILE_CLOSED
);
890 io2
.in
.fname
= fname
;
891 io2
.in
.durable_handle
= &h1
;
893 status
= smb2_create(tree2
, mem_ctx
, &io2
);
894 CHECK_STATUS(status
, NT_STATUS_OK
);
895 CHECK_VAL(io2
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_BATCH
);
896 CHECK_VAL(io2
.out
.reserved
, 0x00);
897 CHECK_VAL(io2
.out
.create_action
, NTCREATEX_ACTION_EXISTED
);
898 CHECK_VAL(io2
.out
.alloc_size
, 0);
899 CHECK_VAL(io2
.out
.size
, 0);
900 CHECK_VAL(io2
.out
.file_attr
, FILE_ATTRIBUTE_ARCHIVE
);
901 CHECK_VAL(io2
.out
.reserved2
, 0);
903 h2
= io2
.out
.file
.handle
;
906 qfinfo
.generic
.level
= RAW_FILEINFO_POSITION_INFORMATION
;
907 qfinfo
.generic
.in
.file
.handle
= h2
;
908 status
= smb2_getinfo_file(tree2
, mem_ctx
, &qfinfo
);
909 CHECK_STATUS(status
, NT_STATUS_OK
);
910 CHECK_VAL(qfinfo
.position_information
.out
.position
, 0x1000);
911 pos
= qfinfo
.position_information
.out
.position
;
912 torture_comment(tctx
, "position: %llu\n",
913 (unsigned long long)pos
);
915 smb2_util_close(tree2
, h2
);
917 talloc_free(mem_ctx
);
919 smb2_util_unlink(tree2
, fname
);
928 Open, disconnect, oplock break, reconnect.
930 bool test_durable_open_oplock(struct torture_context
*tctx
,
931 struct smb2_tree
*tree1
,
932 struct smb2_tree
*tree2
)
934 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
935 struct smb2_create io1
, io2
;
936 struct smb2_handle h1
, h2
;
941 /* Choose a random name in case the state is left a little funky. */
942 snprintf(fname
, 256, "durable_open_oplock_%s.dat", generate_random_str(tctx
, 8));
945 smb2_util_unlink(tree1
, fname
);
947 /* Create with batch oplock */
948 smb2_oplock_create(&io1
, fname
, SMB2_OPLOCK_LEVEL_BATCH
);
949 io1
.in
.durable_open
= true;
952 io2
.in
.create_disposition
= NTCREATEX_DISP_OPEN
;
954 status
= smb2_create(tree1
, mem_ctx
, &io1
);
955 CHECK_STATUS(status
, NT_STATUS_OK
);
956 h1
= io1
.out
.file
.handle
;
957 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
958 CHECK_VAL(io1
.out
.durable_open
, true);
959 CHECK_VAL(io1
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_BATCH
);
961 /* Disconnect after getting the batch */
966 * Windows7 (build 7000) will break a batch oplock immediately if the
967 * original client is gone. (ZML: This seems like a bug. It should give
968 * some time for the client to reconnect!)
970 status
= smb2_create(tree2
, mem_ctx
, &io2
);
971 CHECK_STATUS(status
, NT_STATUS_OK
);
972 h2
= io2
.out
.file
.handle
;
973 CHECK_CREATED(&io2
, EXISTED
, FILE_ATTRIBUTE_ARCHIVE
);
974 CHECK_VAL(io2
.out
.durable_open
, true);
975 CHECK_VAL(io2
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_BATCH
);
977 /* What if tree1 tries to come back and reclaim? */
978 if (!torture_smb2_connection(tctx
, &tree1
)) {
979 torture_warning(tctx
, "couldn't reconnect, bailing\n");
985 io1
.in
.fname
= fname
;
986 io1
.in
.durable_handle
= &h1
;
988 status
= smb2_create(tree1
, mem_ctx
, &io1
);
989 CHECK_STATUS(status
, NT_STATUS_OBJECT_NAME_NOT_FOUND
);
992 smb2_util_close(tree2
, h2
);
993 smb2_util_unlink(tree2
, fname
);
1002 Open, disconnect, lease break, reconnect.
1004 bool test_durable_open_lease(struct torture_context
*tctx
,
1005 struct smb2_tree
*tree1
,
1006 struct smb2_tree
*tree2
)
1008 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
1009 struct smb2_create io1
, io2
;
1010 struct smb2_lease ls1
, ls2
;
1011 struct smb2_handle h1
, h2
;
1015 uint64_t lease1
, lease2
;
1018 caps
= smb2cli_conn_server_capabilities(tree1
->session
->transport
->conn
);
1019 if (!(caps
& SMB2_CAP_LEASING
)) {
1020 torture_skip(tctx
, "leases are not supported");
1024 * Choose a random name and random lease in case the state is left a
1029 snprintf(fname
, 256, "durable_open_lease_%s.dat", generate_random_str(tctx
, 8));
1032 smb2_util_unlink(tree1
, fname
);
1034 /* Create with lease */
1035 smb2_lease_create(&io1
, &ls1
, false /* dir */, fname
,
1036 lease1
, smb2_util_lease_state("RHW"));
1037 io1
.in
.durable_open
= true;
1039 smb2_lease_create(&io2
, &ls2
, false /* dir */, fname
,
1040 lease2
, smb2_util_lease_state("RHW"));
1041 io2
.in
.durable_open
= true;
1042 io2
.in
.create_disposition
= NTCREATEX_DISP_OPEN
;
1044 status
= smb2_create(tree1
, mem_ctx
, &io1
);
1045 CHECK_STATUS(status
, NT_STATUS_OK
);
1046 h1
= io1
.out
.file
.handle
;
1047 CHECK_VAL(io1
.out
.durable_open
, true);
1048 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
1050 CHECK_VAL(io1
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_LEASE
);
1051 CHECK_VAL(io1
.out
.lease_response
.lease_key
.data
[0], lease1
);
1052 CHECK_VAL(io1
.out
.lease_response
.lease_key
.data
[1], ~lease1
);
1053 CHECK_VAL(io1
.out
.lease_response
.lease_state
,
1054 SMB2_LEASE_READ
|SMB2_LEASE_HANDLE
|SMB2_LEASE_WRITE
);
1056 /* Disconnect after getting the lease */
1061 * Windows7 (build 7000) will grant an RH lease immediate (not an RHW?)
1062 * even if the original client is gone. (ZML: This seems like a bug. It
1063 * should give some time for the client to reconnect! And why RH?)
1065 * obnox: Current windows 7 and w2k8r2 grant RHW instead of RH.
1066 * Test is adapted accordingly.
1068 status
= smb2_create(tree2
, mem_ctx
, &io2
);
1069 CHECK_STATUS(status
, NT_STATUS_OK
);
1070 h2
= io2
.out
.file
.handle
;
1071 CHECK_VAL(io2
.out
.durable_open
, true);
1072 CHECK_CREATED(&io2
, EXISTED
, FILE_ATTRIBUTE_ARCHIVE
);
1074 CHECK_VAL(io2
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_LEASE
);
1075 CHECK_VAL(io2
.out
.lease_response
.lease_key
.data
[0], lease2
);
1076 CHECK_VAL(io2
.out
.lease_response
.lease_key
.data
[1], ~lease2
);
1077 CHECK_VAL(io2
.out
.lease_response
.lease_state
,
1078 SMB2_LEASE_READ
|SMB2_LEASE_HANDLE
|SMB2_LEASE_WRITE
);
1080 /* What if tree1 tries to come back and reclaim? */
1081 if (!torture_smb2_connection(tctx
, &tree1
)) {
1082 torture_warning(tctx
, "couldn't reconnect, bailing\n");
1088 io1
.in
.fname
= fname
;
1089 io1
.in
.durable_handle
= &h1
;
1090 io1
.in
.lease_request
= &ls1
;
1092 status
= smb2_create(tree1
, mem_ctx
, &io1
);
1093 CHECK_STATUS(status
, NT_STATUS_OBJECT_NAME_NOT_FOUND
);
1096 smb2_util_close(tree2
, h2
);
1097 smb2_util_unlink(tree2
, fname
);
1105 bool test_durable_open_lock_oplock(struct torture_context
*tctx
,
1106 struct smb2_tree
*tree
)
1108 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
1109 struct smb2_create io
;
1110 struct smb2_handle h
;
1111 struct smb2_lock lck
;
1112 struct smb2_lock_element el
[2];
1119 snprintf(fname
, 256, "durable_open_oplock_lock_%s.dat", generate_random_str(tctx
, 8));
1122 smb2_util_unlink(tree
, fname
);
1124 /* Create with lease */
1126 smb2_oplock_create_share(&io
, fname
,
1127 smb2_util_share_access(""),
1128 smb2_util_oplock_level("b"));
1129 io
.in
.durable_open
= true;
1131 status
= smb2_create(tree
, mem_ctx
, &io
);
1132 CHECK_STATUS(status
, NT_STATUS_OK
);
1133 h
= io
.out
.file
.handle
;
1134 CHECK_CREATED(&io
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
1136 CHECK_VAL(io
.out
.durable_open
, true);
1137 CHECK_VAL(io
.out
.oplock_level
, smb2_util_oplock_level("b"));
1142 lck
.in
.lock_count
= 0x0001;
1143 lck
.in
.lock_sequence
= 0x00000000;
1144 lck
.in
.file
.handle
= h
;
1147 el
[0].reserved
= 0x00000000;
1148 el
[0].flags
= SMB2_LOCK_FLAG_EXCLUSIVE
;
1149 status
= smb2_lock(tree
, &lck
);
1150 CHECK_STATUS(status
, NT_STATUS_OK
);
1152 /* Disconnect/Reconnect. */
1156 if (!torture_smb2_connection(tctx
, &tree
)) {
1157 torture_warning(tctx
, "couldn't reconnect, bailing\n");
1163 io
.in
.fname
= fname
;
1164 io
.in
.durable_handle
= &h
;
1166 status
= smb2_create(tree
, mem_ctx
, &io
);
1167 CHECK_STATUS(status
, NT_STATUS_OK
);
1168 h
= io
.out
.file
.handle
;
1170 lck
.in
.file
.handle
= h
;
1171 el
[0].flags
= SMB2_LOCK_FLAG_UNLOCK
;
1172 status
= smb2_lock(tree
, &lck
);
1173 CHECK_STATUS(status
, NT_STATUS_OK
);
1176 smb2_util_close(tree
, h
);
1177 smb2_util_unlink(tree
, fname
);
1184 Open, take BRL, disconnect, reconnect.
1186 bool test_durable_open_lock_lease(struct torture_context
*tctx
,
1187 struct smb2_tree
*tree
)
1189 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
1190 struct smb2_create io
;
1191 struct smb2_lease ls
;
1192 struct smb2_handle h
;
1193 struct smb2_lock lck
;
1194 struct smb2_lock_element el
[2];
1201 caps
= smb2cli_conn_server_capabilities(tree
->session
->transport
->conn
);
1202 if (!(caps
& SMB2_CAP_LEASING
)) {
1203 torture_skip(tctx
, "leases are not supported");
1207 * Choose a random name and random lease in case the state is left a
1211 snprintf(fname
, 256, "durable_open_lease_lock_%s.dat", generate_random_str(tctx
, 8));
1214 smb2_util_unlink(tree
, fname
);
1216 /* Create with lease */
1218 smb2_lease_create(&io
, &ls
, false /* dir */, fname
, lease
,
1219 smb2_util_lease_state("RWH"));
1220 io
.in
.durable_open
= true;
1222 status
= smb2_create(tree
, mem_ctx
, &io
);
1223 CHECK_STATUS(status
, NT_STATUS_OK
);
1224 h
= io
.out
.file
.handle
;
1225 CHECK_CREATED(&io
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
1227 CHECK_VAL(io
.out
.durable_open
, true);
1228 CHECK_VAL(io
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_LEASE
);
1229 CHECK_VAL(io
.out
.lease_response
.lease_key
.data
[0], lease
);
1230 CHECK_VAL(io
.out
.lease_response
.lease_key
.data
[1], ~lease
);
1231 CHECK_VAL(io
.out
.lease_response
.lease_state
,
1232 SMB2_LEASE_READ
|SMB2_LEASE_HANDLE
|SMB2_LEASE_WRITE
);
1237 lck
.in
.lock_count
= 0x0001;
1238 lck
.in
.lock_sequence
= 0x00000000;
1239 lck
.in
.file
.handle
= h
;
1242 el
[0].reserved
= 0x00000000;
1243 el
[0].flags
= SMB2_LOCK_FLAG_EXCLUSIVE
;
1244 status
= smb2_lock(tree
, &lck
);
1245 CHECK_STATUS(status
, NT_STATUS_OK
);
1247 /* Disconnect/Reconnect. */
1251 if (!torture_smb2_connection(tctx
, &tree
)) {
1252 torture_warning(tctx
, "couldn't reconnect, bailing\n");
1258 io
.in
.fname
= fname
;
1259 io
.in
.durable_handle
= &h
;
1260 io
.in
.lease_request
= &ls
;
1262 status
= smb2_create(tree
, mem_ctx
, &io
);
1263 CHECK_STATUS(status
, NT_STATUS_OK
);
1264 h
= io
.out
.file
.handle
;
1266 lck
.in
.file
.handle
= h
;
1267 el
[0].flags
= SMB2_LOCK_FLAG_UNLOCK
;
1268 status
= smb2_lock(tree
, &lck
);
1269 CHECK_STATUS(status
, NT_STATUS_OK
);
1272 smb2_util_close(tree
, h
);
1273 smb2_util_unlink(tree
, fname
);
1280 * Open with a RH lease, disconnect, open in another tree, reconnect.
1282 * This test actually demonstrates a minimum level of respect for the durable
1283 * open in the face of another open. As long as this test shows an inability to
1284 * reconnect after an open, the oplock/lease tests above will certainly
1285 * demonstrate an error on reconnect.
1287 bool test_durable_open_open2_lease(struct torture_context
*tctx
,
1288 struct smb2_tree
*tree1
,
1289 struct smb2_tree
*tree2
)
1291 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
1292 struct smb2_create io1
, io2
;
1293 struct smb2_lease ls
;
1294 struct smb2_handle h1
, h2
;
1301 caps
= smb2cli_conn_server_capabilities(tree1
->session
->transport
->conn
);
1302 if (!(caps
& SMB2_CAP_LEASING
)) {
1303 torture_skip(tctx
, "leases are not supported");
1307 * Choose a random name and random lease in case the state is left a
1311 snprintf(fname
, 256, "durable_open_open2_lease_%s.dat",
1312 generate_random_str(tctx
, 8));
1315 smb2_util_unlink(tree1
, fname
);
1317 /* Create with lease */
1318 smb2_lease_create_share(&io1
, &ls
, false /* dir */, fname
,
1319 smb2_util_share_access(""),
1321 smb2_util_lease_state("RH"));
1322 io1
.in
.durable_open
= true;
1324 status
= smb2_create(tree1
, mem_ctx
, &io1
);
1325 CHECK_STATUS(status
, NT_STATUS_OK
);
1326 h1
= io1
.out
.file
.handle
;
1327 CHECK_VAL(io1
.out
.durable_open
, true);
1328 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
1330 CHECK_VAL(io1
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_LEASE
);
1331 CHECK_VAL(io1
.out
.lease_response
.lease_key
.data
[0], lease
);
1332 CHECK_VAL(io1
.out
.lease_response
.lease_key
.data
[1], ~lease
);
1333 CHECK_VAL(io1
.out
.lease_response
.lease_state
,
1334 smb2_util_lease_state("RH"));
1340 /* Open the file in tree2 */
1341 smb2_oplock_create(&io2
, fname
, SMB2_OPLOCK_LEVEL_NONE
);
1343 status
= smb2_create(tree2
, mem_ctx
, &io2
);
1344 CHECK_STATUS(status
, NT_STATUS_OK
);
1345 h2
= io2
.out
.file
.handle
;
1346 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
1349 if (!torture_smb2_connection(tctx
, &tree1
)) {
1350 torture_warning(tctx
, "couldn't reconnect, bailing\n");
1356 io1
.in
.fname
= fname
;
1357 io1
.in
.durable_handle
= &h1
;
1358 io1
.in
.lease_request
= &ls
;
1361 * Windows7 (build 7000) will give away an open immediately if the
1362 * original client is gone. (ZML: This seems like a bug. It should give
1363 * some time for the client to reconnect!)
1365 status
= smb2_create(tree1
, mem_ctx
, &io1
);
1366 CHECK_STATUS(status
, NT_STATUS_OBJECT_NAME_NOT_FOUND
);
1367 h1
= io1
.out
.file
.handle
;
1370 smb2_util_close(tree2
, h2
);
1371 smb2_util_unlink(tree2
, fname
);
1372 smb2_util_close(tree1
, h1
);
1373 smb2_util_unlink(tree1
, fname
);
1382 * Open with a batch oplock, disconnect, open in another tree, reconnect.
1384 * This test actually demonstrates a minimum level of respect for the durable
1385 * open in the face of another open. As long as this test shows an inability to
1386 * reconnect after an open, the oplock/lease tests above will certainly
1387 * demonstrate an error on reconnect.
1389 bool test_durable_open_open2_oplock(struct torture_context
*tctx
,
1390 struct smb2_tree
*tree1
,
1391 struct smb2_tree
*tree2
)
1393 TALLOC_CTX
*mem_ctx
= talloc_new(tctx
);
1394 struct smb2_create io1
, io2
;
1395 struct smb2_handle h1
, h2
;
1401 * Choose a random name and random lease in case the state is left a
1404 snprintf(fname
, 256, "durable_open_open2_oplock_%s.dat",
1405 generate_random_str(tctx
, 8));
1408 smb2_util_unlink(tree1
, fname
);
1410 /* Create with batch oplock */
1411 smb2_oplock_create(&io1
, fname
, SMB2_OPLOCK_LEVEL_BATCH
);
1412 io1
.in
.durable_open
= true;
1414 status
= smb2_create(tree1
, mem_ctx
, &io1
);
1415 CHECK_STATUS(status
, NT_STATUS_OK
);
1416 h1
= io1
.out
.file
.handle
;
1417 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
1418 CHECK_VAL(io1
.out
.durable_open
, true);
1419 CHECK_VAL(io1
.out
.oplock_level
, SMB2_OPLOCK_LEVEL_BATCH
);
1425 /* Open the file in tree2 */
1426 smb2_oplock_create(&io2
, fname
, SMB2_OPLOCK_LEVEL_NONE
);
1428 status
= smb2_create(tree2
, mem_ctx
, &io2
);
1429 CHECK_STATUS(status
, NT_STATUS_OK
);
1430 h2
= io2
.out
.file
.handle
;
1431 CHECK_CREATED(&io1
, CREATED
, FILE_ATTRIBUTE_ARCHIVE
);
1434 if (!torture_smb2_connection(tctx
, &tree1
)) {
1435 torture_warning(tctx
, "couldn't reconnect, bailing\n");
1441 io1
.in
.fname
= fname
;
1442 io1
.in
.durable_handle
= &h1
;
1444 status
= smb2_create(tree1
, mem_ctx
, &io1
);
1445 CHECK_STATUS(status
, NT_STATUS_OBJECT_NAME_NOT_FOUND
);
1446 h1
= io1
.out
.file
.handle
;
1449 smb2_util_close(tree2
, h2
);
1450 smb2_util_unlink(tree2
, fname
);
1451 smb2_util_close(tree1
, h1
);
1452 smb2_util_unlink(tree1
, fname
);
1460 struct torture_suite
*torture_smb2_durable_open_init(void)
1462 struct torture_suite
*suite
=
1463 torture_suite_create(talloc_autofree_context(), "durable-open");
1465 torture_suite_add_1smb2_test(suite
, "open-oplock", test_durable_open_open_oplock
);
1466 torture_suite_add_1smb2_test(suite
, "open-lease", test_durable_open_open_lease
);
1467 torture_suite_add_1smb2_test(suite
, "reopen1", test_durable_open_reopen1
);
1468 torture_suite_add_1smb2_test(suite
, "reopen2", test_durable_open_reopen2
);
1469 torture_suite_add_1smb2_test(suite
, "reopen2a", test_durable_open_reopen2a
);
1470 torture_suite_add_1smb2_test(suite
, "reopen3", test_durable_open_reopen3
);
1471 torture_suite_add_1smb2_test(suite
, "reopen4", test_durable_open_reopen4
);
1472 torture_suite_add_1smb2_test(suite
, "delete_on_close1",
1473 test_durable_open_delete_on_close1
);
1474 torture_suite_add_2smb2_test(suite
, "file-position",
1475 test_durable_open_file_position
);
1476 torture_suite_add_2smb2_test(suite
, "oplock", test_durable_open_oplock
);
1477 torture_suite_add_2smb2_test(suite
, "lease", test_durable_open_lease
);
1478 torture_suite_add_1smb2_test(suite
, "lock-oplock", test_durable_open_lock_oplock
);
1479 torture_suite_add_1smb2_test(suite
, "lock-lease", test_durable_open_lock_lease
);
1480 torture_suite_add_2smb2_test(suite
, "open2-lease",
1481 test_durable_open_open2_lease
);
1482 torture_suite_add_2smb2_test(suite
, "open2-oplock",
1483 test_durable_open_open2_oplock
);
1485 suite
->description
= talloc_strdup(suite
, "SMB2-DURABLE-OPEN tests");