summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2002-11-18 23:13:25 +0000
committerJeremy Allison <jra@samba.org>2002-11-18 23:13:25 +0000
commit6aa11bf089a9db822de6fb09c0eae801b61cdd67 (patch)
tree7e11e7d5e7ca7399af8099ffefb78db668dc9acc
parente20b99f22615939aedfac2d3e7090dcd0a7edcdd (diff)
downloadsamba-6aa11bf089a9db822de6fb09c0eae801b61cdd67.tar.gz
samba-6aa11bf089a9db822de6fb09c0eae801b61cdd67.tar.bz2
samba-6aa11bf089a9db822de6fb09c0eae801b61cdd67.zip
Added OPEN test with HIDDEN/NORMAL attributes.
Jeremy. (This used to be commit fc5774b075f435dfbf3253e5e6af8afc9ee4ca22)
-rw-r--r--source3/torture/torture.c50
1 files changed, 49 insertions, 1 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index fb62b13657..49ddba52e1 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -3043,6 +3043,7 @@ static BOOL run_opentest(int dummy)
size_t fsize;
BOOL correct = True;
char *tmp_path;
+ uint16 attr;
printf("starting open test\n");
@@ -3417,7 +3418,7 @@ static BOOL run_opentest(int dummy)
cli_unlink(&cli1, fname);
- /* Test 8 - attributes test test... */
+ /* Test 8 - attributes test #1... */
fnum1 = cli_nt_create_full(&cli1, fname,FILE_WRITE_DATA, FILE_ATTRIBUTE_HIDDEN,
FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0);
@@ -3463,6 +3464,53 @@ static BOOL run_opentest(int dummy)
cli_unlink(&cli1, fname);
+ /*
+ * Test #9. Open with NORMAL, close, then re-open with attribute
+ * HIDDEN and request to truncate.
+ */
+
+ fnum1 = cli_nt_create_full(&cli1, fname,FILE_WRITE_DATA, FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0);
+
+ if (fnum1 == -1) {
+ printf("test 9 open 1 of %s failed (%s)\n", fname, cli_errstr(&cli1));
+ return False;
+ }
+
+ if (!cli_close(&cli1, fnum1)) {
+ printf("test 9 close 1 of %s failed (%s)\n", fname, cli_errstr(&cli1));
+ return False;
+ }
+
+ fnum1 = cli_nt_create_full(&cli1, fname,FILE_READ_DATA|FILE_WRITE_DATA, FILE_ATTRIBUTE_HIDDEN,
+ FILE_SHARE_NONE, FILE_OVERWRITE, 0);
+
+ if (fnum1 == -1) {
+ printf("test 9 open 2 of %s failed (%s)\n", fname, cli_errstr(&cli1));
+ return False;
+ }
+
+ if (!cli_close(&cli1, fnum1)) {
+ printf("test 9 close 2 of %s failed (%s)\n", fname, cli_errstr(&cli1));
+ return False;
+ }
+
+ /* Ensure we have attr hidden. */
+ if (!cli_getatr(&cli1, fname, &attr, NULL, NULL)) {
+ printf("test 9 getatr(2) failed (%s)\n", cli_errstr(&cli1));
+ return False;
+ }
+
+ if (!(attr & FILE_ATTRIBUTE_HIDDEN)) {
+ printf("test 9 getatr didn't have HIDDEN attribute\n");
+ cli_unlink(&cli1, fname);
+ return False;
+ }
+
+ printf("Attribute open test #9 %s.\n", correct ? "passed" : "failed");
+
+ cli_unlink(&cli1, fname);
+
if (!torture_close_connection(&cli1)) {
correct = False;
}