[SCM] Samba Shared Repository - branch v3-5-test updated

Jeremy Allison jra at samba.org
Wed Oct 7 17:54:30 MDT 2009


The branch, v3-5-test has been updated
       via  d294fd3... Exteded RAW-RENAME test to catch regressions in bug 6781. Jeremy.
      from  879c3b8... Oops. Don't break the build.. Jeremy.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-5-test


- Log -----------------------------------------------------------------
commit d294fd3a0c152e5bde491d39219c54c113db9afe
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Oct 7 16:52:29 2009 -0700

    Exteded RAW-RENAME test to catch regressions in bug 6781.
    Jeremy.

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

Summary of changes:
 source4/torture/raw/rename.c |   44 ++++++++++++++++++++++++++++++++++++++---
 1 files changed, 40 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source4/torture/raw/rename.c b/source4/torture/raw/rename.c
index 15fed0e..5402fed 100644
--- a/source4/torture/raw/rename.c
+++ b/source4/torture/raw/rename.c
@@ -528,8 +528,9 @@ static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *c
 	NTSTATUS status;
         const char *dname1 = BASEDIR "\\dir_for_rename";
         const char *dname2 = BASEDIR "\\renamed_dir";
+        const char *dname1_long = BASEDIR "\\dir_for_rename_long";
         const char *fname = BASEDIR "\\dir_for_rename\\file.txt";
-	const char *sname = BASEDIR "\\dir_for_rename:a stream:$DATA";
+	const char *sname = BASEDIR "\\renamed_dir:a stream:$DATA";
 	bool ret = true;
 	int fnum = -1;
 
@@ -542,8 +543,10 @@ static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *c
         /* create a directory */
         smbcli_rmdir(cli->tree, dname1);
         smbcli_rmdir(cli->tree, dname2);
+        smbcli_rmdir(cli->tree, dname1_long);
         smbcli_unlink(cli->tree, dname1);
         smbcli_unlink(cli->tree, dname2);
+        smbcli_unlink(cli->tree, dname1_long);
 
         ZERO_STRUCT(io);
         io.generic.level = RAW_OPEN_NTCREATEX;
@@ -561,6 +564,14 @@ static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *c
         fnum = io.ntcreatex.out.file.fnum;
 	smbcli_close(cli->tree, fnum);
 
+        /* create the longname directory */
+        io.ntcreatex.in.fname = dname1_long;
+        status = smb_raw_open(cli->tree, tctx, &io);
+        CHECK_STATUS(status, NT_STATUS_OK);
+
+        fnum = io.ntcreatex.out.file.fnum;
+	smbcli_close(cli->tree, fnum);
+
         /* Now create and hold open a file. */
         ZERO_STRUCT(io);
 
@@ -625,6 +636,31 @@ static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *c
 	/* close our handle to the directory. */
 	smbcli_close(cli->tree, fnum);
 
+	/* Open a handle on the long name, and then
+	 * try a rename. This would catch a regression
+	 * in bug #6781.
+	 */
+	io.ntcreatex.in.fname = dname1_long;
+	io.ntcreatex.in.open_disposition = NTCREATEX_DISP_OPEN_IF;
+
+	io.ntcreatex.in.access_mask = SEC_STD_READ_CONTROL |
+	    SEC_FILE_READ_ATTRIBUTE | SEC_FILE_READ_EA | SEC_FILE_READ_DATA;
+
+	status = smb_raw_open(cli->tree, tctx, &io);
+        CHECK_STATUS(status, NT_STATUS_OK);
+        fnum = io.ntcreatex.out.file.fnum;
+
+	ren_io.generic.level = RAW_RENAME_RENAME;
+	ren_io.rename.in.pattern1 = dname1;
+	ren_io.rename.in.pattern2 = dname2;
+	ren_io.rename.in.attrib = 0;
+
+	status = smb_raw_rename(cli->tree, &ren_io);
+	CHECK_STATUS(status, NT_STATUS_OK);
+
+	/* close our handle to the longname directory. */
+	smbcli_close(cli->tree, fnum);
+
 	/*
 	 * Now try opening a stream on the directory and holding it open
 	 * across a rename.  This should be allowed.
@@ -636,15 +672,15 @@ static bool test_dir_rename(struct torture_context *tctx, struct smbcli_state *c
         fnum = io.ntcreatex.out.file.fnum;
 
 	ren_io.generic.level = RAW_RENAME_RENAME;
-	ren_io.rename.in.pattern1 = dname1;
-	ren_io.rename.in.pattern2 = dname2;
+	ren_io.rename.in.pattern1 = dname2;
+	ren_io.rename.in.pattern2 = dname1;
 	ren_io.rename.in.attrib = 0;
 
 	status = smb_raw_rename(cli->tree, &ren_io);
 	CHECK_STATUS(status, NT_STATUS_OK);
 
 done:
-	
+
 	if (fnum != -1) {
 		smbcli_close(cli->tree, fnum);
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list