[SCM] Samba Shared Repository - branch master updated

Ralph Böhme slow at samba.org
Thu Jan 28 08:11:01 UTC 2021


The branch, master has been updated
       via  b324626a3c3 VFS: unityed_media: Fixup um_symlinkat() to correctly use the dirfsp path.
       via  4e9bb2d760a VFS: time_audit: Fixup smb_time_audit_symlinkat() to log the dirfsp path.
       via  1ede5601a34 VFS: syncops: SMB_VFS_SYMLINKAT only changes one directory so we can use the SYNCOPS_NEXT_SMB_FNAME macro directly.
       via  ec27c4c44d1 VFS: shadow_copy2: Fixup shadow_copy2_symlinkat() to correctly use the dirfsp path.
       via  e4a3633694b VFS: media_harmony: Fixup mh_symlinkat() to correctly use the dirfsp path.
       via  50205189d80 VFS: full_audit: Fixup smb_full_audit_symlinkat() to log the dirfsp path.
       via  bc6aa4ed400 VFS: cap: Fixup cap_symlinkat() to cope with translating dirfsp path.
       via  e4c8cd0781a smbd: In conn_force_tdis_done() when forcing a connection closed force a full reload of services.
      from  1e47c04aade clitar: restore mtime on files

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


- Log -----------------------------------------------------------------
commit b324626a3c3eff7573712da02a02358b0bb63287
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Jan 25 13:29:57 2021 -0800

    VFS: unityed_media: Fixup um_symlinkat() to correctly use the dirfsp path.
    
    Missed in my original fixes.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>
    
    Autobuild-User(master): Ralph Böhme <slow at samba.org>
    Autobuild-Date(master): Thu Jan 28 08:10:18 UTC 2021 on sn-devel-184

commit 4e9bb2d760a3bde81a1bd2ffcb052381e72c6635
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Jan 25 12:48:28 2021 -0800

    VFS: time_audit: Fixup smb_time_audit_symlinkat() to log the dirfsp path.
    
    Missed in my original fixes.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 1ede5601a34b945a5e1a0114539278ccc1086e62
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Jan 25 12:46:16 2021 -0800

    VFS: syncops: SMB_VFS_SYMLINKAT only changes one directory so we can use the SYNCOPS_NEXT_SMB_FNAME macro directly.
    
    Missed in my original fixes.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit ec27c4c44d1e9035639e033689fa739518f17132
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Jan 25 12:30:17 2021 -0800

    VFS: shadow_copy2: Fixup shadow_copy2_symlinkat() to correctly use the dirfsp path.
    
    Missed in my original fixes.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit e4a3633694ba1b61fa21ca0cc3174c8a3981bdb7
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Jan 25 12:26:14 2021 -0800

    VFS: media_harmony: Fixup mh_symlinkat() to correctly use the dirfsp path.
    
    Missed in my original fixes.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit 50205189d80f7dd963e09c53521d7d2b5d692263
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Jan 25 12:02:48 2021 -0800

    VFS: full_audit: Fixup smb_full_audit_symlinkat() to log the dirfsp path.
    
    Missed in my original fixes.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit bc6aa4ed40020ff964cf39a40ab4121bbc403e19
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Jan 25 11:17:57 2021 -0800

    VFS: cap: Fixup cap_symlinkat() to cope with translating dirfsp path.
    
    Missed in my original fixes.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

commit e4c8cd0781aef2a29bb4db1314c9fcd4f6edcecd
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jan 26 21:29:58 2021 -0800

    smbd: In conn_force_tdis_done() when forcing a connection closed force a full reload of services.
    
    Prevents reload_services() caching the fact it might be
    called multiple times in a row.
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=14604
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Boehme <slow at samba.org>

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

Summary of changes:
 source3/modules/vfs_cap.c           | 22 ++++++++++++++++++++--
 source3/modules/vfs_full_audit.c    | 12 +++++++++++-
 source3/modules/vfs_media_harmony.c | 17 ++++++++++++++---
 source3/modules/vfs_shadow_copy2.c  | 13 ++++++++++++-
 source3/modules/vfs_syncops.c       | 21 +++++----------------
 source3/modules/vfs_time_audit.c    | 12 +++++++++++-
 source3/modules/vfs_unityed_media.c | 16 +++++++++++++---
 source3/smbd/conn_idle.c            | 10 +++++++++-
 8 files changed, 95 insertions(+), 28 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index 3593ef589d8..597e0293fd3 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -464,8 +464,9 @@ static int cap_symlinkat(vfs_handle_struct *handle,
 			struct files_struct *dirfsp,
 			const struct smb_filename *new_smb_fname)
 {
+	struct smb_filename *full_fname = NULL;
 	char *capold = capencode(talloc_tos(), link_contents->base_name);
-	char *capnew = capencode(talloc_tos(), new_smb_fname->base_name);
+	char *capnew = NULL;
 	struct smb_filename *new_link_target = NULL;
 	struct smb_filename *new_cap_smb_fname = NULL;
 	int saved_errno = 0;
@@ -476,6 +477,20 @@ static int cap_symlinkat(vfs_handle_struct *handle,
 		return -1;
 	}
 
+	full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+						dirfsp,
+						new_smb_fname);
+	if (full_fname == NULL) {
+		return -1;
+	}
+
+	capnew = capencode(talloc_tos(), full_fname->base_name);
+	if (!capnew) {
+		TALLOC_FREE(full_fname);
+		errno = ENOMEM;
+		return -1;
+	}
+
 	new_link_target = synthetic_smb_fname(talloc_tos(),
 					      capold,
 					      NULL,
@@ -483,6 +498,7 @@ static int cap_symlinkat(vfs_handle_struct *handle,
 					      new_smb_fname->twrp,
 					      new_smb_fname->flags);
 	if (new_link_target == NULL) {
+		TALLOC_FREE(full_fname);
 		TALLOC_FREE(capold);
 		TALLOC_FREE(capnew);
 		errno = ENOMEM;
@@ -496,6 +512,7 @@ static int cap_symlinkat(vfs_handle_struct *handle,
 					new_smb_fname->twrp,
 					new_smb_fname->flags);
 	if (new_cap_smb_fname == NULL) {
+		TALLOC_FREE(full_fname);
 		TALLOC_FREE(capold);
 		TALLOC_FREE(capnew);
 		TALLOC_FREE(new_link_target);
@@ -504,11 +521,12 @@ static int cap_symlinkat(vfs_handle_struct *handle,
 	}
 	ret = SMB_VFS_NEXT_SYMLINKAT(handle,
 			new_link_target,
-			dirfsp,
+			handle->conn->cwd_fsp,
 			new_cap_smb_fname);
 	if (ret == -1) {
 		saved_errno = errno;
 	}
+	TALLOC_FREE(full_fname);
 	TALLOC_FREE(capold);
 	TALLOC_FREE(capnew);
 	TALLOC_FREE(new_link_target);
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 9e1df735468..82ad6368a49 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -1804,8 +1804,16 @@ static int smb_full_audit_symlinkat(vfs_handle_struct *handle,
 			struct files_struct *dirfsp,
 			const struct smb_filename *new_smb_fname)
 {
+	struct smb_filename *full_fname = NULL;
 	int result;
 
+	full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+						dirfsp,
+						new_smb_fname);
+	if (full_fname == NULL) {
+		return -1;
+	}
+
 	result = SMB_VFS_NEXT_SYMLINKAT(handle,
 				link_contents,
 				dirfsp,
@@ -1816,7 +1824,9 @@ static int smb_full_audit_symlinkat(vfs_handle_struct *handle,
 	       handle,
 	       "%s|%s",
 	       link_contents->base_name,
-	       smb_fname_str_do_log(handle->conn, new_smb_fname));
+	       smb_fname_str_do_log(handle->conn, full_fname));
+
+	TALLOC_FREE(full_fname);
 
 	return result;
 }
diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c
index 40eb81c677b..ecf8b49ccf3 100644
--- a/source3/modules/vfs_media_harmony.c
+++ b/source3/modules/vfs_media_harmony.c
@@ -1613,12 +1613,22 @@ static int mh_symlinkat(vfs_handle_struct *handle,
 		const struct smb_filename *new_smb_fname)
 {
 	int status = -1;
+	struct smb_filename *full_fname = NULL;
 	struct smb_filename *new_link_target = NULL;
 	struct smb_filename *newclientFname = NULL;
 
 	DEBUG(MH_INFO_DEBUG, ("Entering mh_symlinkat\n"));
+
+	full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+						dirfsp,
+						new_smb_fname);
+	if (full_fname == NULL) {
+		status = -1;
+		goto err;
+	}
+
 	if (!is_in_media_files(link_contents->base_name) &&
-			!is_in_media_files(new_smb_fname->base_name)) {
+			!is_in_media_files(full_fname->base_name)) {
 		status = SMB_VFS_NEXT_SYMLINKAT(handle,
 				link_contents,
 				dirfsp,
@@ -1632,19 +1642,20 @@ static int mh_symlinkat(vfs_handle_struct *handle,
 		goto err;
 	}
 	if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
-				new_smb_fname,
+				full_fname,
 				&newclientFname))) {
 		goto err;
 	}
 
 	status = SMB_VFS_NEXT_SYMLINKAT(handle,
 				new_link_target,
-				dirfsp,
+				handle->conn->cwd_fsp,
 				newclientFname);
 err:
 	TALLOC_FREE(new_link_target);
 	TALLOC_FREE(newclientFname);
 out:
+	TALLOC_FREE(full_fname);
 	return status;
 }
 
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index 174f246bdad..ae8afec11b1 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -1076,6 +1076,7 @@ static int shadow_copy2_symlinkat(vfs_handle_struct *handle,
 			struct files_struct *dirfsp,
 			const struct smb_filename *new_smb_fname)
 {
+	struct smb_filename *full_fname = NULL;
 	time_t timestamp_old = 0;
 	time_t timestamp_new = 0;
 	char *snappath_old = NULL;
@@ -1090,15 +1091,25 @@ static int shadow_copy2_symlinkat(vfs_handle_struct *handle,
 				NULL)) {
 		return -1;
 	}
+
+	full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+						dirfsp,
+						new_smb_fname);
+	if (full_fname == NULL) {
+		return -1;
+	}
+
 	if (!shadow_copy2_strip_snapshot_internal(talloc_tos(),
 				handle,
-				new_smb_fname,
+				full_fname,
 				&timestamp_new,
 				NULL,
 				&snappath_new,
 				NULL)) {
+		TALLOC_FREE(full_fname);
 		return -1;
 	}
+	TALLOC_FREE(full_fname);
 	if ((timestamp_old != 0) || (timestamp_new != 0)) {
 		errno = EROFS;
 		return -1;
diff --git a/source3/modules/vfs_syncops.c b/source3/modules/vfs_syncops.c
index 043304feb3c..9c633456ad1 100644
--- a/source3/modules/vfs_syncops.c
+++ b/source3/modules/vfs_syncops.c
@@ -177,25 +177,14 @@ static int syncops_renameat(vfs_handle_struct *handle,
 static int syncops_symlinkat(vfs_handle_struct *handle,
 			const struct smb_filename *link_contents,
 			struct files_struct *dirfsp,
-			const struct smb_filename *new_smb_fname)
+			const struct smb_filename *smb_fname)
 {
-	int ret;
-	struct syncops_config_data *config;
-
-	SMB_VFS_HANDLE_GET_DATA(handle, config,
-				struct syncops_config_data,
-				return -1);
-
-	ret = SMB_VFS_NEXT_SYMLINKAT(handle,
+	SYNCOPS_NEXT_SMB_FNAME(SYMLINKAT,
+			smb_fname,
+				(handle,
 				link_contents,
 				dirfsp,
-				new_smb_fname);
-
-	if (ret == 0 && config->onmeta && !config->disable) {
-		syncops_two_names(link_contents->base_name,
-				  new_smb_fname->base_name);
-	}
-	return ret;
+				smb_fname));
 }
 
 static int syncops_linkat(vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index cc5039fed7c..fe22197f429 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -1424,10 +1424,19 @@ static int smb_time_audit_symlinkat(vfs_handle_struct *handle,
 				struct files_struct *dirfsp,
 				const struct smb_filename *new_smb_fname)
 {
+	struct smb_filename *full_fname = NULL;
 	int result;
 	struct timespec ts1,ts2;
 	double timediff;
 
+	full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+						dirfsp,
+						new_smb_fname);
+	if (full_fname == NULL) {
+		errno = ENOMEM;
+		return -1;
+	}
+
 	clock_gettime_mono(&ts1);
 	result = SMB_VFS_NEXT_SYMLINKAT(handle,
 				link_contents,
@@ -1438,9 +1447,10 @@ static int smb_time_audit_symlinkat(vfs_handle_struct *handle,
 
 	if (timediff > audit_timeout) {
 		smb_time_audit_log_fname("symlinkat", timediff,
-			new_smb_fname->base_name);
+			full_fname->base_name);
 	}
 
+	TALLOC_FREE(full_fname);
 	return result;
 }
 
diff --git a/source3/modules/vfs_unityed_media.c b/source3/modules/vfs_unityed_media.c
index 9c4f2baf691..7901b2390d7 100644
--- a/source3/modules/vfs_unityed_media.c
+++ b/source3/modules/vfs_unityed_media.c
@@ -1262,11 +1262,20 @@ static int um_symlinkat(vfs_handle_struct *handle,
 	int status;
 	struct smb_filename *new_link_target = NULL;
 	struct smb_filename *new_client_fname = NULL;
+	struct smb_filename *full_fname = NULL;
 
 	DEBUG(10, ("Entering um_symlinkat\n"));
 
+	full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+						dirfsp,
+						new_smb_fname);
+	if (full_fname == NULL) {
+		return -1;
+	}
+
 	if (!is_in_media_files(link_contents->base_name) &&
-			!is_in_media_files(new_smb_fname->base_name)) {
+			!is_in_media_files(full_fname->base_name)) {
+		TALLOC_FREE(full_fname);
 		return SMB_VFS_NEXT_SYMLINKAT(handle,
 				link_contents,
 				dirfsp,
@@ -1279,19 +1288,20 @@ static int um_symlinkat(vfs_handle_struct *handle,
 		goto err;
 	}
 	status = alloc_get_client_smb_fname(handle, talloc_tos(),
-					    new_smb_fname, &new_client_fname);
+					    full_fname, &new_client_fname);
 	if (status != 0) {
 		goto err;
 	}
 
 	status = SMB_VFS_NEXT_SYMLINKAT(handle,
 					new_link_target,
-					dirfsp,
+					handle->conn->cwd_fsp,
 					new_client_fname);
 
 err:
 	TALLOC_FREE(new_link_target);
 	TALLOC_FREE(new_client_fname);
+	TALLOC_FREE(full_fname);
 	return status;
 }
 
diff --git a/source3/smbd/conn_idle.c b/source3/smbd/conn_idle.c
index ca697383877..56a6ef896fb 100644
--- a/source3/smbd/conn_idle.c
+++ b/source3/smbd/conn_idle.c
@@ -273,5 +273,13 @@ static void conn_force_tdis_done(struct tevent_req *req)
 	* uid in the meantime. Ensure we're still root.
 	*/
 	change_to_root_user();
-	reload_services(sconn, conn_snum_used, true);
+	/*
+	 * Use 'false' in the last parameter (test) to force
+	 * a full reload of services. Prevents
+	 * reload_services caching the fact it's
+	 * been called multiple times in a row.
+	 * See BUG: https://bugzilla.samba.org/show_bug.cgi?id=14604
+	 * for details.
+	 */
+	reload_services(sconn, conn_snum_used, false);
 }


-- 
Samba Shared Repository



More information about the samba-cvs mailing list