summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2004-02-26 01:33:35 +0000
committerJeremy Allison <jra@samba.org>2004-02-26 01:33:35 +0000
commit863c784ef477cbdad3dfb5480b41be4b2360b758 (patch)
treea95afad122facfa0b6eba11d21233d121ea9f307
parentfa81d1d7e7a86d13d10550aa20b07c7300d7b324 (diff)
downloadsamba-863c784ef477cbdad3dfb5480b41be4b2360b758.tar.gz
samba-863c784ef477cbdad3dfb5480b41be4b2360b758.tar.bz2
samba-863c784ef477cbdad3dfb5480b41be4b2360b758.zip
Merging Richard's rename test.
Jeremy. (This used to be commit 5646b6c989c6f13fe1149cf24bf8af87fa95b759)
-rw-r--r--source3/torture/torture.c81
1 files changed, 75 insertions, 6 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c
index 57ba24e63e..07d568e879 100644
--- a/source3/torture/torture.c
+++ b/source3/torture/torture.c
@@ -3345,9 +3345,9 @@ static BOOL run_rename(int dummy)
}
if (!cli_rename(cli1, fname, fname1)) {
- printf("First rename failed (this is correct) - %s\n", cli_errstr(cli1));
+ printf("First rename failed (SHARE_READ) (this is correct) - %s\n", cli_errstr(cli1));
} else {
- printf("First rename succeeded - this should have failed !\n");
+ printf("First rename succeeded (SHARE_READ) - this should have failed !\n");
correct = False;
}
@@ -3371,10 +3371,10 @@ static BOOL run_rename(int dummy)
}
if (!cli_rename(cli1, fname, fname1)) {
- printf("Second rename failed - this should have succeeded - %s\n", cli_errstr(cli1));
+ printf("Second rename failed (SHARE_DELETE | SHARE_READ) - this should have succeeded - %s\n", cli_errstr(cli1));
correct = False;
} else {
- printf("Second rename succeeded\n");
+ printf("Second rename succeeded (SHARE_DELETE | SHARE_READ)\n");
}
if (!cli_close(cli1, fnum1)) {
@@ -3418,10 +3418,10 @@ static BOOL run_rename(int dummy)
#endif
if (!cli_rename(cli1, fname, fname1)) {
- printf("Third rename failed - this should have succeeded - %s\n", cli_errstr(cli1));
+ printf("Third rename failed (SHARE_NONE) - this should have succeeded - %s\n", cli_errstr(cli1));
correct = False;
} else {
- printf("Third rename succeeded\n");
+ printf("Third rename succeeded (SHARE_NONE)\n");
}
if (!cli_close(cli1, fnum1)) {
@@ -3432,6 +3432,75 @@ static BOOL run_rename(int dummy)
cli_unlink(cli1, fname);
cli_unlink(cli1, fname1);
+ /*----*/
+
+ fnum1 = cli_nt_create_full(cli1, fname, 0, GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_OVERWRITE_IF, 0, 0);
+
+ if (fnum1 == -1) {
+ printf("Fourth open failed - %s\n", cli_errstr(cli1));
+ return False;
+ }
+
+ if (!cli_rename(cli1, fname, fname1)) {
+ printf("Fourth rename failed (SHARE_READ | SHARE_WRITE) (this is correct) - %s\n", cli_errstr(cli1));
+ } else {
+ printf("Fourth rename succeeded (SHARE_READ | SHARE_WRITE) - this should have failed !\n");
+ correct = False;
+ }
+
+ if (!cli_close(cli1, fnum1)) {
+ printf("close - 4 failed (%s)\n", cli_errstr(cli1));
+ return False;
+ }
+
+ cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname1);
+
+ /*--*/
+
+ fnum1 = cli_nt_create_full(cli1, fname, 0, GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OVERWRITE_IF, 0, 0);
+
+ if (fnum1 == -1) {
+ printf("Fifth open failed - %s\n", cli_errstr(cli1));
+ return False;
+ }
+
+ if (!cli_rename(cli1, fname, fname1)) {
+ printf("Fifth rename failed (SHARE_READ | SHARE_WRITE | SHARE_DELETE) - this should have failed ! \n");
+ correct = False;
+ } else {
+ printf("Fifth rename succeeded (SHARE_READ | SHARE_WRITE | SHARE_DELETE) (this is correct) - %s\n", cli_errstr(cli1));
+ }
+
+ /*
+ * Now check if the first name still exists ...
+ */
+
+ /*fnum2 = cli_nt_create_full(cli1, fname, 0, GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OVERWRITE_IF, 0, 0);
+
+ if (fnum2 == -1) {
+ printf("Opening original file after rename of open file fails: %s\n",
+ cli_errstr(cli1));
+ }
+ else {
+ printf("Opening original file after rename of open file works ...\n");
+ (void)cli_close(cli1, fnum2);
+ } */
+
+ /*--*/
+
+
+ if (!cli_close(cli1, fnum1)) {
+ printf("close - 5 failed (%s)\n", cli_errstr(cli1));
+ return False;
+ }
+
+ cli_unlink(cli1, fname);
+ cli_unlink(cli1, fname1);
+
if (!torture_close_connection(cli1)) {
correct = False;
}