[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Oct 8 16:37:35 MDT 2009


The branch, master has been updated
       via  333fcba... Cope with old CIFSFS clients that use SMBunlink to remove symlinks instead of trans2:posix_unlink. Jeremy.
       via  5c4fea6... Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba
       via  77abc2d... Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba
       via  46d1933... Exteded RAW-RENAME test to catch regressions in bug 6781. Jeremy.
      from  76f73c7... s3: make linking of libwbclient --as-needed safe

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


- Log -----------------------------------------------------------------
commit 333fcba1deff1b097a2c9a3e7d1d3194997f0513
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Oct 8 15:36:36 2009 -0700

    Cope with old CIFSFS clients that use SMBunlink to remove
    symlinks instead of trans2:posix_unlink.
    Jeremy.

commit 5c4fea6d72ab06ffbe144a7a7581d710a2b3cc7c
Merge: 77abc2dabd0477bf283793389da5add19aa42de1 76f73c73eacce99f0d9479f72dcf39b45418c646
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Oct 8 15:36:24 2009 -0700

    Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba

commit 77abc2dabd0477bf283793389da5add19aa42de1
Merge: 46d193324082000f19221f1b1ac679512aff96ed fb7096a55bb7873965797feee72ceef2404d689d
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Oct 8 10:01:51 2009 -0700

    Merge branch 'master' of ssh://jra@git.samba.org/data/git/samba

commit 46d193324082000f19221f1b1ac679512aff96ed
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:
 source3/smbd/reply.c         |   13 ++++++++++-
 source4/torture/raw/rename.c |   44 ++++++++++++++++++++++++++++++++++++++---
 2 files changed, 51 insertions(+), 6 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index abc3163..2365ed1 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -2383,6 +2383,8 @@ static NTSTATUS do_unlink(connection_struct *conn,
 	files_struct *fsp;
 	uint32 dirtype_orig = dirtype;
 	NTSTATUS status;
+	int ret;
+	bool posix_paths = lp_posix_pathnames();
 
 	DEBUG(10,("do_unlink: %s, dirtype = %d\n",
 		  smb_fname_str_dbg(smb_fname),
@@ -2392,7 +2394,12 @@ static NTSTATUS do_unlink(connection_struct *conn,
 		return NT_STATUS_MEDIA_WRITE_PROTECTED;
 	}
 
-	if (SMB_VFS_LSTAT(conn, smb_fname) != 0) {
+	if (posix_paths) {
+		ret = SMB_VFS_LSTAT(conn, smb_fname);
+	} else {
+		ret = SMB_VFS_LSTAT(conn, smb_fname);
+	}
+	if (ret != 0) {
 		return map_nt_error_from_unix(errno);
 	}
 
@@ -2479,7 +2486,9 @@ static NTSTATUS do_unlink(connection_struct *conn,
 		 FILE_SHARE_NONE,	/* share_access */
 		 FILE_OPEN,		/* create_disposition*/
 		 FILE_NON_DIRECTORY_FILE, /* create_options */
-		 FILE_ATTRIBUTE_NORMAL,	/* file_attributes */
+		 			/* file_attributes */
+		 posix_paths ? FILE_FLAG_POSIX_SEMANTICS|0777 :
+				FILE_ATTRIBUTE_NORMAL,
 		 0,			/* oplock_request */
 		 0,			/* allocation_size */
 		 NULL,			/* sd */
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