From 2fb07df753803d1c96e7600805c0984971d6dd22 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 11 Mar 2002 01:37:08 +0000 Subject: added a LOCK6 test for weird lockingX lock type bits warning! this test reboots w2k or wxp (This used to be commit 568e1d7b4389e5a49aa1d52eb4c74bc53dbc125f) --- source3/torture/torture.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'source3') diff --git a/source3/torture/torture.c b/source3/torture/torture.c index a0446a653a..a79f22c1a0 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -1354,9 +1354,10 @@ static BOOL run_locktest4(int dummy) ((fnum1 = cli_open(&cli1, fname, O_RDWR, DENY_NONE)) != -1) && cli_lock(&cli1, fnum1, 7, 1, 0, WRITE_LOCK); cli_close(&cli1, f); + cli_close(&cli1, fnum1); EXPECTED(ret, True); printf("the server %s have the NT byte range lock bug\n", !ret?"does":"doesn't"); - + fail: cli_close(&cli1, fnum1); cli_close(&cli2, fnum2); @@ -1492,6 +1493,43 @@ static BOOL run_locktest5(int dummy) return correct; } +/* + tries the unusual lockingX locktype bits +*/ +static BOOL run_locktest6(int dummy) +{ + static struct cli_state cli; + char *fname = "\\lockt6.lck"; + int fnum; + NTSTATUS status; + + if (!torture_open_connection(&cli)) { + return False; + } + + cli_sockopt(&cli, sockops); + + printf("starting locktest6\n"); + + cli_unlink(&cli, fname); + + fnum = cli_open(&cli, fname, O_RDWR|O_CREAT|O_EXCL, DENY_NONE); + status = cli_locktype(&cli, fnum, 0, 8, 0, LOCKING_ANDX_CHANGE_LOCKTYPE); + cli_close(&cli, fnum); + printf("CHANGE_LOCKTYPE gave %s\n", get_nt_error_msg(status)); + + fnum = cli_open(&cli, fname, O_RDWR, DENY_NONE); + status = cli_locktype(&cli, fnum, 0, 8, 0, LOCKING_ANDX_CANCEL_LOCK); + cli_close(&cli, fnum); + printf("CANCEL_LOCK gave %s\n", get_nt_error_msg(status)); + + cli_unlink(&cli, fname); + torture_close_connection(&cli); + + printf("finished locktest6\n"); + return True; +} + /* test whether fnums and tids open on one VC are available on another (a major security hole) @@ -3285,6 +3323,7 @@ static struct { {"LOCK3", run_locktest3, 0}, {"LOCK4", run_locktest4, 0}, {"LOCK5", run_locktest5, 0}, + {"LOCK6", run_locktest6, 0}, {"UNLINK", run_unlinktest, 0}, {"BROWSE", run_browsetest, 0}, {"ATTR", run_attrtest, 0}, -- cgit