diff options
author | Volker Lendecke <vl@samba.org> | 2013-09-25 23:04:50 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2013-10-11 15:07:37 -0700 |
commit | 672c22831032b862a11259ddb1e0cc8ef9ba0d26 (patch) | |
tree | 2656f9cff69522b20835480a28e09c94c73d3538 /source4 | |
parent | 6fbbf94def82132b3c4fd9dcb24d8dae41fca950 (diff) | |
download | samba-672c22831032b862a11259ddb1e0cc8ef9ba0d26.tar.gz samba-672c22831032b862a11259ddb1e0cc8ef9ba0d26.tar.bz2 samba-672c22831032b862a11259ddb1e0cc8ef9ba0d26.zip |
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>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/torture/smb2/oplock.c | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/source4/torture/smb2/oplock.c b/source4/torture/smb2/oplock.c index 4cf7c7d72f..5070d009b3 100644 --- a/source4/torture/smb2/oplock.c +++ b/source4/torture/smb2/oplock.c @@ -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); |