[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Mar 31 19:33:02 UTC 2020


The branch, master has been updated
       via  9edd7268b6d smbd: remove struct privilege_paths
      from  89041a6d18a lib ldb: lmdb clear stale readers on write txn start

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


- Log -----------------------------------------------------------------
commit 9edd7268b6da23ade527d02dde5820782f51a237
Author: Ralph Boehme <slow at samba.org>
Date:   Mon Mar 30 08:06:10 2020 +0200

    smbd: remove struct privilege_paths
    
    The last user of this had been removed by
    d485c43cc74c5550d151fe728ddc53b02ab23df8.
    
    Signed-off-by: Ralph Boehme <slow 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 31 19:32:12 UTC 2020 on sn-devel-184

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

Summary of changes:
 source3/include/vfs.h  |  7 -------
 source3/smbd/process.c |  1 -
 source3/smbd/smbd.h    |  9 ---------
 source3/smbd/vfs.c     | 42 ++++++++++++++++--------------------------
 4 files changed, 16 insertions(+), 43 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index eae9f97179f..fe315673823 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -543,7 +543,6 @@ typedef struct connection_struct {
 } connection_struct;
 
 struct smbd_smb2_request;
-struct privilege_paths;
 struct referral;
 
 struct smb_request {
@@ -600,12 +599,6 @@ struct smb_request {
 	 */
 	struct smbd_smb2_request *smb2req;
 
-	/*
-	 * Pathnames used if request done
-	 * under privilege.
-	 */
-	struct privilege_paths *priv_paths;
-
 	/*
 	 * Request list for chained requests, we're part of it.
 	 */
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index 8ffe3555637..955f13938b4 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -632,7 +632,6 @@ static bool init_smb_request(struct smb_request *req,
 	}
 	req->chain_fsp = NULL;
 	req->smb2req = NULL;
-	req->priv_paths = NULL;
 	req->chain = NULL;
 	req->posix_pathnames = lp_posix_pathnames();
 	smb_init_perfcount_data(&req->pcd);
diff --git a/source3/smbd/smbd.h b/source3/smbd/smbd.h
index 4c13239c793..787582850db 100644
--- a/source3/smbd/smbd.h
+++ b/source3/smbd/smbd.h
@@ -26,15 +26,6 @@ struct dptr_struct;
 #include "smbd/proto.h"
 #include "locking/proto.h"
 
-/*
- * Pathnames used if request done
- * under privilege.
- */
-struct privilege_paths {
-	struct smb_filename parent_name;
-	struct smb_filename file_name;
-};
-
 struct trans_state {
 	struct trans_state *next, *prev;
 	uint64_t vuid; /* SMB2 compat */
diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c
index 9e0d14cd57a..f99c12f0451 100644
--- a/source3/smbd/vfs.c
+++ b/source3/smbd/vfs.c
@@ -1025,36 +1025,29 @@ NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
 	struct smb_filename *resolved_fname = NULL;
 	struct smb_filename *saved_dir_fname = NULL;
 	struct smb_filename *smb_fname_cwd = NULL;
-	struct privilege_paths *priv_paths = NULL;
 	int ret;
+	struct smb_filename parent_name = { 0 };
+	struct smb_filename file_name = { 0 };
 
 	DEBUG(3,("check_reduced_name_with_privilege [%s] [%s]\n",
 			smb_fname->base_name,
 			conn->connectpath));
 
 
-	priv_paths = talloc_zero(smbreq, struct privilege_paths);
-	if (!priv_paths) {
-		status = NT_STATUS_NO_MEMORY;
-		goto err;
-	}
-
 	if (!parent_dirname(ctx, smb_fname->base_name,
 			&dir_name, &last_component)) {
 		status = NT_STATUS_NO_MEMORY;
 		goto err;
 	}
 
-	priv_paths->parent_name.base_name = talloc_strdup(priv_paths, dir_name);
-	priv_paths->file_name.base_name = talloc_strdup(priv_paths, last_component);
-
-	if (priv_paths->parent_name.base_name == NULL ||
-			priv_paths->file_name.base_name == NULL) {
+	parent_name.base_name = dir_name;
+	file_name.base_name = talloc_strdup(ctx, last_component);
+	if (file_name.base_name == NULL) {
 		status = NT_STATUS_NO_MEMORY;
 		goto err;
 	}
 
-	if (SMB_VFS_STAT(conn, &priv_paths->parent_name) != 0) {
+	if (SMB_VFS_STAT(conn, &parent_name) != 0) {
 		status = map_nt_error_from_unix(errno);
 		goto err;
 	}
@@ -1065,7 +1058,7 @@ NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
 		goto err;
 	}
 
-	if (vfs_ChDir(conn, &priv_paths->parent_name) == -1) {
+	if (vfs_ChDir(conn, &parent_name) == -1) {
 		status = map_nt_error_from_unix(errno);
 		goto err;
 	}
@@ -1092,7 +1085,7 @@ NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
 	}
 
 	DEBUG(10,("check_reduced_name_with_privilege: realpath [%s] -> [%s]\n",
-		priv_paths->parent_name.base_name,
+		parent_name.base_name,
 		resolved_name));
 
 	/* Now check the stat value is the same. */
@@ -1102,11 +1095,11 @@ NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
 	}
 
 	/* Ensure we're pointing at the same place. */
-	if (!check_same_stat(&smb_fname_cwd->st, &priv_paths->parent_name.st)) {
+	if (!check_same_stat(&smb_fname_cwd->st, &parent_name.st)) {
 		DEBUG(0,("check_reduced_name_with_privilege: "
 			"device/inode/uid/gid on directory %s changed. "
 			"Denying access !\n",
-			priv_paths->parent_name.base_name));
+			parent_name.base_name));
 		status = NT_STATUS_ACCESS_DENIED;
 		goto err;
 	}
@@ -1153,30 +1146,30 @@ NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
 	/* Now ensure that the last component either doesn't
 	   exist, or is *NOT* a symlink. */
 
-	ret = SMB_VFS_LSTAT(conn, &priv_paths->file_name);
+	ret = SMB_VFS_LSTAT(conn, &file_name);
 	if (ret == -1) {
 		/* Errno must be ENOENT for this be ok. */
 		if (errno != ENOENT) {
 			status = map_nt_error_from_unix(errno);
 			DEBUG(2, ("check_reduced_name_with_privilege: "
 				"LSTAT on %s failed with %s\n",
-				priv_paths->file_name.base_name,
+				file_name.base_name,
 				nt_errstr(status)));
 			goto err;
 		}
 	}
 
-	if (VALID_STAT(priv_paths->file_name.st) &&
-			S_ISLNK(priv_paths->file_name.st.st_ex_mode)) {
+	if (VALID_STAT(file_name.st) &&
+	    S_ISLNK(file_name.st.st_ex_mode))
+	{
 		DEBUG(2, ("check_reduced_name_with_privilege: "
 			"Last component %s is a symlink. Denying"
 			"access.\n",
-			priv_paths->file_name.base_name));
+			file_name.base_name));
 		status = NT_STATUS_ACCESS_DENIED;
 		goto err;
 	}
 
-	smbreq->priv_paths = priv_paths;
 	status = NT_STATUS_OK;
 
   err:
@@ -1186,9 +1179,6 @@ NTSTATUS check_reduced_name_with_privilege(connection_struct *conn,
 		TALLOC_FREE(saved_dir_fname);
 	}
 	TALLOC_FREE(resolved_fname);
-	if (!NT_STATUS_IS_OK(status)) {
-		TALLOC_FREE(priv_paths);
-	}
 	TALLOC_FREE(dir_name);
 	return status;
 }


-- 
Samba Shared Repository



More information about the samba-cvs mailing list