summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-08-30 17:22:33 +0000
committerJeremy Allison <jra@samba.org>2002-08-30 17:22:33 +0000
commitbf544f12f53ad19919d660bd15028a5ed1eda8a1 (patch)
treea84637d079e6d023efab82795c1eb9edf8b9f6da /source3
parent3cbe8922762817d38b6408154994714ca35f3734 (diff)
downloadsamba-bf544f12f53ad19919d660bd15028a5ed1eda8a1.tar.gz
samba-bf544f12f53ad19919d660bd15028a5ed1eda8a1.tar.bz2
samba-bf544f12f53ad19919d660bd15028a5ed1eda8a1.zip
Added attribute specific OPEN tests (for SYSTEM and HIDDEN).
Jeremy. (This used to be commit 4eeef6ef530acf1cc4e08e24af902c15af57ece7)
Diffstat (limited to 'source3')
-rw-r--r--source3/torture/torture.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index e7a8eb04b6..89d62b44a6 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -3417,6 +3417,50 @@ static BOOL run_opentest(int dummy)
cli_unlink(&cli1, fname);
+ /* Test 8 - attributes test test... */
+ fnum1 = cli_nt_create_full(&cli1, fname,FILE_WRITE_DATA, FILE_ATTRIBUTE_HIDDEN,
+ FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0);
+
+ if (fnum1 == -1) {
+ printf("test 8 open 1 of %s failed (%s)\n", fname, cli_errstr(&cli1));
+ return False;
+ }
+
+ if (!cli_close(&cli1, fnum1)) {
+ printf("test 8 close 1 of %s failed (%s)\n", fname, cli_errstr(&cli1));
+ return False;
+ }
+
+ /* FILE_SUPERSEDE && FILE_OVERWRITE_IF have the same effect here. */
+ fnum1 = cli_nt_create_full(&cli1, fname,FILE_READ_DATA, FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0);
+
+ if (fnum1 == -1) {
+ printf("test 8 open 2 of %s failed (%s)\n", fname, cli_errstr(&cli1));
+ return False;
+ }
+
+ if (!cli_close(&cli1, fnum1)) {
+ printf("test 8 close 2 of %s failed (%s)\n", fname, cli_errstr(&cli1));
+ return False;
+ }
+
+ /* This open should fail with ACCESS_DENIED for FILE_SUPERSEDE, FILE_OVERWRITE and FILE_OVERWRITE_IF. */
+ fnum1 = cli_nt_create_full(&cli1, fname,FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_NONE, FILE_OVERWRITE, 0);
+
+ if (fnum1 != -1) {
+ printf("test 8 open 3 of %s succeeded - should have failed with (NT_STATUS_ACCESS_DENIED)\n", fname);
+ correct = False;
+ cli_close(&cli1, fnum1);
+ } else {
+ printf("test 8 open 3 of %s gave %s (correct error should be %s)\n", fname, cli_errstr(&cli1), "ACCESS_DENIED");
+ }
+
+ printf("Attribute open test #8 passed.\n");
+
+ cli_unlink(&cli1, fname);
+
if (!torture_close_connection(&cli1)) {
correct = False;
}