From c90cd26e9430b2fc065f620bdb6aaf4be0372fcc Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 23 Mar 2002 02:57:44 +0000 Subject: Fix the mp3 rename bug - also tidy up our open code and remove the special cases for rename and unlink. Had to add desired_access into the share mode record. Jeremy. (This used to be commit 3b1b8ac43535fb0839c5474fa55bf7150f6cde31) --- source3/torture/torture.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) (limited to 'source3/torture') diff --git a/source3/torture/torture.c b/source3/torture/torture.c index f4c816b325..e1373cc355 100644 --- a/source3/torture/torture.c +++ b/source3/torture/torture.c @@ -622,6 +622,20 @@ static BOOL run_readwritelarge(int dummy) correct = False; } +#if 0 + /* ToDo - set allocation. JRA */ + if(!cli_set_allocation_size(&cli1, fnum1, 0)) { + printf("set allocation size to zero failed (%s)\n", cli_errstr(&cli1)); + return False; + } + if (!cli_qfileinfo(&cli1, fnum1, NULL, &fsize, NULL, NULL, NULL, NULL, NULL)) { + printf("qfileinfo failed (%s)\n", cli_errstr(&cli1)); + correct = False; + } + if (fsize != 0) + printf("readwritelarge test 3 (truncate test) succeeded (size = %x)\n", fsize); +#endif + if (!cli_close(&cli1, fnum1)) { printf("close failed (%s)\n", cli_errstr(&cli1)); correct = False; @@ -2902,7 +2916,11 @@ static BOOL run_rename(int dummy) cli_unlink(&cli1, fname); cli_unlink(&cli1, fname1); fnum1 = cli_nt_create_full(&cli1, fname,GENERIC_READ_ACCESS, FILE_ATTRIBUTE_NORMAL, +#if 0 + FILE_SHARE_DELETE|FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0); +#else FILE_SHARE_DELETE|FILE_SHARE_READ, FILE_OVERWRITE_IF, 0); +#endif if (fnum1 == -1) { printf("Second open failed - %s\n", cli_errstr(&cli1)); @@ -2924,6 +2942,57 @@ static BOOL run_rename(int dummy) cli_unlink(&cli1, fname); cli_unlink(&cli1, fname1); +#if 0 + fnum1 = cli_nt_create_full(&cli1, fname,FILE_READ_DATA, FILE_ATTRIBUTE_NORMAL, +#else + fnum1 = cli_nt_create_full(&cli1, fname,READ_CONTROL_ACCESS, FILE_ATTRIBUTE_NORMAL, +#endif + FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0); + + if (fnum1 == -1) { + printf("Third open failed - %s\n", cli_errstr(&cli1)); + return False; + } + + +#if 1 + { + int fnum2; + + fnum2 = cli_nt_create_full(&cli1, fname,DELETE_ACCESS, FILE_ATTRIBUTE_NORMAL, + FILE_SHARE_NONE, FILE_OVERWRITE_IF, 0); + + if (fnum2 == -1) { + printf("Fourth open failed - %s\n", cli_errstr(&cli1)); + return False; + } + if (!cli_nt_delete_on_close(&cli1, fnum2, True)) { + printf("[8] setting delete_on_close on file failed !\n"); + return False; + } + + if (!cli_close(&cli1, fnum2)) { + printf("close - 4 failed (%s)\n", cli_errstr(&cli1)); + return False; + } + } +#endif + + if (!cli_rename(&cli1, fname, fname1)) { + printf("Third rename failed - this should have succeeded - %s\n", cli_errstr(&cli1)); + correct = False; + } else { + printf("Third rename succeeded\n"); + } + + if (!cli_close(&cli1, fnum1)) { + printf("close - 3 failed (%s)\n", cli_errstr(&cli1)); + return False; + } + + cli_unlink(&cli1, fname); + cli_unlink(&cli1, fname1); + if (!torture_close_connection(&cli1)) { correct = False; } -- cgit