summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-12-13 13:10:48 -0800
committerJeremy Allison <jra@samba.org>2008-12-13 13:10:48 -0800
commit3c5c3aaa74c1023f01236d6f572587264834a097 (patch)
treee11cd46fc7dc65efb7d6ac8c8767a725444f8518 /source4
parentc689d75c27c9fb0a0b3ae05fc75d38671055cd8e (diff)
downloadsamba-3c5c3aaa74c1023f01236d6f572587264834a097.tar.gz
samba-3c5c3aaa74c1023f01236d6f572587264834a097.tar.bz2
samba-3c5c3aaa74c1023f01236d6f572587264834a097.zip
Added torture test for doing an openX over a directory
to ensure we get the correct error message. Jeremy.
Diffstat (limited to 'source4')
-rw-r--r--source4/torture/raw/open.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index ef0fa5138a..9f35aae4d0 100644
--- a/source4/torture/raw/open.c
+++ b/source4/torture/raw/open.c
@@ -1422,6 +1422,52 @@ done:
return ret;
}
+/*
+ test RAW_OPEN_OPENX against an existing directory to
+ ensure it returns NT_STATUS_FILE_IS_A_DIRECTORY.
+ Samba 3.2.0 - 3.2.6 are known to fail this.
+
+*/
+static bool test_openx_over_dir(struct smbcli_state *cli, TALLOC_CTX *tctx)
+{
+ union smb_open io;
+ const char *fname = BASEDIR "\\openx_over_dir";
+ NTSTATUS status;
+ int d_fnum = -1;
+ int fnum = -1;
+ bool ret = true;
+
+ printf("Checking RAW_OPEN_OPENX over an existing directory\n");
+ smbcli_unlink(cli->tree, fname);
+
+ /* Create the Directory */
+ status = create_directory_handle(cli->tree, fname, &d_fnum);
+ smbcli_close(cli->tree, d_fnum);
+
+ /* Prepare to open the file over the directory. */
+ io.openx.level = RAW_OPEN_OPENX;
+ io.openx.in.fname = fname;
+ io.openx.in.flags = OPENX_FLAGS_ADDITIONAL_INFO;
+ io.openx.in.open_mode = OPENX_MODE_ACCESS_RDWR;
+ io.openx.in.open_func = OPENX_OPEN_FUNC_OPEN;
+ io.openx.in.search_attrs = 0;
+ io.openx.in.file_attrs = 0;
+ io.openx.in.write_time = 0;
+ io.openx.in.size = 1024*1024;
+ io.openx.in.timeout = 0;
+
+ status = smb_raw_open(cli->tree, tctx, &io);
+ CHECK_STATUS(status, NT_STATUS_FILE_IS_A_DIRECTORY);
+ fnum = io.openx.out.file.fnum;
+
+done:
+ smbcli_close(cli->tree, fnum);
+ smbcli_unlink(cli->tree, fname);
+
+ return ret;
+}
+
+
/* A little torture test to expose a race condition in Samba 3.0.20 ... :-) */
static bool test_raw_open_multi(struct torture_context *tctx)
@@ -1624,6 +1670,7 @@ bool torture_raw_open(struct torture_context *torture, struct smbcli_state *cli)
ret &= test_ctemp(cli, torture);
ret &= test_chained(cli, torture);
ret &= test_no_leading_slash(cli, torture);
+ ret &= test_openx_over_dir(cli, torture);
ret &= test_open_for_delete(cli, torture);
smb_raw_exit(cli->session);