[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Aug 18 16:44:01 MDT 2011


The branch, master has been updated
       via  a6d06c0 Fix bug #8370 - vfs_chown_fsp broken -- returns in the wrong directory
      from  292fe74 credentials: Rename library to samba-credentials to avoid name clashes.

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


- Log -----------------------------------------------------------------
commit a6d06c069734cae037105350982545b6a964bbd8
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Aug 18 14:11:45 2011 -0700

    Fix bug #8370 - vfs_chown_fsp broken -- returns in the wrong directory
    
    Ensure we always use vfs_ChDir() to keep the singleton cache coherent.
    
    Autobuild-User: Jeremy Allison <jra at samba.org>
    Autobuild-Date: Fri Aug 19 00:43:05 CEST 2011 on sn-devel-104

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

Summary of changes:
 source3/modules/vfs_acl_common.c |   13 +++++++++++--
 source3/smbd/vfs.c               |   10 +++++++---
 2 files changed, 18 insertions(+), 5 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_acl_common.c b/source3/modules/vfs_acl_common.c
index b01fd18..a4d712f 100644
--- a/source3/modules/vfs_acl_common.c
+++ b/source3/modules/vfs_acl_common.c
@@ -831,6 +831,13 @@ static int acl_common_remove_object(vfs_handle_struct *handle,
 	const char *final_component = NULL;
 	struct smb_filename local_fname;
 	int saved_errno = 0;
+	char *saved_dir = NULL;
+
+	saved_dir = vfs_GetWd(talloc_tos(),conn);
+	if (!saved_dir) {
+		saved_errno = errno;
+		goto out;
+	}
 
 	if (!parent_dirname(talloc_tos(), path,
 			&parent_dir, &final_component)) {
@@ -843,7 +850,7 @@ static int acl_common_remove_object(vfs_handle_struct *handle,
 		parent_dir, final_component ));
 
  	/* cd into the parent dir to pin it. */
-	ret = SMB_VFS_CHDIR(conn, parent_dir);
+	ret = vfs_ChDir(conn, parent_dir);
 	if (ret == -1) {
 		saved_errno = errno;
 		goto out;
@@ -897,7 +904,9 @@ static int acl_common_remove_object(vfs_handle_struct *handle,
 
 	TALLOC_FREE(parent_dir);
 
-	vfs_ChDir(conn, conn->connectpath);
+	if (saved_dir) {
+		vfs_ChDir(conn, saved_dir);
+	}
 	if (saved_errno) {
 		errno = saved_errno;
 	}
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index ed50098..c6edef2 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1501,7 +1501,7 @@ NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid)
 		}
 
 		/* cd into the parent dir to pin it. */
-		ret = SMB_VFS_CHDIR(fsp->conn, parent_dir);
+		ret = vfs_ChDir(fsp->conn, parent_dir);
 		if (ret == -1) {
 			return map_nt_error_from_unix(errno);
 		}
@@ -1512,12 +1512,14 @@ NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid)
 		/* Must use lstat here. */
 		ret = SMB_VFS_LSTAT(fsp->conn, &local_fname);
 		if (ret == -1) {
-			return map_nt_error_from_unix(errno);
+			status = map_nt_error_from_unix(errno);
+			goto out;
 		}
 
 		/* Ensure it matches the fsp stat. */
 		if (!check_same_stat(&local_fname.st, &fsp->fsp_name->st)) {
-                        return NT_STATUS_ACCESS_DENIED;
+                        status = NT_STATUS_ACCESS_DENIED;
+			goto out;
                 }
                 path = final_component;
         } else {
@@ -1540,6 +1542,8 @@ NTSTATUS vfs_chown_fsp(files_struct *fsp, uid_t uid, gid_t gid)
 		status = map_nt_error_from_unix(errno);
 	}
 
+  out:
+
 	if (as_root) {
 		vfs_ChDir(fsp->conn,saved_dir);
 		TALLOC_FREE(saved_dir);


-- 
Samba Shared Repository


More information about the samba-cvs mailing list