torture3: Add some brlock entries in cleanup2
authorVolker Lendecke <vl@samba.org>
Sun, 29 Jun 2014 09:07:08 +0000 (11:07 +0200)
committerJeremy Allison <jra@samba.org>
Mon, 30 Jun 2014 20:28:15 +0000 (22:28 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/torture/test_cleanup.c

index a831ed74a7f44c12332274657711bfaa2321a2be..e96a5de9d4f9553a54350f293891c8e3e6c3a7f7 100644 (file)
@@ -74,9 +74,9 @@ bool run_cleanup1(int dummy)
 
 bool run_cleanup2(int dummy)
 {
-       struct cli_state *cli1, *cli2;
+       struct cli_state *cli1, *cli2, *cli3;
        const char *fname = "\\cleanup2";
-       uint16_t fnum1, fnum2;
+       uint16_t fnum1, fnum2, fnum3;
        NTSTATUS status;
        char buf;
 
@@ -100,6 +100,30 @@ bool run_cleanup2(int dummy)
                return false;
        }
 
+       if (!torture_open_connection(&cli3, 1)) {
+               return false;
+       }
+       status = cli_ntcreate(
+               cli3, fname, 0, FILE_GENERIC_READ|FILE_GENERIC_WRITE,
+               FILE_ATTRIBUTE_NORMAL,
+               FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+               FILE_OVERWRITE_IF, 0, 0, &fnum3, NULL);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("open of %s failed (%s)\n", fname, nt_errstr(status));
+               return false;
+       }
+       status = cli_lock32(cli3, fnum3, 1, 1, 0, WRITE_LOCK);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("lock failed (%s)\n", nt_errstr(status));
+               return false;
+       }
+
+       status = cli_lock32(cli1, fnum1, 2, 1, 0, WRITE_LOCK);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("lock failed (%s)\n", nt_errstr(status));
+               return false;
+       }
+
        /*
         * Check the file is indeed locked
         */