From 7937a353db9afe1ef6062c77ca5bfb9bad8319c4 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 3 Aug 2005 16:50:12 +0000 Subject: r9003: add testing for non-empty directory delete on close (This used to be commit caca1f191d23ef848d3c8da76e8a0e80a06dacef) --- source4/torture/raw/unlink.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'source4/torture/raw') diff --git a/source4/torture/raw/unlink.c b/source4/torture/raw/unlink.c index e8808957c6..b2eb7eae60 100644 --- a/source4/torture/raw/unlink.c +++ b/source4/torture/raw/unlink.c @@ -173,9 +173,10 @@ static BOOL test_delete_on_close(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) struct smb_rmdir dio; NTSTATUS status; BOOL ret = True; - int fnum; + int fnum, fnum2; const char *fname = BASEDIR "\\test.txt"; const char *dname = BASEDIR "\\test.dir"; + const char *inside = BASEDIR "\\test.dir\\test.txt"; union smb_setfileinfo sfinfo; if (!torture_setup_dir(cli, BASEDIR)) { @@ -242,6 +243,34 @@ static BOOL test_delete_on_close(struct smbcli_state *cli, TALLOC_CTX *mem_ctx) status = smb_raw_rmdir(cli->tree, &dio); CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND); + + printf("Testing with non-empty directory delete_on_close\n"); + fnum = create_directory_handle(cli->tree, dname); + fnum2 = create_complex_file(cli, mem_ctx, inside); + + sfinfo.disposition_info.file.fnum = fnum; + sfinfo.disposition_info.in.delete_on_close = 1; + status = smb_raw_setfileinfo(cli->tree, &sfinfo); + CHECK_STATUS(status, NT_STATUS_DIRECTORY_NOT_EMPTY); + + sfinfo.disposition_info.file.fnum = fnum2; + status = smb_raw_setfileinfo(cli->tree, &sfinfo); + CHECK_STATUS(status, NT_STATUS_OK); + + sfinfo.disposition_info.file.fnum = fnum; + status = smb_raw_setfileinfo(cli->tree, &sfinfo); + CHECK_STATUS(status, NT_STATUS_DIRECTORY_NOT_EMPTY); + + smbcli_close(cli->tree, fnum2); + + status = smb_raw_setfileinfo(cli->tree, &sfinfo); + CHECK_STATUS(status, NT_STATUS_OK); + + smbcli_close(cli->tree, fnum); + + status = smb_raw_rmdir(cli->tree, &dio); + CHECK_STATUS(status, NT_STATUS_OBJECT_NAME_NOT_FOUND); + done: smb_raw_exit(cli->session); smbcli_deltree(cli->tree, BASEDIR); -- cgit