mirror of
https://github.com/samba-team/samba.git
synced 2025-01-10 01:18:15 +03:00
torture: Extend the smb2.oplock.doc1 test
If delete_on_close is set, there is no oplock break. Check that. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
6fbbf94def
commit
672c228310
@ -122,6 +122,7 @@
|
||||
^samba4.smb2.rename.share_delete_no_delete_access\(.*\)$
|
||||
^samba4.smb2.rename.no_share_delete_no_delete_access\(.*\)$
|
||||
^samba4.smb2.rename.msword
|
||||
^samba4.smb2.oplock.doc
|
||||
^samba4.smb2.compound.related3
|
||||
^samba4.smb2.compound.compound-break
|
||||
^samba4.winbind.struct.*.show_sequence # Not yet working in winbind
|
||||
|
@ -2896,16 +2896,19 @@ static bool test_raw_oplock_stream1(struct torture_context *tctx,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool test_smb2_oplock_doc(struct torture_context *tctx, struct smb2_tree *tree)
|
||||
static bool test_smb2_oplock_doc(struct torture_context *tctx, struct smb2_tree *tree,
|
||||
struct smb2_tree *tree2)
|
||||
{
|
||||
const char *fname = BASEDIR "\\test_oplock_doc.dat";
|
||||
NTSTATUS status;
|
||||
bool ret = true;
|
||||
union smb_open io;
|
||||
struct smb2_handle h, h1;
|
||||
union smb_setfileinfo sfinfo;
|
||||
|
||||
status = torture_smb2_testdir(tree, BASEDIR, &h);
|
||||
torture_assert_ntstatus_ok(tctx, status, "Error creating directory");
|
||||
smb2_util_close(tree, h);
|
||||
|
||||
/* cleanup */
|
||||
smb2_util_unlink(tree, fname);
|
||||
@ -2920,15 +2923,15 @@ static bool test_smb2_oplock_doc(struct torture_context *tctx, struct smb2_tree
|
||||
io.smb2.in.desired_access = SEC_RIGHTS_FILE_ALL;
|
||||
io.smb2.in.alloc_size = 0;
|
||||
io.smb2.in.file_attributes = FILE_ATTRIBUTE_NORMAL;
|
||||
io.smb2.in.share_access = NTCREATEX_SHARE_ACCESS_NONE;
|
||||
io.smb2.in.share_access = NTCREATEX_SHARE_ACCESS_READ|
|
||||
NTCREATEX_SHARE_ACCESS_WRITE|NTCREATEX_SHARE_ACCESS_DELETE;
|
||||
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN_IF;
|
||||
io.smb2.in.create_options = NTCREATEX_OPTIONS_DELETE_ON_CLOSE;
|
||||
io.smb2.in.create_options = 0;
|
||||
io.smb2.in.impersonation_level = SMB2_IMPERSONATION_ANONYMOUS;
|
||||
io.smb2.in.security_flags = 0;
|
||||
io.smb2.in.fname = fname;
|
||||
|
||||
torture_comment(tctx, "open a delete-on-close file with a batch "
|
||||
"oplock\n");
|
||||
torture_comment(tctx, "open a file with a batch oplock\n");
|
||||
ZERO_STRUCT(break_info);
|
||||
io.smb2.in.create_flags = NTCREATEX_FLAGS_EXTENDED;
|
||||
io.smb2.in.oplock_level = SMB2_OPLOCK_LEVEL_BATCH;
|
||||
@ -2938,6 +2941,25 @@ static bool test_smb2_oplock_doc(struct torture_context *tctx, struct smb2_tree
|
||||
h1 = io.smb2.out.file.handle;
|
||||
CHECK_VAL(io.smb2.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH);
|
||||
|
||||
torture_comment(tctx, "Set delete on close\n");
|
||||
ZERO_STRUCT(sfinfo);
|
||||
sfinfo.generic.level = RAW_SFILEINFO_DISPOSITION_INFORMATION;
|
||||
sfinfo.generic.in.file.handle = h1;
|
||||
sfinfo.disposition_info.in.delete_on_close = 1;
|
||||
status = smb2_setinfo_file(tree, &sfinfo);
|
||||
torture_assert_ntstatus_ok(tctx, status, "Incorrect status");
|
||||
|
||||
torture_comment(tctx, "2nd open should not break and get "
|
||||
"DELETE_PENDING\n");
|
||||
ZERO_STRUCT(break_info);
|
||||
io.smb2.in.create_disposition = NTCREATEX_DISP_OPEN;
|
||||
io.smb2.in.create_options = 0;
|
||||
io.smb2.in.desired_access = SEC_FILE_READ_DATA;
|
||||
status = smb2_create(tree2, tctx, &io.smb2);
|
||||
torture_assert_ntstatus_equal(tctx, status, NT_STATUS_DELETE_PENDING,
|
||||
"Incorrect status");
|
||||
CHECK_VAL(break_info.count, 0);
|
||||
|
||||
smb2_util_close(tree, h1);
|
||||
|
||||
smb2_util_unlink(tree, fname);
|
||||
@ -3412,7 +3434,7 @@ struct torture_suite *torture_smb2_oplocks_init(void)
|
||||
torture_suite_add_2smb2_test(suite, "batch24", test_smb2_oplock_batch24);
|
||||
torture_suite_add_1smb2_test(suite, "batch25", test_smb2_oplock_batch25);
|
||||
torture_suite_add_2smb2_test(suite, "stream1", test_raw_oplock_stream1);
|
||||
torture_suite_add_1smb2_test(suite, "doc", test_smb2_oplock_doc);
|
||||
torture_suite_add_2smb2_test(suite, "doc", test_smb2_oplock_doc);
|
||||
torture_suite_add_2smb2_test(suite, "brl1", test_smb2_oplock_brl1);
|
||||
torture_suite_add_1smb2_test(suite, "brl2", test_smb2_oplock_brl2);
|
||||
torture_suite_add_1smb2_test(suite, "brl3", test_smb2_oplock_brl3);
|
||||
|
Loading…
Reference in New Issue
Block a user