mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
smbtorture: Test that delete requests are not special
Signed-off-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
ab709544f4
commit
814dc3c62b
@ -867,6 +867,82 @@ done:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool test_raw_oplock_exclusive8(struct torture_context *tctx,
|
||||
struct smbcli_state *cli1,
|
||||
struct smbcli_state *cli2)
|
||||
{
|
||||
const char *fname = BASEDIR "\\test_exclusive8.dat";
|
||||
NTSTATUS status;
|
||||
bool ret = true;
|
||||
union smb_open io;
|
||||
uint16_t fnum1 = 0;
|
||||
uint16_t fnum2 = 0;
|
||||
uint16_t fnum3 = 0;
|
||||
|
||||
if (!torture_setup_dir(cli1, BASEDIR)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* cleanup */
|
||||
smbcli_unlink(cli1->tree, fname);
|
||||
|
||||
smbcli_oplock_handler(cli1->transport, oplock_handler_ack_to_given,
|
||||
cli1->tree);
|
||||
|
||||
/*
|
||||
base ntcreatex parms
|
||||
*/
|
||||
io.generic.level = RAW_OPEN_NTCREATEX;
|
||||
io.ntcreatex.in.root_fid.fnum = 0;
|
||||
io.ntcreatex.in.access_mask = SEC_RIGHTS_FILE_ALL;
|
||||
io.ntcreatex.in.alloc_size = 0;
|
||||
io.ntcreatex.in.file_attr = FILE_ATTRIBUTE_NORMAL;
|
||||
io.ntcreatex.in.share_access = NTCREATEX_SHARE_ACCESS_READ |
|
||||
NTCREATEX_SHARE_ACCESS_WRITE | NTCREATEX_SHARE_ACCESS_DELETE;
|
||||
io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
|
||||
io.ntcreatex.in.create_options = 0;
|
||||
io.ntcreatex.in.impersonation = NTCREATEX_IMPERSONATION_ANONYMOUS;
|
||||
io.ntcreatex.in.security_flags = 0;
|
||||
io.ntcreatex.in.fname = fname;
|
||||
|
||||
torture_comment(tctx, "open a file with an exclusive oplock (share "
|
||||
"mode: all)\n");
|
||||
ZERO_STRUCT(break_info);
|
||||
io.ntcreatex.in.flags = NTCREATEX_FLAGS_EXTENDED |
|
||||
NTCREATEX_FLAGS_REQUEST_OPLOCK;
|
||||
status = smb_raw_open(cli1->tree, tctx, &io);
|
||||
CHECK_STATUS(tctx, status, NT_STATUS_OK);
|
||||
fnum1 = io.ntcreatex.out.file.fnum;
|
||||
CHECK_VAL(io.ntcreatex.out.oplock_level, EXCLUSIVE_OPLOCK_RETURN);
|
||||
|
||||
torture_comment(tctx, "second open with delete should trigger a "
|
||||
"break\n");
|
||||
|
||||
io.ntcreatex.in.access_mask = SEC_STD_DELETE;
|
||||
io.ntcreatex.in.flags = 0;
|
||||
status = smb_raw_open(cli2->tree, tctx, &io);
|
||||
CHECK_STATUS(tctx, status, NT_STATUS_OK);
|
||||
fnum2 = io.ntcreatex.out.file.fnum;
|
||||
CHECK_VAL(break_info.count, get_break_level1_to_none_count(tctx));
|
||||
CHECK_VAL(break_info.failures, 0);
|
||||
CHECK_VAL(break_info.level, OPLOCK_BREAK_TO_LEVEL_II);
|
||||
|
||||
/* Trigger a little panic in "old" samba code.. */
|
||||
status = smb_raw_open(cli2->tree, tctx, &io);
|
||||
CHECK_STATUS(tctx, status, NT_STATUS_OK);
|
||||
fnum3 = io.ntcreatex.out.file.fnum;
|
||||
|
||||
smbcli_close(cli2->tree, fnum3);
|
||||
smbcli_close(cli2->tree, fnum2);
|
||||
smbcli_close(cli1->tree, fnum1);
|
||||
|
||||
done:
|
||||
smbcli_deltree(cli1->tree, BASEDIR);
|
||||
smb_raw_exit(cli1->session);
|
||||
smb_raw_exit(cli2->session);
|
||||
return ret;
|
||||
}
|
||||
|
||||
static bool test_raw_oplock_batch1(struct torture_context *tctx, struct smbcli_state *cli1, struct smbcli_state *cli2)
|
||||
{
|
||||
const char *fname = BASEDIR "\\test_batch1.dat";
|
||||
@ -3956,6 +4032,8 @@ struct torture_suite *torture_raw_oplock(TALLOC_CTX *mem_ctx)
|
||||
torture_suite_add_2smb_test(suite, "exclusive5", test_raw_oplock_exclusive5);
|
||||
torture_suite_add_2smb_test(suite, "exclusive6", test_raw_oplock_exclusive6);
|
||||
torture_suite_add_2smb_test(suite, "exclusive7", test_raw_oplock_exclusive7);
|
||||
torture_suite_add_2smb_test(suite, "exclusive8",
|
||||
test_raw_oplock_exclusive8);
|
||||
torture_suite_add_2smb_test(suite, "batch1", test_raw_oplock_batch1);
|
||||
torture_suite_add_2smb_test(suite, "batch2", test_raw_oplock_batch2);
|
||||
torture_suite_add_2smb_test(suite, "batch3", test_raw_oplock_batch3);
|
||||
|
Loading…
Reference in New Issue
Block a user