added a test for the NT byte range lock into smbtorture
authorAndrew Tridgell <tridge@samba.org>
Thu, 4 May 2000 09:31:57 +0000 (09:31 +0000)
committerAndrew Tridgell <tridge@samba.org>
Thu, 4 May 2000 09:31:57 +0000 (09:31 +0000)
source/utils/torture.c

index 1e0ed29a285b99dbd2aa15858874177ba1a6334a..40920f79c305b80ac163d52201647f8ff85337a9 100644 (file)
@@ -803,7 +803,7 @@ static void run_locktest4(int dummy)
 {
        static struct cli_state cli1, cli2;
        char *fname = "\\lockt4.lck";
-       int fnum1, fnum2;
+       int fnum1, fnum2, f;
        BOOL ret;
        char buf[1000];
 
@@ -940,6 +940,21 @@ static void run_locktest4(int dummy)
        EXPECTED(ret, True);
        printf("the same process %s remove the first lock first\n", ret?"does":"doesn't");
 
+       cli_close(&cli1, fnum1);
+       cli_close(&cli2, fnum2);
+       fnum1 = cli_open(&cli1, fname, O_RDWR, DENY_NONE);
+       f = cli_open(&cli1, fname, O_RDWR, DENY_NONE);
+       ret = cli_lock(&cli1, fnum1, 0, 8, 0, READ_LOCK) &&
+             cli_lock(&cli1, f, 0, 1, 0, READ_LOCK) &&
+             cli_close(&cli1, fnum1) &&
+             ((fnum1 = cli_open(&cli1, fname, O_RDWR, DENY_NONE)) != -1) &&
+             cli_lock(&cli1, fnum1, 7, 1, 0, WRITE_LOCK);
+        cli_close(&cli1, f);
+       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);