summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-02-23 23:41:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:55:45 -0500
commit9150205f985265216929006bab1976bd6d2bfc24 (patch)
tree03a68ae1a318024c4e0d653a8d19df5a2e243687
parente2cc3f48162d7dec35fb3f256c031979cfa531f8 (diff)
downloadsamba-9150205f985265216929006bab1976bd6d2bfc24.tar.gz
samba-9150205f985265216929006bab1976bd6d2bfc24.tar.bz2
samba-9150205f985265216929006bab1976bd6d2bfc24.zip
r5525: Add extra case to torture to test this (we currently fail with the wrong
error message but we correctly deny the open). Jeremy. (This used to be commit 99b89867c33a2209c42b6610d62ead0cf2af05af)
-rw-r--r--source3/torture/torture.c47
1 files changed, 45 insertions, 2 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 72a391dbdb..ec13abc1c1 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -3128,7 +3128,7 @@ static BOOL run_deletetest(int dummy)
FILE_OVERWRITE_IF, 0, 0);
if (fnum1 == -1) {
- printf("[8] open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ printf("[8] open 1 of %s failed (%s)\n", fname, cli_errstr(cli1));
correct = False;
goto fail;
}
@@ -3138,7 +3138,7 @@ static BOOL run_deletetest(int dummy)
FILE_OPEN, 0, 0);
if (fnum2 == -1) {
- printf("[8] open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ printf("[8] open 2 of %s failed (%s)\n", fname, cli_errstr(cli2));
correct = False;
goto fail;
}
@@ -3205,6 +3205,49 @@ static BOOL run_deletetest(int dummy)
correct = False;
} else
printf("tenth delete on close test succeeded.\n");
+
+ cli_setatr(cli1, fname, 0, 0);
+ cli_unlink(cli1, fname);
+
+ /* What error do we get when attempting to open a read-only file with
+ delete access ? */
+
+ /* Create a readonly file. */
+ fnum1 = cli_nt_create_full(cli1, fname, 0, FILE_READ_DATA|FILE_WRITE_DATA,
+ FILE_ATTRIBUTE_READONLY, FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0, 0);
+ if (fnum1 == -1) {
+ printf("[11] open of %s failed (%s)\n", fname, cli_errstr(cli1));
+ correct = False;
+ goto fail;
+ }
+
+ if (!cli_close(cli1, fnum1)) {
+ printf("[11] close failed (%s)\n", cli_errstr(cli1));
+ correct = False;
+ goto fail;
+ }
+
+ /* Now try open for delete access. */
+ fnum1 = cli_nt_create_full(cli1, fname, 0, FILE_READ_ATTRIBUTES|DELETE_ACCESS,
+ 0, FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE,
+ FILE_OVERWRITE_IF, 0, 0);
+
+ if (fnum1 != -1) {
+ printf("[11] open of %s succeeded should have been denied with ACCESS_DENIED!\n", fname);
+ cli_close(cli1, fnum1);
+ goto fail;
+ correct = False;
+ } else {
+ NTSTATUS nterr = cli_nt_error(cli1);
+ if (!NT_STATUS_EQUAL(nterr,NT_STATUS_ACCESS_DENIED)) {
+ printf("[11] open of %s should have been denied with ACCESS_DENIED! Got error %s\n", fname, nt_errstr(nterr));
+ goto fail;
+ correct = False;
+ } else {
+ printf("eleventh delete on close test succeeded.\n");
+ }
+ }
+
printf("finished delete test\n");
fail: