diff options
-rw-r--r-- | source4/torture/raw/unlink.c | 31 |
1 files changed, 30 insertions, 1 deletions
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); |