diff options
author | Jeremy Allison <jra@samba.org> | 2002-03-05 19:45:16 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2002-03-05 19:45:16 +0000 |
commit | a4ff0924d6ec313c67abd5f8214803706d51a348 (patch) | |
tree | c6340755167e1d44e260e24fb18276a4d68a1720 /source3/torture | |
parent | 7b07ecb750b137b9e28de5135d7d50b3c732654e (diff) | |
download | samba-a4ff0924d6ec313c67abd5f8214803706d51a348.tar.gz samba-a4ff0924d6ec313c67abd5f8214803706d51a348.tar.bz2 samba-a4ff0924d6ec313c67abd5f8214803706d51a348.zip |
Found the mp3 problem - it's a generic class bug w.r.t. renaming.
Added a rename torture test to illustrate the problem.
Jeremy.
(This used to be commit 509ac24525a0d1aaecc819a99590425a164aaf44)
Diffstat (limited to 'source3/torture')
-rw-r--r-- | source3/torture/torture.c | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/source3/torture/torture.c b/source3/torture/torture.c index 8fbc5dbeb0..3e07de09eb 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -2675,6 +2675,77 @@ static BOOL run_xcopy(int dummy) return correct; } +/* + Test rename on files open with share delete and no share delete. + */ +static BOOL run_rename(int dummy) +{ + static struct cli_state cli1; + char *fname = "\\test.txt"; + char *fname1 = "\\test1.txt"; + BOOL correct = True; + int fnum1, fnum2; + + printf("starting rename test\n"); + + if (!torture_open_connection(&cli1)) { + return False; + } + + cli_unlink(&cli1, fname); + cli_unlink(&cli1, fname1); + fnum1 = cli_nt_create_full(&cli1, fname, GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL, + FILE_SHARE_READ, FILE_OVERWRITE_IF, 0); + + if (fnum1 == -1) { + printf("First open failed - %s\n", cli_errstr(&cli1)); + return False; + } + + if (!cli_rename(&cli1, fname, fname1)) { + printf("First rename failed (this is correct) - %s\n", cli_errstr(&cli1)); + } else { + printf("First rename succeeded - this should have failed !\n"); + correct = False; + } + + if (!cli_close(&cli1, fnum1)) { + printf("close - 1 failed (%s)\n", cli_errstr(&cli1)); + return False; + } + + cli_unlink(&cli1, fname); + cli_unlink(&cli1, fname1); + fnum1 = cli_nt_create_full(&cli1, fname,GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL, + FILE_SHARE_DELETE|FILE_SHARE_READ, FILE_OVERWRITE_IF, 0); + + if (fnum1 == -1) { + printf("Second open failed - %s\n", cli_errstr(&cli1)); + return False; + } + + if (!cli_rename(&cli1, fname, fname1)) { + printf("Second rename failed - this should have succeeded - %s\n", cli_errstr(&cli1)); + correct = False; + } else { + printf("Second rename succeeded\n"); + } + + if (!cli_close(&cli1, fnum1)) { + printf("close - 2 failed (%s)\n", cli_errstr(&cli1)); + return False; + } + + cli_unlink(&cli1, fname); + cli_unlink(&cli1, fname1); + + if (!torture_close_connection(&cli1)) { + correct = False; + } + + return correct; +} + /* Test open mode returns on read-only files. @@ -3138,6 +3209,7 @@ static struct { {"RW3", run_readwritelarge, 0}, {"OPEN", run_opentest, 0}, {"XCOPY", run_xcopy, 0}, + {"RENAME", run_rename, 0}, {"DELETE", run_deletetest, 0}, {"W2K", run_w2ktest, 0}, {"TRANS2SCAN", torture_trans2_scan, 0}, |