[SCM] Samba Shared Repository - branch master updated - 3c5c3aaa74c1023f01236d6f572587264834a097

Jeremy Allison jra at samba.org
Sat Dec 13 21:11:53 GMT 2008


The branch, master has been updated
       via  3c5c3aaa74c1023f01236d6f572587264834a097 (commit)
      from  c689d75c27c9fb0a0b3ae05fc75d38671055cd8e (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 3c5c3aaa74c1023f01236d6f572587264834a097
Author: Jeremy Allison <jra at samba.org>
Date:   Sat Dec 13 13:10:48 2008 -0800

    Added torture test for doing an openX over a directory
    to ensure we get the correct error message.
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source4/torture/raw/open.c |   47 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 47 insertions(+), 0 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/raw/open.c b/source4/torture/raw/open.c
index ef0fa51..9f35aae 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);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list