diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-08-03 16:50:12 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:31:06 -0500 |
commit | 7937a353db9afe1ef6062c77ca5bfb9bad8319c4 (patch) | |
tree | f6a63712ed5990365924462174237614535098c9 /source4/torture/raw | |
parent | acf85ac3ef54c8193574692203c70c4bd5281fcd (diff) | |
download | samba-7937a353db9afe1ef6062c77ca5bfb9bad8319c4.tar.gz samba-7937a353db9afe1ef6062c77ca5bfb9bad8319c4.tar.bz2 samba-7937a353db9afe1ef6062c77ca5bfb9bad8319c4.zip |
r9003: add testing for non-empty directory delete on close
(This used to be commit caca1f191d23ef848d3c8da76e8a0e80a06dacef)
Diffstat (limited to 'source4/torture/raw')
-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); |