[SCM] Samba Shared Repository - branch master updated

Michael Adam obnox at samba.org
Thu Aug 9 10:02:04 MDT 2012


The branch, master has been updated
       via  f64c970 s4:torture:basic: check the return status of the last open in deltest16
       via  2352227 s4:torture:basic: fix a message typo in the delete17 test
       via  6cc5a54 s4:torture:basic: fix abundance of spaces in deltest6
       via  fac4a0d s4:torture:basic:delete: fix 4 vs 8 spc tab formatting in check_delete_on_close()
       via  5236028 s3:torture:delete: add a 12th subtest to the delete-on-close tests
       via  db160bf s3:torture:delete: fix 11th test to work against windows
       via  2e53fb1 s3:torture:delete: simplify return code handling, fixing a couple of return codes in error cases
       via  49a2c68 s3:torture:delete: reduce indentation
       via  54e5810 s3:torture:delete: add a comment
       via  c228b7a s3:torture:delete: add a comment
       via  7a7b86d s3:torture:delete: add a comment
       via  5b1afa6 s3:torture:delete: move the success message for a subtest to the correct place
       via  2f7a371 s3:torture:delete: remove an else, reducing indentation
       via  3668a4c s3:torture:delete: remove an else, reducing indentation
       via  777c7a9 s3:torture:delete: remove an else, reducing indentation
       via  c36deaf s3:torture:delete: remove an else, reducing indentation
       via  e833141 s3:torture:delete: really fail the test in a failure case
       via  9058288 s3:torture:delete: fix a comment
       via  bf492d1 s3:torture:delete: fix a message
       via  ff5e6e3 s3:torture:delete: fix a message
       via  4aac6d0 s3:torture:delete: fix a message
       via  595845c s3:torture:delete: fix a message (counting the opens)
       via  2aded6a s3:torture:delete: untangle function call from result check
       via  ef36847 s3:torture:delete: untangle function call from result check
       via  4e75b0c s3:torture:delete: untangle function call from result check
       via  ccb2583 s3:torture:delete: untanlge function call from result check
       via  8a92ae2 s3:torture:delete: untangle function call from result check
       via  02b0925 s3:torture:delete: untangle function call from result check
       via  5138eb5 s3:torture:delete: untangle function call from result check
       via  5bc7c77 s3:torture:delete: untangle function call from result check
       via  b5e9378 s3:torture:delete: untangle function call from result check
       via  361429d s3:torture:delete: untangle function call from result check
       via  8684506 s3:torture:delete: untangle function call from result check
       via  1db70c0 s3:torture:delete: untangle function call from result check
       via  a70a4ad s3:torture:delete: untangle function call from result check
      from  11d60d1 s4-ldb_wrap: Do not vasprintf() the ldb debug messages that will not be shown

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit f64c970e3e70632e9721f8d4993c68b3841bbfa5
Author: Michael Adam <obnox at samba.org>
Date:   Thu Aug 9 11:12:55 2012 +0200

    s4:torture:basic: check the return status of the last open in deltest16
    
    Autobuild-User(master): Michael Adam <obnox at samba.org>
    Autobuild-Date(master): Thu Aug  9 18:01:50 CEST 2012 on sn-devel-104

commit 2352227b6609c6ba5111201db25711d9c7840dc1
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 23:36:52 2012 +0200

    s4:torture:basic: fix a message typo in the delete17 test

commit 6cc5a54bc05e3379eafd4eb1cc571017903d7fe5
Author: Michael Adam <obnox at samba.org>
Date:   Thu Aug 9 12:56:48 2012 +0200

    s4:torture:basic: fix abundance of spaces in deltest6

commit fac4a0d4a75f60f77ead9153f4b76cbf9636d1be
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 17:29:04 2012 +0200

    s4:torture:basic:delete: fix 4 vs 8 spc tab formatting in check_delete_on_close()

commit 523602863a7ad5bca4026cd72f146a3eace8f1fe
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:44:01 2012 +0200

    s3:torture:delete: add a 12th subtest to the delete-on-close tests
    
    test whether second open is possible with initial delete on close
    and how setting and unsetting delete on close on the handle affects
    the initial delete on close (it does not...)

commit db160bf5100b7c8bd7a1712c76354b30cd7c4925
Author: Michael Adam <obnox at samba.org>
Date:   Thu Aug 9 16:11:08 2012 +0200

    s3:torture:delete: fix 11th test to work against windows

commit 2e53fb109f36faa8781ce92b8171d8dd0f4f971f
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:25:09 2012 +0200

    s3:torture:delete: simplify return code handling, fixing a couple of return codes in error cases

commit 49a2c68011d9ce37a9d7cf8289a5e41771aaa646
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:20:24 2012 +0200

    s3:torture:delete: reduce indentation

commit 54e5810638c2d0e8764a333fb0f853a7ee942a55
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:19:52 2012 +0200

    s3:torture:delete: add a comment

commit c228b7abeed7de963f8bcc08014ac2a2ab656972
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:18:40 2012 +0200

    s3:torture:delete: add a comment

commit 7a7b86d3c7149d6b9ccd065d15d818e9d336b98c
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:17:53 2012 +0200

    s3:torture:delete: add a comment

commit 5b1afa63073155eab7035b7f7a5cf1fc1f62dc3d
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 11:32:55 2012 +0200

    s3:torture:delete: move the success message for a subtest to the correct place

commit 2f7a371b92b05b080bdd530ad9fca437d50d13a6
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:19:31 2012 +0200

    s3:torture:delete: remove an else, reducing indentation

commit 3668a4c94c59b3609790f18d0cb7d8a23ef9a6ab
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:17:29 2012 +0200

    s3:torture:delete: remove an else, reducing indentation

commit 777c7a965b5824b8d038a3babb3754a1dfcd8fc2
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 11:27:55 2012 +0200

    s3:torture:delete: remove an else, reducing indentation

commit c36deaf3af02531ff40d6960b8deaa0141bc2524
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:15:16 2012 +0200

    s3:torture:delete: remove an else, reducing indentation

commit e8331416229fc08e5c73cdd27e192b8b3f68bbfe
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:14:36 2012 +0200

    s3:torture:delete: really fail the test in a failure case

commit 9058288d6a9ddf7472711d4e3fe51c704c4f0144
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:06:13 2012 +0200

    s3:torture:delete: fix a comment

commit bf492d1ffb16d39ce9d41eec86f95bb27e9c8f4e
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:05:53 2012 +0200

    s3:torture:delete: fix a message

commit ff5e6e33fd03d1f496a5335e05de9ba5ed4d02dd
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:05:38 2012 +0200

    s3:torture:delete: fix a message

commit 4aac6d00a9a93211b2acc77e1898a95123a710c6
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 11:56:48 2012 +0200

    s3:torture:delete: fix a message

commit 595845ca301ec30fbdeea76b06d0545ba4788dbb
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 11:24:55 2012 +0200

    s3:torture:delete: fix a message (counting the opens)

commit 2aded6aebd4187cd192f9202b35dfef6d258f2da
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 20:07:38 2012 +0200

    s3:torture:delete: untangle function call from result check

commit ef3684739a5bf65f70d35f2fdbc83b93cefd1608
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:18:55 2012 +0200

    s3:torture:delete: untangle function call from result check

commit 4e75b0c717506b0cb392083f6ff07d581a9cf6eb
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:18:16 2012 +0200

    s3:torture:delete: untangle function call from result check

commit ccb25831e21fef606683abc5d62581272ac8ffa4
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 12:07:29 2012 +0200

    s3:torture:delete: untanlge function call from result check

commit 8a92ae23fe64639c7a19faaacf585f266622c863
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 11:58:24 2012 +0200

    s3:torture:delete: untangle function call from result check

commit 02b092533a3ccdeb43a9b5a6ff7731e2e70e209f
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 11:58:01 2012 +0200

    s3:torture:delete: untangle function call from result check

commit 5138eb50a3f9fb1b6dc3f49a80f86c92698c4293
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 11:57:33 2012 +0200

    s3:torture:delete: untangle function call from result check

commit 5bc7c77cd88b5fc96427584da020a3abe930f214
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 11:57:03 2012 +0200

    s3:torture:delete: untangle function call from result check

commit b5e9378e2881745a0145c74bfa5f2f17591ac99c
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 11:56:17 2012 +0200

    s3:torture:delete: untangle function call from result check

commit 361429d02ffc1ce90cf5b5e246d2fc0bb765520b
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 11:55:46 2012 +0200

    s3:torture:delete: untangle function call from result check

commit 86845064784bf6111049f8991b2385783645b9e4
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 11:32:37 2012 +0200

    s3:torture:delete: untangle function call from result check

commit 1db70c0b8b032bb3b5c544c6714a270e170aa201
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 11:27:19 2012 +0200

    s3:torture:delete: untangle function call from result check

commit a70a4ad73142600d8033e9d427b24c3452a56432
Author: Michael Adam <obnox at samba.org>
Date:   Wed Aug 8 11:24:29 2012 +0200

    s3:torture:delete: untangle function call from result check

-----------------------------------------------------------------------

Summary of changes:
 source3/torture/torture.c      |  263 ++++++++++++++++++++++++++--------------
 source4/torture/basic/delete.c |   19 ++--
 2 files changed, 181 insertions(+), 101 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 306bca1..69e583a 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -3853,7 +3853,7 @@ static bool run_deletetest(int dummy)
 	const char *fname = "\\delete.file";
 	uint16_t fnum1 = (uint16_t)-1;
 	uint16_t fnum2 = (uint16_t)-1;
-	bool correct = True;
+	bool correct = false;
 	NTSTATUS status;
 
 	printf("starting delete test\n");
@@ -3874,20 +3874,18 @@ static bool run_deletetest(int dummy)
 			      FILE_DELETE_ON_CLOSE, 0, &fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[1] open of %s failed (%s)\n", fname, nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	status = cli_close(cli1, fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[1] close failed (%s)\n", nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
-	if (NT_STATUS_IS_OK(cli_openx(cli1, fname, O_RDWR, DENY_NONE, &fnum1))) {
+	status = cli_openx(cli1, fname, O_RDWR, DENY_NONE, &fnum1);
+	if (NT_STATUS_IS_OK(status)) {
 		printf("[1] open of %s succeeded (should fail)\n", fname);
-		correct = False;
 		goto fail;
 	}
 
@@ -3903,35 +3901,33 @@ static bool run_deletetest(int dummy)
 			      FILE_OVERWRITE_IF, 0, 0, &fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[2] open of %s failed (%s)\n", fname, nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	status = cli_nt_delete_on_close(cli1, fnum1, true);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[2] setting delete_on_close failed (%s)\n", nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	status = cli_close(cli1, fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[2] close failed (%s)\n", nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
-	if (NT_STATUS_IS_OK(cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
+	status = cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1);
+	if (NT_STATUS_IS_OK(status)) {
 		printf("[2] open of %s succeeded should have been deleted on close !\n", fname);
 		status = cli_close(cli1, fnum1);
 		if (!NT_STATUS_IS_OK(status)) {
 			printf("[2] close failed (%s)\n", nt_errstr(status));
-			correct = False;
-			goto fail;
 		}
 		cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
-	} else
-		printf("second delete on close test succeeded.\n");
+		goto fail;
+	}
+
+	printf("second delete on close test succeeded.\n");
 
 	/* Test 3 - ... */
 	cli_setatr(cli1, fname, 0, 0);
@@ -3943,17 +3939,18 @@ static bool run_deletetest(int dummy)
 			      FILE_OVERWRITE_IF, 0, 0, &fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[3] open - 1 of %s failed (%s)\n", fname, nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	/* This should fail with a sharing violation - open for delete is only compatible
 	   with SHARE_DELETE. */
 
-	if (NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL,
-			FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0, 0, &fnum2))) {
+	status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
+			      FILE_ATTRIBUTE_NORMAL,
+			      FILE_SHARE_READ|FILE_SHARE_WRITE,
+			      FILE_OPEN, 0, 0, &fnum2);
+	if (NT_STATUS_IS_OK(status)) {
 		printf("[3] open  - 2 of %s succeeded - should have failed.\n", fname);
-		correct = False;
 		goto fail;
 	}
 
@@ -3963,45 +3960,42 @@ static bool run_deletetest(int dummy)
 			     FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
 			     FILE_OPEN, 0, 0, &fnum2);
 	if (!NT_STATUS_IS_OK(status)) {
-		printf("[3] open  - 2 of %s failed (%s)\n", fname, nt_errstr(status));
-		correct = False;
+		printf("[3] open  - 3 of %s failed (%s)\n", fname, nt_errstr(status));
 		goto fail;
 	}
 
 	status = cli_nt_delete_on_close(cli1, fnum1, true);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[3] setting delete_on_close failed (%s)\n", nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	status = cli_close(cli1, fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[3] close 1 failed (%s)\n", nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	status = cli_close(cli1, fnum2);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[3] close 2 failed (%s)\n", nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	/* This should fail - file should no longer be there. */
 
-	if (NT_STATUS_IS_OK(cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
+	status = cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1);
+	if (NT_STATUS_IS_OK(status)) {
 		printf("[3] open of %s succeeded should have been deleted on close !\n", fname);
 		status = cli_close(cli1, fnum1);
 		if (!NT_STATUS_IS_OK(status)) {
 			printf("[3] close failed (%s)\n", nt_errstr(status));
 		}
 		cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
-		correct = False;
 		goto fail;
-	} else
-		printf("third delete on close test succeeded.\n");
+	}
+
+	printf("third delete on close test succeeded.\n");
 
 	/* Test 4 ... */
 	cli_setatr(cli1, fname, 0, 0);
@@ -4014,7 +4008,6 @@ static bool run_deletetest(int dummy)
 			      FILE_OVERWRITE_IF, 0, 0, &fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[4] open of %s failed (%s)\n", fname, nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
@@ -4025,41 +4018,39 @@ static bool run_deletetest(int dummy)
 			     FILE_OPEN, 0, 0, &fnum2);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[4] open  - 2 of %s failed (%s)\n", fname, nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	status = cli_close(cli1, fnum2);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[4] close - 1 failed (%s)\n", nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	status = cli_nt_delete_on_close(cli1, fnum1, true);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[4] setting delete_on_close failed (%s)\n", nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	/* This should fail - no more opens once delete on close set. */
-	if (NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
-				   FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-				   FILE_OPEN, 0, 0, &fnum2))) {
+	status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
+			      FILE_ATTRIBUTE_NORMAL,
+			      FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+			      FILE_OPEN, 0, 0, &fnum2);
+	if (NT_STATUS_IS_OK(status)) {
 		printf("[4] open  - 3 of %s succeeded ! Should have failed.\n", fname );
-		correct = False;
 		goto fail;
-	} else
-		printf("fourth delete on close test succeeded.\n");
+	}
 
 	status = cli_close(cli1, fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[4] close - 2 failed (%s)\n", nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
+	printf("fourth delete on close test succeeded.\n");
+
 	/* Test 5 ... */
 	cli_setatr(cli1, fname, 0, 0);
 	cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
@@ -4067,22 +4058,20 @@ static bool run_deletetest(int dummy)
 	status = cli_openx(cli1, fname, O_RDWR|O_CREAT, DENY_NONE, &fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[5] open of %s failed (%s)\n", fname, nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	/* This should fail - only allowed on NT opens with DELETE access. */
 
-	if (NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1, fnum1, true))) {
+	status = cli_nt_delete_on_close(cli1, fnum1, true);
+	if (NT_STATUS_IS_OK(status)) {
 		printf("[5] setting delete_on_close on OpenX file succeeded - should fail !\n");
-		correct = False;
 		goto fail;
 	}
 
 	status = cli_close(cli1, fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
-		printf("[5] close - 2 failed (%s)\n", nt_errstr(status));
-		correct = False;
+		printf("[5] close failed (%s)\n", nt_errstr(status));
 		goto fail;
 	}
 
@@ -4099,22 +4088,20 @@ static bool run_deletetest(int dummy)
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[6] open of %s failed (%s)\n", fname,
 		       nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	/* This should fail - only allowed on NT opens with DELETE access. */
 
-	if (NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1, fnum1, true))) {
+	status = cli_nt_delete_on_close(cli1, fnum1, true);
+	if (NT_STATUS_IS_OK(status)) {
 		printf("[6] setting delete_on_close on file with no delete access succeeded - should fail !\n");
-		correct = False;
 		goto fail;
 	}
 
 	status = cli_close(cli1, fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
-		printf("[6] close - 2 failed (%s)\n", nt_errstr(status));
-		correct = False;
+		printf("[6] close failed (%s)\n", nt_errstr(status));
 		goto fail;
 	}
 
@@ -4130,53 +4117,48 @@ static bool run_deletetest(int dummy)
 			      0, 0, &fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[7] open of %s failed (%s)\n", fname, nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
-	if (!NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1, fnum1, true))) {
+	status = cli_nt_delete_on_close(cli1, fnum1, true);
+	if (!NT_STATUS_IS_OK(status)) {
 		printf("[7] setting delete_on_close on file failed !\n");
-		correct = False;
 		goto fail;
 	}
 
-	if (!NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1, fnum1, false))) {
+	status = cli_nt_delete_on_close(cli1, fnum1, false);
+	if (!NT_STATUS_IS_OK(status)) {
 		printf("[7] unsetting delete_on_close on file failed !\n");
-		correct = False;
 		goto fail;
 	}
 
 	status = cli_close(cli1, fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
-		printf("[7] close - 2 failed (%s)\n", nt_errstr(status));
-		correct = False;
+		printf("[7] close - 1 failed (%s)\n", nt_errstr(status));
 		goto fail;
 	}
 
 	/* This next open should succeed - we reset the flag. */
 	status = cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
-		printf("[5] open of %s failed (%s)\n", fname, nt_errstr(status));
-		correct = False;
+		printf("[7] open of %s failed (%s)\n", fname, nt_errstr(status));
 		goto fail;
 	}
 
 	status = cli_close(cli1, fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[7] close - 2 failed (%s)\n", nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	printf("seventh delete on close test succeeded.\n");
 
-	/* Test 7 ... */
+	/* Test 8 ... */
 	cli_setatr(cli1, fname, 0, 0);
 	cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
 
 	if (!torture_open_connection(&cli2, 1)) {
 		printf("[8] failed to open second connection.\n");
-		correct = False;
 		goto fail;
 	}
 
@@ -4189,7 +4171,6 @@ static bool run_deletetest(int dummy)
 			     FILE_OVERWRITE_IF, 0, 0, &fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[8] open 1 of %s failed (%s)\n", fname, nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
@@ -4200,27 +4181,24 @@ static bool run_deletetest(int dummy)
 			     FILE_OPEN, 0, 0, &fnum2);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[8] open 2 of %s failed (%s)\n", fname, nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
-	if (!NT_STATUS_IS_OK(cli_nt_delete_on_close(cli1, fnum1, true))) {
+	status = cli_nt_delete_on_close(cli1, fnum1, true);
+	if (!NT_STATUS_IS_OK(status)) {
 		printf("[8] setting delete_on_close on file failed !\n");
-		correct = False;
 		goto fail;
 	}
 
 	status = cli_close(cli1, fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[8] close - 1 failed (%s)\n", nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	status = cli_close(cli2, fnum2);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[8] close - 2 failed (%s)\n", nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
@@ -4229,20 +4207,27 @@ static bool run_deletetest(int dummy)
 	if (NT_STATUS_IS_OK(status)) {
 		printf("[8] open of %s succeeded should have been deleted on close !\n", fname);
 		goto fail;
-		correct = False;
-	} else
-		printf("eighth delete on close test succeeded.\n");
+	}
+
+	printf("eighth delete on close test succeeded.\n");
+
+	/* Test 9 ... */
 
 	/* This should fail - we need to set DELETE_ACCESS. */
-	if (NT_STATUS_IS_OK(cli_ntcreate(cli1, fname, 0,FILE_READ_DATA|FILE_WRITE_DATA,
-				   FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE, FILE_OVERWRITE_IF, FILE_DELETE_ON_CLOSE, 0, &fnum1))) {
+	status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA,
+			      FILE_ATTRIBUTE_NORMAL,
+			      FILE_SHARE_NONE,
+			      FILE_OVERWRITE_IF,
+			      FILE_DELETE_ON_CLOSE, 0, &fnum1);
+	if (NT_STATUS_IS_OK(status)) {
 		printf("[9] open of %s succeeded should have failed!\n", fname);
-		correct = False;
 		goto fail;
 	}
 
 	printf("ninth delete on close test succeeded.\n");
 
+	/* Test 10 ... */
+
 	status = cli_ntcreate(cli1, fname, 0,
 			     FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
 			     FILE_ATTRIBUTE_NORMAL, FILE_SHARE_NONE,
@@ -4250,7 +4235,6 @@ static bool run_deletetest(int dummy)
 			     0, &fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[10] open of %s failed (%s)\n", fname, nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
@@ -4258,23 +4242,24 @@ static bool run_deletetest(int dummy)
 	status = cli_close(cli1, fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[10] close failed (%s)\n", nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	/* This should fail.. */
-	if (NT_STATUS_IS_OK(cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1))) {
+	status = cli_openx(cli1, fname, O_RDONLY, DENY_NONE, &fnum1);
+	if (NT_STATUS_IS_OK(status)) {
 		printf("[10] open of %s succeeded should have been deleted on close !\n", fname);
 		goto fail;
-		correct = False;
-	} else
-		printf("tenth delete on close test succeeded.\n");
+	}
+
+	printf("tenth delete on close test succeeded.\n");
+
+	/* Test 11 ... */
 
 	cli_setatr(cli1, fname, 0, 0);
 	cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
 
-	/* What error do we get when attempting to open a read-only file with
-	   delete access ? */
+	/* Can we open a read-only file with delete access? */
 
 	/* Create a readonly file. */
 	status = cli_ntcreate(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA,
@@ -4282,14 +4267,12 @@ static bool run_deletetest(int dummy)
 			      FILE_OVERWRITE_IF, 0, 0, &fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[11] open of %s failed (%s)\n", fname, nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
 	status = cli_close(cli1, fnum1);
 	if (!NT_STATUS_IS_OK(status)) {
 		printf("[11] close failed (%s)\n", nt_errstr(status));
-		correct = False;
 		goto fail;
 	}
 
@@ -4298,24 +4281,118 @@ static bool run_deletetest(int dummy)
 			     FILE_READ_ATTRIBUTES|DELETE_ACCESS,
 			     0,
 			     FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
-			     FILE_OVERWRITE_IF, 0, 0, &fnum1);
+			     FILE_OPEN, 0, 0, &fnum1);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("[11] open of %s failed: %s\n", fname, nt_errstr(status));
+		goto fail;
+	}
+
+	cli_close(cli1, fnum1);
+
+	printf("eleventh delete on close test succeeded.\n");
+
+	/*
+	 * Test 12
+	 * like test 4 but with initial delete on close
+	 */
+
+	cli_setatr(cli1, fname, 0, 0);
+	cli_unlink(cli1, fname, FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN);
+
+	status = cli_ntcreate(cli1, fname, 0,
+	                      FILE_READ_DATA|FILE_WRITE_DATA|DELETE_ACCESS,
+			      FILE_ATTRIBUTE_NORMAL,
+			      FILE_SHARE_READ|FILE_SHARE_WRITE,
+			      FILE_OVERWRITE_IF,
+			      FILE_DELETE_ON_CLOSE, 0, &fnum1);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("[12] open 1 of %s failed (%s)\n", fname, nt_errstr(status));
+		goto fail;
+	}
+
+	status = cli_ntcreate(cli1, fname, 0, GENERIC_READ_ACCESS,
+			      FILE_ATTRIBUTE_NORMAL,
+			      FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+			      FILE_OPEN, 0, 0, &fnum2);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("[12] open 2 of %s failed(%s).\n", fname, nt_errstr(status));
+		goto fail;
+	}
+
+	status = cli_close(cli1, fnum2);
+	if (!NT_STATUS_IS_OK(status)) {
+		printf("[12] close 1 failed (%s)\n", nt_errstr(status));
+		goto fail;
+	}
+


-- 
Samba Shared Repository


More information about the samba-cvs mailing list