[SCM] Samba Shared Repository - branch v3-5-test updated - tevent-0-9-8-929-g8b5fddf

Jeremy Allison jra at samba.org
Fri Oct 2 12:06:36 MDT 2009


The branch, v3-5-test has been updated
       via  8b5fddf729d73fa2c0e4496fa5aa0d1093c70a05 (commit)
      from  f1470f7e46e2a33b40b9660f2c46996174d8c849 (commit)

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


- Log -----------------------------------------------------------------
commit 8b5fddf729d73fa2c0e4496fa5aa0d1093c70a05
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Oct 2 11:05:03 2009 -0700

    Fix more use of VFS_STAT when posix pathnames selected.
    Jeremy.

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

Summary of changes:
 source3/modules/nfs4_acls.c |    2 +-
 source3/smbd/posix_acls.c   |   62 ++++++++++++++++++++++++++++++------------
 source3/smbd/vfs.c          |    7 ++++-
 3 files changed, 51 insertions(+), 20 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c
index cf96061..658f2b4 100644
--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -170,7 +170,7 @@ static int smbacl4_GetFileOwner(struct connection_struct *conn,
 	/* Get the stat struct for the owner info. */
 	if (vfs_stat_smb_fname(conn, filename, psbuf) != 0)
 	{
-		DEBUG(8, ("SMB_VFS_STAT failed with error %s\n",
+		DEBUG(8, ("vfs_stat_smb_fname failed with error %s\n",
 			strerror(errno)));
 		return -1;
 	}
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index b61421d..e289e51 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -3377,6 +3377,7 @@ NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
 	struct pai_val *pal;
 	struct smb_filename *smb_fname = NULL;
 	NTSTATUS status;
+	int ret;
 
 	*ppdesc = NULL;
 
@@ -3389,7 +3390,13 @@ NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
 	}
 
 	/* Get the stat struct for the owner info. */
-	if(SMB_VFS_STAT(conn, smb_fname) != 0) {
+	if (lp_posix_pathnames()) {
+		ret = SMB_VFS_LSTAT(conn, smb_fname);
+	} else {
+		ret = SMB_VFS_STAT(conn, smb_fname);
+	}
+
+	if (ret == -1) {
 		status = map_nt_error_from_unix(errno);
 		goto out;
 	}
@@ -3435,7 +3442,12 @@ int try_chown(connection_struct *conn, struct smb_filename *smb_fname,
 
 	/* Case (1). */
 	/* try the direct way first */
-	ret = SMB_VFS_CHOWN(conn, smb_fname->base_name, uid, gid);
+	if (lp_posix_pathnames()) {
+		ret = SMB_VFS_LCHOWN(conn, smb_fname->base_name, uid, gid);
+	} else {
+		ret = SMB_VFS_CHOWN(conn, smb_fname->base_name, uid, gid);
+	}
+
 	if (ret == 0)
 		return 0;
 
@@ -3454,8 +3466,13 @@ int try_chown(connection_struct *conn, struct smb_filename *smb_fname,
 
 			become_root();
 			/* Keep the current file gid the same - take ownership doesn't imply group change. */
-			ret = SMB_VFS_CHOWN(conn, smb_fname->base_name, uid,
-					    (gid_t)-1);
+			if (lp_posix_pathnames()) {
+				ret = SMB_VFS_LCHOWN(conn, smb_fname->base_name, uid,
+						    (gid_t)-1);
+			} else {
+				ret = SMB_VFS_CHOWN(conn, smb_fname->base_name, uid,
+						    (gid_t)-1);
+			}
 			unbecome_root();
 			return ret;
 		}
@@ -3476,7 +3493,13 @@ int try_chown(connection_struct *conn, struct smb_filename *smb_fname,
 		return -1;
 	}
 
-	if (SMB_VFS_STAT(conn, smb_fname)) {
+	if (lp_posix_pathnames()) {
+		ret = SMB_VFS_STAT(conn, smb_fname);
+	} else {
+		ret = SMB_VFS_STAT(conn, smb_fname);
+	}
+
+	if (ret == -1) {
 		return -1;
 	}
 
@@ -3716,6 +3739,7 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC
 	bool set_acl_as_root = false;
 	bool acl_set_support = false;
 	bool ret = false;
+	int sret;
 
 	DEBUG(10,("set_nt_acl: called for file %s\n",
 		  fsp_str_dbg(fsp)));
@@ -3730,7 +3754,12 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC
 	 */
 
 	if(fsp->is_directory || fsp->fh->fd == -1) {
-		if(SMB_VFS_STAT(fsp->conn, fsp->fsp_name) != 0) {
+		if (fsp->posix_open) {
+			sret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name);
+		} else {
+			sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name);
+		}
+		if (sret == -1) {
 			return map_nt_error_from_unix(errno);
 		}
 	} else {
@@ -3780,21 +3809,18 @@ NTSTATUS set_nt_acl(files_struct *fsp, uint32 security_info_sent, const SEC_DESC
 		 * (suid/sgid bits, for instance)
 		 */
 
-		if(fsp->is_directory) {
-			if(SMB_VFS_STAT(fsp->conn, fsp->fsp_name) != 0) {
-				return map_nt_error_from_unix(errno);
+		if(fsp->is_directory || fsp->fh->fd == -1) {
+			if (fsp->posix_open) {
+				sret = SMB_VFS_LSTAT(fsp->conn, fsp->fsp_name);
+			} else {
+				sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name);
 			}
 		} else {
+			sret = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st);
+		}
 
-			int sret;
-
-			if(fsp->fh->fd == -1)
-				sret = SMB_VFS_STAT(fsp->conn, fsp->fsp_name);
-			else
-				sret = SMB_VFS_FSTAT(fsp, &fsp->fsp_name->st);
-
-			if(sret != 0)
-				return map_nt_error_from_unix(errno);
+		if(sret == -1) {
+			return map_nt_error_from_unix(errno);
 		}
 
 		/* Save the original element we check against. */
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 9b2df42..171c803 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1008,7 +1008,12 @@ int vfs_stat_smb_fname(struct connection_struct *conn, const char *fname,
 		return -1;
 	}
 
-	ret = SMB_VFS_STAT(conn, smb_fname);
+	if (lp_posix_pathnames()) {
+		ret = SMB_VFS_LSTAT(conn, smb_fname);
+	} else {
+		ret = SMB_VFS_STAT(conn, smb_fname);
+	}
+
 	if (ret != -1) {
 		*psbuf = smb_fname->st;
 	}


-- 
Samba Shared Repository


More information about the samba-cvs mailing list