[SCM] Samba Shared Repository - branch master updated

Noel Power npower at samba.org
Fri Jun 11 10:18:01 UTC 2021


The branch, master has been updated
       via  4f20d310af2 s3: smbd: Remove erroneous TALLOC_FREE(smb_fname_parent) in change_file_owner_to_parent() error path.
       via  f4f1206c75e VFX: vxfs: Fixup some warnings
       via  748189b29c5 VFS: vxfs: ifdef out vxfs_sys_acl_set_fd
       via  0f5c6c0aa01 s3/smbd: Remove unecessary 'else' block
       via  eb8d1265dc0 s3/smbd: dos_mode_check_compressed: remove smb_fname, conn fn parms
       via  77f15f58349 s3/smbd: dos_mode_post: remove smb_fname param
       via  34a6ed2136c s3/smbd: call dos_mode_post with fsp
       via  72ace149f96 s3: smbd: Protect dos_mode_at_send() from running into a symlink.
      from  4152499652c pytests: add dns_aging, embracing and extending ageing tests

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


- Log -----------------------------------------------------------------
commit 4f20d310af2bb1f96dea4810a7130492cc4cfc55
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Jun 9 12:22:26 2021 -0700

    s3: smbd: Remove erroneous TALLOC_FREE(smb_fname_parent) in change_file_owner_to_parent() error path.
    
    Caller is still using this !
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14736
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Noel Power<npower at samba.org>
    
    Autobuild-User(master): Noel Power <npower at samba.org>
    Autobuild-Date(master): Fri Jun 11 10:17:46 UTC 2021 on sn-devel-184

commit f4f1206c75ea0b3da513e9a11012f693780ff486
Author: Noel Power <noel.power at suse.com>
Date:   Wed Jun 9 14:58:41 2021 +0100

    VFX: vxfs: Fixup some warnings
    
    ../../source3/modules/vfs_vxfs.c:343:6: error: unused variable ‘i’ [-Werror=unused-variable]
      int i, offset = 0;
          ^
    ../../source3/modules/vfs_vxfs.c:342:17: error: unused variable ‘n_id’ [-Werror=unused-variable]
      uint32_t e_id, n_id;
                     ^~~~
    ../../source3/modules/vfs_vxfs.c:342:11: error: unused variable ‘e_id’ [-Werror=unused-variable]
      uint32_t e_id, n_id;
               ^~~~
    ../../source3/modules/vfs_vxfs.c:341:35: error: unused variable ‘n_perm’ [-Werror=unused-variable]
      uint16_t e_type, n_type, e_perm, n_perm;
                                       ^~~~~~
    ../../source3/modules/vfs_vxfs.c:341:27: error: unused variable ‘e_perm’ [-Werror=unused-variable]
      uint16_t e_type, n_type, e_perm, n_perm;
                               ^~~~~~
    ../../source3/modules/vfs_vxfs.c: In function ‘vxfs_compare’:
    ../../source3/modules/vfs_vxfs.c:407:6: error: unused variable ‘i’ [-Werror=unused-variable]
      int i, count = 0;
          ^
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 748189b29c58cebe70e16ee82a7dfd2ace1955b9
Author: Noel Power <noel.power at suse.com>
Date:   Thu Jun 10 14:52:04 2021 +0100

    VFS: vxfs: ifdef out vxfs_sys_acl_set_fd
    
    as the sys_acl_set_fd_fn definition for vxfs_sys_acl_set_fd is ifdef'ed
    out we also need ifdef out the vxfs_sys_acl_set_fd implementation itself
    otherwise we get the following error.
    
    source3/modules/vfs_vxfs.c:484:12: error: ‘vxfs_sys_acl_set_fd’ defined but not used [-Werror=unused-function]
     static int vxfs_sys_acl_set_fd(vfs_handle_struct *handle,
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 0f5c6c0aa01245276d8d399269576f5296e00f36
Author: Noel Power <noel.power at suse.com>
Date:   Thu Jun 10 14:11:03 2021 +0100

    s3/smbd: Remove unecessary 'else' block
    
    This is an inconsequential cosmetic change, it just caught my eye
    as looking a bit out of place compared to the surrounding code style.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit eb8d1265dc053086e9fb802eec0f91dff2ee6aee
Author: Noel Power <noel.power at suse.com>
Date:   Thu Jun 10 11:32:06 2021 +0100

    s3/smbd: dos_mode_check_compressed: remove smb_fname, conn fn parms
    
    smb_fname is unused and we can get conn from the fsp passed in
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 77f15f58349b53ad21802a2e4c61fdc57c5fc7fc
Author: Noel Power <noel.power at suse.com>
Date:   Thu Jun 10 10:04:39 2021 +0100

    s3/smbd: dos_mode_post: remove smb_fname param
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org

commit 34a6ed2136c08d2465c72e68121501a46fd7d1e6
Author: Noel Power <noel.power at suse.com>
Date:   Thu Jun 10 09:45:02 2021 +0100

    s3/smbd: call dos_mode_post with fsp
    
    Next commit can remove smb_name param from dos_mode_post
    signature.
    
    Signed-off-by: Noel Power <noel.power at suse.com>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 72ace149f96cf98c2ea68f93306b5b50228f6e65
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Jun 10 10:30:17 2021 -0700

    s3: smbd: Protect dos_mode_at_send() from running into a symlink.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Noel Power<npower at samba.org>

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

Summary of changes:
 source3/modules/vfs_vxfs.c |  9 +++++----
 source3/smbd/dosmode.c     | 36 ++++++++++++++++++++++--------------
 source3/smbd/open.c        |  5 +----
 3 files changed, 28 insertions(+), 22 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_vxfs.c b/source3/modules/vfs_vxfs.c
index 0c2d01edd41..9390e96a9d1 100644
--- a/source3/modules/vfs_vxfs.c
+++ b/source3/modules/vfs_vxfs.c
@@ -338,9 +338,8 @@ static char * vxfs_compact_buf(char *e_buf, int *new_count, int count,
 static bool vxfs_compare_acls(char *e_buf, char *n_buf, int n_count,
 			      int e_count) {
 
-	uint16_t e_type, n_type, e_perm, n_perm;
-	uint32_t e_id, n_id;
-	int i, offset = 0;
+	uint16_t e_type, n_type;
+	int offset = 0;
 
 	if (!e_buf && !n_buf) {
 		DEBUG(10, ("vfs_vxfs: Empty buffers!\n"));
@@ -404,7 +403,7 @@ static bool vxfs_compare(struct files_struct *fsp,
 {
 	SMB_ACL_T existing_acl = NULL;
 	bool ret = false;
-	int i, count = 0;
+	int count = 0;
 	TALLOC_CTX *mem_ctx = talloc_tos();
 	char *existing_buf = NULL, *new_buf = NULL, *compact_buf = NULL;
 	int status;
@@ -481,6 +480,7 @@ out:
 	return ret;
 }
 
+#ifdef VXFS_ACL_SHARE
 static int vxfs_sys_acl_set_fd(vfs_handle_struct *handle,
 			       struct files_struct *fsp,
 			       SMB_ACL_TYPE_T type,
@@ -493,6 +493,7 @@ static int vxfs_sys_acl_set_fd(vfs_handle_struct *handle,
 
 	return SMB_VFS_NEXT_SYS_ACL_SET_FD(handle, fsp, type, theacl);
 }
+#endif
 
 static int vxfs_fset_xattr(struct vfs_handle_struct *handle,
 			   struct files_struct *fsp, const char *name,
diff --git a/source3/smbd/dosmode.c b/source3/smbd/dosmode.c
index c4c8be0b722..43c46867122 100644
--- a/source3/smbd/dosmode.c
+++ b/source3/smbd/dosmode.c
@@ -612,9 +612,7 @@ uint32_t dos_mode_msdfs(connection_struct *conn,
 /*
  * check whether a file or directory is flagged as compressed.
  */
-static NTSTATUS dos_mode_check_compressed(connection_struct *conn,
-					  struct files_struct *fsp,
-					  struct smb_filename *smb_fname,
+static NTSTATUS dos_mode_check_compressed(struct files_struct *fsp,
 					  bool *is_compressed)
 {
 	NTSTATUS status;
@@ -625,7 +623,7 @@ static NTSTATUS dos_mode_check_compressed(connection_struct *conn,
 		goto err_out;
 	}
 
-	status = SMB_VFS_FGET_COMPRESSION(conn, tmp_ctx, fsp,
+	status = SMB_VFS_FGET_COMPRESSION(fsp->conn, tmp_ctx, fsp,
 					 &compression_fmt);
 	if (!NT_STATUS_IS_OK(status)) {
 		goto err_ctx_free;
@@ -679,11 +677,10 @@ static uint32_t dos_mode_from_name(connection_struct *conn,
 }
 
 static uint32_t dos_mode_post(uint32_t dosmode,
-			      connection_struct *conn,
 			      struct files_struct *fsp,
-			      struct smb_filename *smb_fname,
 			      const char *func)
 {
+	struct smb_filename *smb_fname = NULL;
 	NTSTATUS status;
 
 	if (fsp != NULL) {
@@ -708,17 +705,16 @@ static uint32_t dos_mode_post(uint32_t dosmode,
 		dosmode &= ~(FILE_ATTRIBUTE_DIRECTORY);
 	}
 
-	if (conn->fs_capabilities & FILE_FILE_COMPRESSION) {
+	if (fsp->conn->fs_capabilities & FILE_FILE_COMPRESSION) {
 		bool compressed = false;
 
-		status = dos_mode_check_compressed(conn, fsp, smb_fname,
-						   &compressed);
+		status = dos_mode_check_compressed(fsp, &compressed);
 		if (NT_STATUS_IS_OK(status) && compressed) {
 			dosmode |= FILE_ATTRIBUTE_COMPRESSED;
 		}
 	}
 
-	dosmode |= dos_mode_from_name(conn, smb_fname, dosmode);
+	dosmode |= dos_mode_from_name(fsp->conn, smb_fname, dosmode);
 
 	if (S_ISDIR(smb_fname->st.st_ex_mode)) {
 		dosmode |= FILE_ATTRIBUTE_DIRECTORY;
@@ -778,7 +774,7 @@ uint32_t fdos_mode(struct files_struct *fsp)
 		}
 	}
 
-	result = dos_mode_post(result, fsp->conn, fsp, NULL, __func__);
+	result = dos_mode_post(result, fsp, __func__);
 	return result;
 }
 
@@ -817,6 +813,20 @@ struct tevent_req *dos_mode_at_send(TALLOC_CTX *mem_ctx,
 		return tevent_req_post(req, ev);
 	}
 
+	if (smb_fname->fsp == NULL) {
+		/*
+		 * The pathological case where a caller does
+		 * dos_mode_at_send() and smb_fname points at a
+		 * symlink in POSIX context. smb_fname->fsp is NULL.
+		 *
+		 * FIXME ? Should we move to returning
+		 * FILE_ATTRIBUTE_REPARSE_POINT here ?
+		 */
+		state->dosmode = FILE_ATTRIBUTE_NORMAL;
+		tevent_req_done(req);
+		return tevent_req_post(req, ev);
+	}
+
 	subreq = SMB_VFS_GET_DOS_ATTRIBUTES_SEND(state,
 						 ev,
 						 dir_fsp,
@@ -876,9 +886,7 @@ static void dos_mode_at_vfs_get_dosmode_done(struct tevent_req *subreq)
 	}
 	if (NT_STATUS_IS_OK(status)) {
 		state->dosmode = dos_mode_post(state->dosmode,
-					       state->dir_fsp->conn,
-					       NULL,
-					       state->smb_fname,
+					       state->smb_fname->fsp,
 					       __func__);
 		tevent_req_done(req);
 		return;
diff --git a/source3/smbd/open.c b/source3/smbd/open.c
index 101757666fe..3e48a9f35de 100644
--- a/source3/smbd/open.c
+++ b/source3/smbd/open.c
@@ -951,7 +951,6 @@ void change_file_owner_to_parent(connection_struct *conn,
 			 "directory %s. Error was %s\n",
 			 smb_fname_str_dbg(smb_fname_parent),
 			 strerror(errno)));
-		TALLOC_FREE(smb_fname_parent);
 		return;
 	}
 
@@ -961,7 +960,6 @@ void change_file_owner_to_parent(connection_struct *conn,
 			"is already owned by uid %d\n",
 			fsp_str_dbg(fsp),
 			(int)fsp->fsp_name->st.st_ex_uid ));
-		TALLOC_FREE(smb_fname_parent);
 		return;
 	}
 
@@ -3613,9 +3611,8 @@ static NTSTATUS open_file_ntcreate(connection_struct *conn,
 					 smb_fname_str_dbg(smb_fname)));
 				if (S_ISDIR(smb_fname->st.st_ex_mode)) {
 					return NT_STATUS_FILE_IS_A_DIRECTORY;
-				} else {
-					return NT_STATUS_OBJECT_NAME_COLLISION;
 				}
+				return NT_STATUS_OBJECT_NAME_COLLISION;
 			}
 			break;
 


-- 
Samba Shared Repository



More information about the samba-cvs mailing list