summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-03-11 01:37:08 +0000
committerAndrew Tridgell <tridge@samba.org>2002-03-11 01:37:08 +0000
commit2fb07df753803d1c96e7600805c0984971d6dd22 (patch)
tree770007a581ee4e7cfc6e1d8e1ac6c1744e2f5791
parent57970fd4e29ec6d90540049147e763bd69ee9e04 (diff)
downloadsamba-2fb07df753803d1c96e7600805c0984971d6dd22.tar.gz
samba-2fb07df753803d1c96e7600805c0984971d6dd22.tar.bz2
samba-2fb07df753803d1c96e7600805c0984971d6dd22.zip
added a LOCK6 test for weird lockingX lock type bits
warning! this test reboots w2k or wxp (This used to be commit 568e1d7b4389e5a49aa1d52eb4c74bc53dbc125f)
-rw-r--r--source3/torture/torture.c41
1 files changed, 40 insertions, 1 deletions
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);
@@ -1493,6 +1494,43 @@ static BOOL run_locktest5(int dummy)
}
/*
+ 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},