[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Mar 15 01:19:03 UTC 2016


The branch, master has been updated
       via  e3be771 build: improve comments in tests/oldquotas.c
       via  faf7185 s3:vfs: Change smbacl4_GetFileOwner() to take const struct smb_filename * from const char *.
       via  377c7b3 s3:smbd:vfs: Change posix_get_nt_acl() from const char * to const struct smb_filename *.
       via  cb70165 s3:smbd:vfs: Change smb_get_nt_acl_nfs4() to take a const struct smb_filename *.
       via  6d9e7ad s3:smbd: Fix build for vfs_aixacl2.c.
       via  fca72bf s3: smbd: Remove the last lp_posix_pathnames() in the rename path.
      from  b7a050d smbd:smb2: remove an unnecessary !! cast.

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


- Log -----------------------------------------------------------------
commit e3be771f24cb427be298e0d463ebf2f3a7704d15
Author: Uri Simchoni <uri at samba.org>
Date:   Sun Mar 13 07:17:23 2016 +0200

    build: improve comments in tests/oldquotas.c
    
    Add comments to #else and #endif
    
    Signed-off-by: Uri Simchoni <uri at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Mar 15 02:18:15 CET 2016 on sn-devel-144

commit faf7185fe407a973c9ae02cbb5f64f199beff8b0
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 10 16:17:32 2016 -0800

    s3:vfs: Change smbacl4_GetFileOwner() to take const struct smb_filename * from const char *.
    
    Preparing to remove vfs_stat_smb_basename() call.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <rb at sernet.de>

commit 377c7b311e427a302b27f3512373e881de432081
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 10 16:05:48 2016 -0800

    s3:smbd:vfs: Change posix_get_nt_acl() from const char * to const struct smb_filename *.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <rb at sernet.de>

commit cb7016594ae67d8f1c0195cf215a5cf1dd12cd9c
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 10 15:56:51 2016 -0800

    s3:smbd:vfs: Change smb_get_nt_acl_nfs4() to take a const struct smb_filename *.
    
    Push the struct further down closer to places that use
    lp_posix_pathname() functions.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <rb at sernet.de>

commit 6d9e7ad3de6541b1434b0798a1162816f4967134
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 10 15:34:58 2016 -0800

    s3:smbd: Fix build for vfs_aixacl2.c.
    
    Missed conversion of get_nt_acl_fn from const char *
    to const struct smb_filename *.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <rb at sernet.de>

commit fca72bf4f6dc6a3d82d10e4b865472d9819de136
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Mar 10 15:15:34 2016 -0800

    s3: smbd: Remove the last lp_posix_pathnames() in the rename path.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <rb at sernet.de>

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

Summary of changes:
 source3/modules/nfs4_acls.c         | 15 ++++++------
 source3/modules/nfs4_acls.h         |  2 +-
 source3/modules/vfs_aixacl2.c       | 23 ++++++++++++------
 source3/modules/vfs_default.c       |  2 +-
 source3/modules/vfs_gpfs.c          |  4 ++--
 source3/modules/vfs_nfs4acl_xattr.c |  2 +-
 source3/modules/vfs_zfsacl.c        |  2 +-
 source3/smbd/posix_acls.c           | 48 ++++++++++++++++++++++---------------
 source3/smbd/proto.h                |  9 +++----
 source3/smbd/reply.c                |  2 +-
 tests/oldquotas.c                   | 40 +++++++++++++++----------------
 11 files changed, 85 insertions(+), 64 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c
index 26a98b7..349b26b 100644
--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -268,13 +268,13 @@ bool smbacl4_set_controlflags(struct SMB4ACL_T *acl, uint16_t controlflags)
 }
 
 static int smbacl4_GetFileOwner(struct connection_struct *conn,
-				const char *filename,
+				const struct smb_filename *smb_fname,
 				SMB_STRUCT_STAT *psbuf)
 {
 	ZERO_STRUCTP(psbuf);
 
 	/* Get the stat struct for the owner info. */
-	if (vfs_stat_smb_basename(conn, filename, psbuf) != 0)
+	if (vfs_stat_smb_basename(conn, smb_fname->base_name, psbuf) != 0)
 	{
 		DEBUG(8, ("vfs_stat_smb_basename failed with error %s\n",
 			strerror(errno)));
@@ -290,7 +290,7 @@ static int smbacl4_fGetFileOwner(files_struct *fsp, SMB_STRUCT_STAT *psbuf)
 
 	if (fsp->fh->fd == -1) {
 		return smbacl4_GetFileOwner(fsp->conn,
-					    fsp->fsp_name->base_name, psbuf);
+					    fsp->fsp_name, psbuf);
 	}
 	if (SMB_VFS_FSTAT(fsp, psbuf) != 0)
 	{
@@ -557,7 +557,7 @@ NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp,
 }
 
 NTSTATUS smb_get_nt_acl_nfs4(struct connection_struct *conn,
-			     const char *name,
+			     const struct smb_filename *smb_fname,
 			     uint32_t security_info,
 			     TALLOC_CTX *mem_ctx,
 			     struct security_descriptor **ppdesc,
@@ -566,9 +566,10 @@ NTSTATUS smb_get_nt_acl_nfs4(struct connection_struct *conn,
 	SMB_STRUCT_STAT sbuf;
 	smbacl4_vfs_params params;
 
-	DEBUG(10, ("smb_get_nt_acl_nfs4 invoked for %s\n", name));
+	DEBUG(10, ("smb_get_nt_acl_nfs4 invoked for %s\n",
+		smb_fname->base_name));
 
-	if (smbacl4_GetFileOwner(conn, name, &sbuf)) {
+	if (smbacl4_GetFileOwner(conn, smb_fname, &sbuf)) {
 		return map_nt_error_from_unix(errno);
 	}
 
@@ -967,7 +968,7 @@ NTSTATUS smb_set_nt_acl_nfs4(vfs_handle_struct *handle, files_struct *fsp,
 				  fsp_str_dbg(fsp), (unsigned int)newUID,
 				  (unsigned int)newGID));
 			if (smbacl4_GetFileOwner(fsp->conn,
-						 fsp->fsp_name->base_name,
+						 fsp->fsp_name,
 						 &sbuf)){
 				TALLOC_FREE(frame);
 				return map_nt_error_from_unix(errno);
diff --git a/source3/modules/nfs4_acls.h b/source3/modules/nfs4_acls.h
index e11845e..588e8ea 100644
--- a/source3/modules/nfs4_acls.h
+++ b/source3/modules/nfs4_acls.h
@@ -136,7 +136,7 @@ NTSTATUS smb_fget_nt_acl_nfs4(files_struct *fsp,
 	struct security_descriptor **ppdesc, struct SMB4ACL_T *theacl);
 
 NTSTATUS smb_get_nt_acl_nfs4(connection_struct *conn,
-	const char *name,
+	const struct smb_filename *smb_fname,
 	uint32_t security_info,
 	TALLOC_CTX *mem_ctx,
 	struct security_descriptor **ppdesc, struct SMB4ACL_T *theacl);
diff --git a/source3/modules/vfs_aixacl2.c b/source3/modules/vfs_aixacl2.c
index a70013d..1c9f84b 100644
--- a/source3/modules/vfs_aixacl2.c
+++ b/source3/modules/vfs_aixacl2.c
@@ -186,7 +186,7 @@ static NTSTATUS aixjfs2_fget_nt_acl(vfs_handle_struct *handle,
 }
 
 static NTSTATUS aixjfs2_get_nt_acl(vfs_handle_struct *handle,
-	const char *name,
+	const struct smb_filename *smb_fname,
 	uint32_t security_info,
 	TALLOC_CTX *mem_ctx,
 	struct security_descriptor **ppdesc)
@@ -196,19 +196,28 @@ static NTSTATUS aixjfs2_get_nt_acl(vfs_handle_struct *handle,
 	bool	retryPosix = False;
 
 	*ppdesc = NULL;
-	result = aixjfs2_get_nfs4_acl(mem_ctx, name, &pacl, &retryPosix);
+	result = aixjfs2_get_nfs4_acl(mem_ctx,
+			smb_fname->base_name,
+			&pacl,
+			&retryPosix);
 	if (retryPosix)
 	{
 		DEBUG(10, ("retrying with posix acl...\n"));
-		return posix_get_nt_acl(handle->conn, name, security_info,
-					mem_ctx, ppdesc);
+		return posix_get_nt_acl(handle->conn,
+				smb_fname,
+				security_info,
+				mem_ctx,
+				ppdesc);
 	}
 	if (result==False)
 		return NT_STATUS_ACCESS_DENIED;
 
-	return smb_get_nt_acl_nfs4(handle->conn, name, security_info,
-				   mem_ctx, ppdesc,
-				   pacl);
+	return smb_get_nt_acl_nfs4(handle->conn,
+				smb_fname,
+				security_info,
+				mem_ctx,
+				ppdesc,
+				pacl);
 }
 
 static int aixjfs2_sys_acl_blob_get_file(vfs_handle_struct *handle, const char *path_p, TALLOC_CTX *mem_ctx, char **blob_description, DATA_BLOB *blob)
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index ee9ddb2..ea7dc2c 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -2344,7 +2344,7 @@ static NTSTATUS vfswrap_get_nt_acl(vfs_handle_struct *handle,
 
 	START_PROFILE(get_nt_acl);
 	result = posix_get_nt_acl(handle->conn,
-				smb_fname->base_name,
+				smb_fname,
 				security_info,
 				mem_ctx,
 				ppdesc);
diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
index cc17d2a..09e37fa 100644
--- a/source3/modules/vfs_gpfs.c
+++ b/source3/modules/vfs_gpfs.c
@@ -613,7 +613,7 @@ static NTSTATUS gpfsacl_get_nt_acl(vfs_handle_struct *handle,
 	result = gpfs_get_nfs4_acl(frame, smb_fname->base_name, &pacl);
 
 	if (result == 0) {
-		status = smb_get_nt_acl_nfs4(handle->conn, smb_fname->base_name,
+		status = smb_get_nt_acl_nfs4(handle->conn, smb_fname,
 					     security_info, mem_ctx, ppdesc,
 					     pacl);
 		TALLOC_FREE(frame);
@@ -622,7 +622,7 @@ static NTSTATUS gpfsacl_get_nt_acl(vfs_handle_struct *handle,
 
 	if (result > 0) {
 		DEBUG(10, ("retrying with posix acl...\n"));
-		status = posix_get_nt_acl(handle->conn, smb_fname->base_name,
+		status = posix_get_nt_acl(handle->conn, smb_fname,
 					  security_info, mem_ctx, ppdesc);
 		TALLOC_FREE(frame);
 		return status;
diff --git a/source3/modules/vfs_nfs4acl_xattr.c b/source3/modules/vfs_nfs4acl_xattr.c
index c02fd6a..af84b8b 100644
--- a/source3/modules/vfs_nfs4acl_xattr.c
+++ b/source3/modules/vfs_nfs4acl_xattr.c
@@ -560,7 +560,7 @@ static NTSTATUS nfs4acl_xattr_get_nt_acl(struct vfs_handle_struct *handle,
 		return status;
 	}
 
-	status = smb_get_nt_acl_nfs4(handle->conn, name, security_info,
+	status = smb_get_nt_acl_nfs4(handle->conn, smb_fname, security_info,
 				     mem_ctx, ppdesc,
 				     pacl);
 	TALLOC_FREE(frame);
diff --git a/source3/modules/vfs_zfsacl.c b/source3/modules/vfs_zfsacl.c
index 7dc7cec..18f1356 100644
--- a/source3/modules/vfs_zfsacl.c
+++ b/source3/modules/vfs_zfsacl.c
@@ -233,7 +233,7 @@ static NTSTATUS zfsacl_get_nt_acl(struct vfs_handle_struct *handle,
 	}
 
 	status = smb_get_nt_acl_nfs4(handle->conn,
-					smb_fname->base_name,
+					smb_fname,
 					security_info,
 					mem_ctx,
 					ppdesc,
diff --git a/source3/smbd/posix_acls.c b/source3/smbd/posix_acls.c
index ac296e2..c4eeb9c 100644
--- a/source3/smbd/posix_acls.c
+++ b/source3/smbd/posix_acls.c
@@ -3516,7 +3516,7 @@ NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
 
 	/* can it happen that fsp_name == NULL ? */
 	if (fsp->is_directory ||  fsp->fh->fd == -1) {
-		status = posix_get_nt_acl(fsp->conn, fsp->fsp_name->base_name,
+		status = posix_get_nt_acl(fsp->conn, fsp->fsp_name,
 					  security_info, mem_ctx, ppdesc);
 		TALLOC_FREE(frame);
 		return status;
@@ -3540,31 +3540,36 @@ NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
 	return status;
 }
 
-NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
-			  uint32_t security_info,
-			  TALLOC_CTX *mem_ctx,
-			  struct security_descriptor **ppdesc)
+NTSTATUS posix_get_nt_acl(struct connection_struct *conn,
+			const struct smb_filename *smb_fname_in,
+			uint32_t security_info,
+			TALLOC_CTX *mem_ctx,
+			struct security_descriptor **ppdesc)
 {
 	SMB_ACL_T posix_acl = NULL;
 	SMB_ACL_T def_acl = NULL;
 	struct pai_val *pal;
-	struct smb_filename smb_fname;
+	struct smb_filename *smb_fname = NULL;
 	int ret;
 	TALLOC_CTX *frame = talloc_stackframe();
 	NTSTATUS status;
 
 	*ppdesc = NULL;
 
-	DEBUG(10,("posix_get_nt_acl: called for file %s\n", name ));
+	DEBUG(10,("posix_get_nt_acl: called for file %s\n",
+		smb_fname_in->base_name ));
 
-	ZERO_STRUCT(smb_fname);
-	smb_fname.base_name = discard_const_p(char, name);
+	smb_fname = cp_smb_filename(talloc_tos(), smb_fname_in);
+	if (smb_fname == NULL) {
+		TALLOC_FREE(frame);
+		return NT_STATUS_NO_MEMORY;
+	}
 
 	/* Get the stat struct for the owner info. */
 	if (lp_posix_pathnames()) {
-		ret = SMB_VFS_LSTAT(conn, &smb_fname);
+		ret = SMB_VFS_LSTAT(conn, smb_fname);
 	} else {
-		ret = SMB_VFS_STAT(conn, &smb_fname);
+		ret = SMB_VFS_STAT(conn, smb_fname);
 	}
 
 	if (ret == -1) {
@@ -3573,22 +3578,27 @@ NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
 	}
 
 	/* Get the ACL from the path. */
-	posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, name,
+	posix_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname->base_name,
 					     SMB_ACL_TYPE_ACCESS, frame);
 
 	/* If it's a directory get the default POSIX ACL. */
-	if(S_ISDIR(smb_fname.st.st_ex_mode)) {
-		def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, name,
+	if(S_ISDIR(smb_fname->st.st_ex_mode)) {
+		def_acl = SMB_VFS_SYS_ACL_GET_FILE(conn, smb_fname->base_name,
 						   SMB_ACL_TYPE_DEFAULT, frame);
 		def_acl = free_empty_sys_acl(conn, def_acl);
 	}
 
-	pal = load_inherited_info(conn, name);
+	pal = load_inherited_info(conn, smb_fname->base_name);
 
-	status = posix_get_nt_acl_common(conn, name, &smb_fname.st, pal,
-					 posix_acl, def_acl, security_info,
-					 mem_ctx,
-					 ppdesc);
+	status = posix_get_nt_acl_common(conn,
+					smb_fname->base_name,
+					&smb_fname->st,
+					pal,
+					posix_acl,
+					def_acl,
+					security_info,
+					mem_ctx,
+					ppdesc);
 	TALLOC_FREE(frame);
 	return status;
 }
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index e1ec063..f9ae4a3 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -751,10 +751,11 @@ SMB_ACL_T free_empty_sys_acl(connection_struct *conn, SMB_ACL_T the_acl);
 NTSTATUS posix_fget_nt_acl(struct files_struct *fsp, uint32_t security_info,
 			   TALLOC_CTX *mem_ctx,
 			   struct security_descriptor **ppdesc);
-NTSTATUS posix_get_nt_acl(struct connection_struct *conn, const char *name,
-			  uint32_t security_info,
-			  TALLOC_CTX *mem_ctx,
-			  struct security_descriptor **ppdesc);
+NTSTATUS posix_get_nt_acl(struct connection_struct *conn,
+			const struct smb_filename *smb_fname_in,
+			uint32_t security_info,
+			TALLOC_CTX *mem_ctx,
+			struct security_descriptor **ppdesc);
 NTSTATUS try_chown(files_struct *fsp, uid_t uid, gid_t gid);
 NTSTATUS set_nt_acl(files_struct *fsp, uint32_t security_info_sent, const struct security_descriptor *psd);
 int get_acl_group_bits( connection_struct *conn, const char *fname, mode_t *mode );
diff --git a/source3/smbd/reply.c b/source3/smbd/reply.c
index b88c2cf..c18eb38 100644
--- a/source3/smbd/reply.c
+++ b/source3/smbd/reply.c
@@ -6808,7 +6808,7 @@ NTSTATUS rename_internals_fsp(connection_struct *conn,
 			  smb_fname_str_dbg(smb_fname_dst)));
 
 		if (!fsp->is_directory &&
-		    !lp_posix_pathnames() &&
+		    !(fsp->posix_flags & FSP_POSIX_FLAGS_PATHNAMES) &&
 		    (lp_map_archive(SNUM(conn)) ||
 		    lp_store_dos_attributes(SNUM(conn)))) {
 			/* We must set the archive bit on the newly
diff --git a/tests/oldquotas.c b/tests/oldquotas.c
index bdb2beb..0aacf23 100644
--- a/tests/oldquotas.c
+++ b/tests/oldquotas.c
@@ -8,11 +8,11 @@
 /* just a quick hack because sysquotas.h is included before linux/quota.h */
 #ifdef QUOTABLOCK_SIZE
 #undef QUOTABLOCK_SIZE
-#endif
+#endif /* defined(QUOTABLOCK_SIZE) */
 
 #ifdef WITH_QUOTAS
 
-#if defined(VXFS_QUOTA)
+#if defined(VXFS_QUOTA) /* Veritas VxFS for Solaris 2 */
 
 bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize,
 		      uint64_t *dfree, uint64_t *dsize);
@@ -23,16 +23,16 @@ bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize,
 
 #include <fcntl.h>
 #include <sys/param.h>
-#if defined(SUNOS5)
+#if defined(SUNOS5) /* Solaris */
 #include <sys/fs/ufs_quota.h>
 #include <sys/mnttab.h>
 #include <sys/mntent.h>
-#else /* defined(SUNOS4) */
+#else /* SunOS4 */
 #include <ufs/quota.h>
 #include <mntent.h>
-#endif
+#endif /* Solaris */
 
-#if defined(SUNOS5)
+#if defined(SUNOS5) /* Solaris */
 
 /****************************************************************************
  Allows querying of remote hosts for quotas on NFS mounted shares.
@@ -53,7 +53,7 @@ static bool nfs_quotas(char *nfspath, uid_t euser_id, uint64_t *bsize,
 	clnt = clnt_create("host", RQUOTAPROG, RQUOTAVERS, "udp");
 	return true;
 }
-#endif
+#endif /* Solaris */
 
 /****************************************************************************
 try to get the disk space from disk quotas (SunOS & Solaris2 version)
@@ -64,29 +64,29 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree,
 		 uint64_t *dsize)
 {
 	int ret;
-#if defined(SUNOS5)
+#if defined(SUNOS5) /* Solaris */
 	struct quotctl command;
 #else /* SunOS4 */
 	struct mntent *mnt;
-#endif
-#if defined(SUNOS5)
+#endif /* Solaris */
+#if defined(SUNOS5) /* Solaris */
 	nfs_quotas("", 0, bsize, dfree, dsize);
 
 	command.op = Q_GETQUOTA;
 	command.uid = 0;
 	command.addr = NULL;
 	ret = ioctl(1, Q_QUOTACTL, &command);
-#else
+#else /* SunOS4 */
 	ret = quotactl(Q_GETQUOTA, "", 0, NULL);
-#endif
+#endif /* Solaris */
 
-#if defined(SUNOS5) && defined(VXFS_QUOTA)
+#if defined(SUNOS5) && defined(VXFS_QUOTA) /* Solaris 2 VxFS */
 	disk_quotas_vxfs("", path, bsize, dfree, dsize);
-#endif
+#endif /* Solaris 2 VxFS */
 	return true;
 }
 
-#else
+#else /* not SunOS / Solaris */
 
 #if AIX
 /* AIX quota patch from Ole Holm Nielsen <ohnielse at fysik.dtu.dk> */
@@ -99,10 +99,10 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree,
 #include <sys/statfs.h>
 #include <sys/vmount.h>
 #endif /* AIX 5.3 */
-#else  /* !AIX */
+#else  /* !AIX - HP-UX */
 #include <sys/quota.h>
 #include <devnm.h>
-#endif
+#endif /* AIX */
 
 /****************************************************************************
 try to get the disk space from disk quotas - default version
@@ -124,9 +124,9 @@ bool disk_quotas(const char *path, uint64_t *bsize, uint64_t *dfree,
 	return (true);
 }
 
-#endif
+#endif /* SunOS / Solaris */
 
-#if defined(VXFS_QUOTA)
+#if defined(VXFS_QUOTA) /* Veritas for Solaris 2 */
 
 #if defined(SUNOS5)
 
@@ -155,7 +155,7 @@ bool disk_quotas_vxfs(const char *name, char *path, uint64_t *bsize,
 	return true;
 }
 
-#endif /* SUNOS5 || ... */
+#endif /* SUNOS5 */
 
 #endif /* VXFS_QUOTA */
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list