summaryrefslogtreecommitdiffstats
path: root/source/torture
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
commit4eeef6ef530acf1cc4e08e24af902c15af57ece7 (patch)
tree9b2a6843f17c6556ce797176200b78c317e5faed /source/torture
parentec37633548ed329c05b93499f75883d987b78f1e (diff)
downloadsamba-4eeef6ef530acf1cc4e08e24af902c15af57ece7.tar.gz
samba-4eeef6ef530acf1cc4e08e24af902c15af57ece7.tar.xz
samba-4eeef6ef530acf1cc4e08e24af902c15af57ece7.zip
Added attribute specific OPEN tests (for SYSTEM and HIDDEN).
Jeremy.
Diffstat (limited to 'source/torture')
-rw-r--r--source/torture/torture.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/source/torture/torture.c b/source/torture/torture.c
index e7a8eb04b60..89d62b44a60 100644
--- a/source/torture/torture.c
+++ b/source/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;
}