[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Tue Feb 9 01:16:01 UTC 2021


The branch, master has been updated
       via  7fe39391c05 vfs: update status of SMB_VFS_LINKAT()
       via  6f4a013677d s3: smbd: Change hardlink_internals() to use a real directory fsp for SMB_VFS_LINKAT().
       via  4fd18c27556 s3: smbd: Centralize error exits to an 'out' label in hardlink_internals().
       via  11ea133e73e s3: VFS: syncops: Fix syncops_linkat() to cope with real directory fsps.
       via  a3f6495002d s3: VFS: unityed_media: Fix um_linkat() to cope with real directory fsps.
       via  005cbeae174 s3: VFS: time_audit: Fix smb_time_audit_linkat() to cope with real directory fsps.
       via  035909ec590 s3: VFS: media_harmony: Fix mh_linkat() to cope with real directory fsps.
       via  2952cfe0eda s3: VFS: full_audit: Fix smb_full_audit_linkat() to cope with real directory fsps.
       via  2d6011e8c85 s3: VFS: gluster: Fix vfs_gluster_linkat() to cope with real directory fsps.
       via  ea027e314ab s3: VFS: ceph: Fix cephwrap_linkat() to cope with real directory fsps.
       via  422da56fcb4 s3: VFS: cap: Fix cap_linkat() to cope with real directory fsps.
       via  6aa371b3940 Revert "VFS: shadow_copy2: Fixup shadow_copy2_mknodat() to correctly use the dirfsp path."
       via  557b968b5a3 Revert "VFS: shadow_copy2: Fixup shadow_copy2_symlinkat() to correctly use the dirfsp path."
      from  d6f9172c929 samba-tool: Add a gpo command for removing VGP Files Group Policy

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


- Log -----------------------------------------------------------------
commit 7fe39391c053ecd0cc2acc632498b9b93e9edc2a
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jan 19 12:58:09 2021 -0800

    vfs: update status of SMB_VFS_LINKAT()
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Tue Feb  9 01:15:58 UTC 2021 on sn-devel-184

commit 6f4a013677d499b91a103c4f33d8f200e27e44aa
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jan 19 12:57:51 2021 -0800

    s3: smbd: Change hardlink_internals() to use a real directory fsp for SMB_VFS_LINKAT().
    
    New VFS change.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 4fd18c2755691f1343788d4a87ce000c7d84456f
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jan 19 12:49:40 2021 -0800

    s3: smbd: Centralize error exits to an 'out' label in hardlink_internals().
    
    Makes it easier to add TALLOC_FREE's that are always called.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 11ea133e73e3157ec6fac4629e0438fa3118dbca
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Feb 5 14:19:21 2021 -0800

    s3: VFS: syncops: Fix syncops_linkat() to cope with real directory fsps.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit a3f6495002d8022ee873d599305a4565ff276bc3
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Feb 3 14:45:36 2021 -0800

    s3: VFS: unityed_media: Fix um_linkat() to cope with real directory fsps.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 005cbeae174a94d981c56b73ec616e9598a7efc5
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Feb 3 13:59:00 2021 -0800

    s3: VFS: time_audit: Fix smb_time_audit_linkat() to cope with real directory fsps.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 035909ec590c1bdbfe3f21c5f1a0d47b74e55f17
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Feb 3 12:36:27 2021 -0800

    s3: VFS: media_harmony: Fix mh_linkat() to cope with real directory fsps.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 2952cfe0edaaec44ee1fbd1966fb9a50a9122399
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Feb 1 13:08:46 2021 -0800

    s3: VFS: full_audit: Fix smb_full_audit_linkat() to cope with real directory fsps.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 2d6011e8c85d1cadf7ea951aa76a0dfc64017002
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jan 19 11:54:51 2021 -0800

    s3: VFS: gluster: Fix vfs_gluster_linkat() to cope with real directory fsps.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit ea027e314ab2e9fc62ece7ef77bc9d03942cad70
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Jan 19 11:04:12 2021 -0800

    s3: VFS: ceph: Fix cephwrap_linkat() to cope with real directory fsps.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 422da56fcb49f8c150c9ff068cfcbea1f9ade1a8
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Feb 1 13:04:34 2021 -0800

    s3: VFS: cap: Fix cap_linkat() to cope with real directory fsps.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 6aa371b39406aa93ff7a05737ef5f12f3493d992
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Feb 3 13:55:12 2021 -0800

    Revert "VFS: shadow_copy2: Fixup shadow_copy2_mknodat() to correctly use the dirfsp path."
    
    This isn't needed as the existing code will refuse a new name with
    a non-zero twp in the target name.
    
    This reverts commit 2f74056a916aef9925cae76016378b993560e22b.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

commit 557b968b5a35e91262d65c40db79c81ce79f0d25
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Feb 3 13:52:33 2021 -0800

    Revert "VFS: shadow_copy2: Fixup shadow_copy2_symlinkat() to correctly use the dirfsp path."
    
    This isn't needed as the existing code will refuse a new name with
    a non-zero twp in the target name.
    
    This reverts commit ec27c4c44d1e9035639e033689fa739518f17132.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Ralph Böhme <slow at samba.org>

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

Summary of changes:
 source3/modules/The_New_VFS.org     |  2 +-
 source3/modules/The_New_VFS.txt     |  2 +-
 source3/modules/vfs_cap.c           | 62 ++++++++++++++++++++-------
 source3/modules/vfs_ceph.c          | 30 ++++++++++----
 source3/modules/vfs_full_audit.c    | 22 +++++++++-
 source3/modules/vfs_glusterfs.c     | 26 ++++++++++--
 source3/modules/vfs_media_harmony.c | 36 +++++++++++++---
 source3/modules/vfs_shadow_copy2.c  | 25 +----------
 source3/modules/vfs_syncops.c       | 24 ++++++++---
 source3/modules/vfs_time_audit.c    | 12 +++++-
 source3/modules/vfs_unityed_media.c | 32 +++++++++++---
 source3/smbd/trans2.c               | 83 ++++++++++++++++++++++++++-----------
 12 files changed, 259 insertions(+), 97 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/modules/The_New_VFS.org b/source3/modules/The_New_VFS.org
index ca8ce7dc747..e6e9b155f95 100644
--- a/source3/modules/The_New_VFS.org
+++ b/source3/modules/The_New_VFS.org
@@ -252,7 +252,7 @@ whenever VFS access is done in a piecemeal fashion.
 | SMB_VFS_GETXATTRAT_SEND()         | [[Enum][Enum]]     | -      |
 | SMB_VFS_KERNEL_FLOCK()            | [[fsp][fsp]]      | -      |
 | SMB_VFS_LCHOWN()                  | [[Path][Path]]     | Todo   |
-| SMB_VFS_LINKAT()                  | [[NsC][NsC]]      | Todo   |
+| SMB_VFS_LINKAT()                  | [[NsC][NsC]]      | -      |
 | SMB_VFS_LINUX_SETLEASE()          | [[fsp][fsp]]      | -      |
 | SMB_VFS_LISTXATTR()               | [[Path][Path]]     | Todo   |
 | SMB_VFS_LOCK()                    | [[fsp][fsp]]      | -      |
diff --git a/source3/modules/The_New_VFS.txt b/source3/modules/The_New_VFS.txt
index 93b6d764779..f0a84731810 100644
--- a/source3/modules/The_New_VFS.txt
+++ b/source3/modules/The_New_VFS.txt
@@ -320,7 +320,7 @@ Table of Contents
    SMB_VFS_GETXATTRAT_SEND()          [Enum]      -
    SMB_VFS_KERNEL_FLOCK()             [fsp]       -
    SMB_VFS_LCHOWN()                   [Path]      Todo
-   SMB_VFS_LINKAT()                   [NsC]       Todo
+   SMB_VFS_LINKAT()                   [NsC]       -
    SMB_VFS_LINUX_SETLEASE()           [fsp]       -
    SMB_VFS_LISTXATTR()                [Path]      Todo
    SMB_VFS_LOCK()                     [fsp]       -
diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c
index c2df73a7fe4..0975742598c 100644
--- a/source3/modules/vfs_cap.c
+++ b/source3/modules/vfs_cap.c
@@ -596,17 +596,27 @@ static int cap_linkat(vfs_handle_struct *handle,
 		const struct smb_filename *new_smb_fname,
 		int flags)
 {
-	char *capold = capencode(talloc_tos(), old_smb_fname->base_name);
-	char *capnew = capencode(talloc_tos(), new_smb_fname->base_name);
+	struct smb_filename *old_full_fname = NULL;
+	struct smb_filename *new_full_fname = NULL;
+	char *capold = NULL;
+	char *capnew = NULL;
 	struct smb_filename *old_cap_smb_fname = NULL;
 	struct smb_filename *new_cap_smb_fname = NULL;
 	int saved_errno = 0;
 	int ret;
 
-	if (!capold || !capnew) {
-		errno = ENOMEM;
-		return -1;
+	/* Process 'old' name. */
+	old_full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+						srcfsp,
+						old_smb_fname);
+        if (old_full_fname == NULL) {
+		goto nomem_out;
+        }
+	capold = capencode(talloc_tos(), old_full_fname->base_name);
+	if (capold == NULL) {
+		goto nomem_out;
 	}
+	TALLOC_FREE(old_full_fname);
 	old_cap_smb_fname = synthetic_smb_fname(talloc_tos(),
 					capold,
 					NULL,
@@ -614,11 +624,21 @@ static int cap_linkat(vfs_handle_struct *handle,
 					old_smb_fname->twrp,
 					old_smb_fname->flags);
 	if (old_cap_smb_fname == NULL) {
-		TALLOC_FREE(capold);
-		TALLOC_FREE(capnew);
-		errno = ENOMEM;
-		return -1;
+		goto nomem_out;
+	}
+
+	/* Process 'new' name. */
+	new_full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+						dstfsp,
+						new_smb_fname);
+        if (new_full_fname == NULL) {
+		goto nomem_out;
+        }
+	capnew = capencode(talloc_tos(), new_full_fname->base_name);
+	if (capnew == NULL) {
+		goto nomem_out;
 	}
+	TALLOC_FREE(new_full_fname);
 	new_cap_smb_fname = synthetic_smb_fname(talloc_tos(),
 					capnew,
 					NULL,
@@ -626,21 +646,20 @@ static int cap_linkat(vfs_handle_struct *handle,
 					new_smb_fname->twrp,
 					new_smb_fname->flags);
 	if (new_cap_smb_fname == NULL) {
-		TALLOC_FREE(capold);
-		TALLOC_FREE(capnew);
-		TALLOC_FREE(old_cap_smb_fname);
-		errno = ENOMEM;
-		return -1;
+		goto nomem_out;
 	}
+
 	ret = SMB_VFS_NEXT_LINKAT(handle,
-			srcfsp,
+			handle->conn->cwd_fsp,
 			old_cap_smb_fname,
-			dstfsp,
+			handle->conn->cwd_fsp,
 			new_cap_smb_fname,
 			flags);
 	if (ret == -1) {
 		saved_errno = errno;
 	}
+	TALLOC_FREE(old_full_fname);
+	TALLOC_FREE(old_full_fname);
 	TALLOC_FREE(capold);
 	TALLOC_FREE(capnew);
 	TALLOC_FREE(old_cap_smb_fname);
@@ -649,6 +668,17 @@ static int cap_linkat(vfs_handle_struct *handle,
 		errno = saved_errno;
 	}
 	return ret;
+
+  nomem_out:
+
+	TALLOC_FREE(old_full_fname);
+	TALLOC_FREE(old_full_fname);
+	TALLOC_FREE(capold);
+	TALLOC_FREE(capnew);
+	TALLOC_FREE(old_cap_smb_fname);
+	TALLOC_FREE(new_cap_smb_fname);
+	errno = ENOMEM;
+	return -1;
 }
 
 static int cap_mknodat(vfs_handle_struct *handle,
diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
index a34ed8eab14..9da074a31ce 100644
--- a/source3/modules/vfs_ceph.c
+++ b/source3/modules/vfs_ceph.c
@@ -1108,18 +1108,34 @@ static int cephwrap_linkat(struct vfs_handle_struct *handle,
 		const struct smb_filename *new_smb_fname,
 		int flags)
 {
+	struct smb_filename *full_fname_old = NULL;
+	struct smb_filename *full_fname_new = NULL;
 	int result = -1;
-	DBG_DEBUG("[CEPH] link(%p, %s, %s)\n", handle,
-			old_smb_fname->base_name,
-			new_smb_fname->base_name);
 
-	SMB_ASSERT(srcfsp == srcfsp->conn->cwd_fsp);
-	SMB_ASSERT(dstfsp == dstfsp->conn->cwd_fsp);
+	full_fname_old = full_path_from_dirfsp_atname(talloc_tos(),
+					srcfsp,
+					old_smb_fname);
+	if (full_fname_old == NULL) {
+		return -1;
+	}
+	full_fname_new = full_path_from_dirfsp_atname(talloc_tos(),
+					dstfsp,
+					new_smb_fname);
+	if (full_fname_new == NULL) {
+		TALLOC_FREE(full_fname_old);
+		return -1;
+	}
+
+	DBG_DEBUG("[CEPH] link(%p, %s, %s)\n", handle,
+			full_fname_old->base_name,
+			full_fname_new->base_name);
 
 	result = ceph_link(handle->data,
-				old_smb_fname->base_name,
-				new_smb_fname->base_name);
+				full_fname_old->base_name,
+				full_fname_new->base_name);
 	DBG_DEBUG("[CEPH] link(...) = %d\n", result);
+	TALLOC_FREE(full_fname_old);
+	TALLOC_FREE(full_fname_new);
 	WRAP_RETURN(result);
 }
 
diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c
index 71577c8aaeb..7d47871680d 100644
--- a/source3/modules/vfs_full_audit.c
+++ b/source3/modules/vfs_full_audit.c
@@ -1870,8 +1870,23 @@ static int smb_full_audit_linkat(vfs_handle_struct *handle,
 			const struct smb_filename *new_smb_fname,
 			int flags)
 {
+	struct smb_filename *old_full_fname = NULL;
+	struct smb_filename *new_full_fname = NULL;
 	int result;
 
+	old_full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+						srcfsp,
+						old_smb_fname);
+	if (old_full_fname == NULL) {
+		return -1;
+	}
+	new_full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+						dstfsp,
+						new_smb_fname);
+	if (new_full_fname == NULL) {
+		TALLOC_FREE(old_full_fname);
+		return -1;
+	}
 	result = SMB_VFS_NEXT_LINKAT(handle,
 			srcfsp,
 			old_smb_fname,
@@ -1883,8 +1898,11 @@ static int smb_full_audit_linkat(vfs_handle_struct *handle,
 	       (result >= 0),
 	       handle,
 	       "%s|%s",
-	       smb_fname_str_do_log(handle->conn, old_smb_fname),
-	       smb_fname_str_do_log(handle->conn, new_smb_fname));
+	       smb_fname_str_do_log(handle->conn, old_full_fname),
+	       smb_fname_str_do_log(handle->conn, new_full_fname));
+
+	TALLOC_FREE(old_full_fname);
+	TALLOC_FREE(new_full_fname);
 
 	return result;
 }
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 25ff945f5f1..b1fd2a7f098 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -1894,15 +1894,33 @@ static int vfs_gluster_linkat(struct vfs_handle_struct *handle,
 				int flags)
 {
 	int ret;
+	struct smb_filename *full_fname_old = NULL;
+	struct smb_filename *full_fname_new = NULL;
 
 	START_PROFILE(syscall_linkat);
 
-	SMB_ASSERT(srcfsp == srcfsp->conn->cwd_fsp);
-	SMB_ASSERT(dstfsp == dstfsp->conn->cwd_fsp);
+	full_fname_old = full_path_from_dirfsp_atname(talloc_tos(),
+						srcfsp,
+						old_smb_fname);
+	if (full_fname_old == NULL) {
+		END_PROFILE(syscall_linkat);
+		return -1;
+	}
+	full_fname_new = full_path_from_dirfsp_atname(talloc_tos(),
+						dstfsp,
+						new_smb_fname);
+	if (full_fname_new == NULL) {
+		TALLOC_FREE(full_fname_old);
+		END_PROFILE(syscall_linkat);
+		return -1;
+	}
 
 	ret = glfs_link(handle->data,
-			old_smb_fname->base_name,
-			new_smb_fname->base_name);
+			full_fname_old->base_name,
+			full_fname_new->base_name);
+
+	TALLOC_FREE(full_fname_old);
+	TALLOC_FREE(full_fname_new);
 	END_PROFILE(syscall_linkat);
 
 	return ret;
diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c
index 307d7afa963..fb5a082c98e 100644
--- a/source3/modules/vfs_media_harmony.c
+++ b/source3/modules/vfs_media_harmony.c
@@ -1721,12 +1721,34 @@ static int mh_linkat(vfs_handle_struct *handle,
 		int flags)
 {
 	int status;
+	struct smb_filename *old_full_fname = NULL;
 	struct smb_filename *oldclientFname = NULL;
+	struct smb_filename *new_full_fname = NULL;
 	struct smb_filename *newclientFname = NULL;
 
 	DEBUG(MH_INFO_DEBUG, ("Entering mh_linkat\n"));
-	if (!is_in_media_files(old_smb_fname->base_name) &&
-			!is_in_media_files(new_smb_fname->base_name)) {
+
+	old_full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+						srcfsp,
+						old_smb_fname);
+	if (old_full_fname == NULL) {
+		status = -1;
+		goto err;
+	}
+
+	new_full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+						dstfsp,
+						new_smb_fname);
+	if (new_full_fname == NULL) {
+		status = -1;
+		goto err;
+	}
+
+	if (!is_in_media_files(old_full_fname->base_name) &&
+			!is_in_media_files(new_full_fname->base_name)) {
+		TALLOC_FREE(old_full_fname);
+		TALLOC_FREE(new_full_fname);
+
 		status = SMB_VFS_NEXT_LINKAT(handle,
 				srcfsp,
 				old_smb_fname,
@@ -1737,24 +1759,26 @@ static int mh_linkat(vfs_handle_struct *handle,
 	}
 
 	if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
-				old_smb_fname,
+				old_full_fname,
 				&oldclientFname))) {
 		goto err;
 	}
 	if ((status = alloc_get_client_smb_fname(handle, talloc_tos(),
-				new_smb_fname,
+				new_full_fname,
 				&newclientFname))) {
 		goto err;
 	}
 
 	status = SMB_VFS_NEXT_LINKAT(handle,
-				srcfsp,
+				handle->conn->cwd_fsp,
 				oldclientFname,
-				dstfsp,
+				handle->conn->cwd_fsp,
 				newclientFname,
 				flags);
 
 err:
+	TALLOC_FREE(old_full_fname);
+	TALLOC_FREE(new_full_fname);
 	TALLOC_FREE(newclientFname);
 	TALLOC_FREE(oldclientFname);
 out:
diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c
index ae8afec11b1..227ac148260 100644
--- a/source3/modules/vfs_shadow_copy2.c
+++ b/source3/modules/vfs_shadow_copy2.c
@@ -1076,7 +1076,6 @@ 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;
@@ -1091,25 +1090,15 @@ 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,
-				full_fname,
+				new_smb_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;
@@ -1636,23 +1625,13 @@ static int shadow_copy2_mknodat(vfs_handle_struct *handle,
 			mode_t mode,
 			SMB_DEV_T dev)
 {
-	struct smb_filename *full_fname = NULL;
 	time_t timestamp = 0;
 
-	full_fname = full_path_from_dirfsp_atname(talloc_tos(),
-						dirfsp,
-						smb_fname);
-	if (full_fname == NULL) {
-		return -1;
-	}
-
 	if (!shadow_copy2_strip_snapshot(talloc_tos(), handle,
-					 full_fname,
+					 smb_fname,
 					 &timestamp, NULL)) {
-		TALLOC_FREE(full_fname);
 		return -1;
 	}
-	TALLOC_FREE(full_fname);
 	if (timestamp != 0) {
 		errno = EROFS;
 		return -1;
diff --git a/source3/modules/vfs_syncops.c b/source3/modules/vfs_syncops.c
index 9c633456ad1..e36cb79e64d 100644
--- a/source3/modules/vfs_syncops.c
+++ b/source3/modules/vfs_syncops.c
@@ -196,14 +196,26 @@ static int syncops_linkat(vfs_handle_struct *handle,
 {
 	int ret;
 	struct syncops_config_data *config;
+	struct smb_filename *old_full_fname = NULL;
+	struct smb_filename *new_full_fname = NULL;
 
 	SMB_VFS_HANDLE_GET_DATA(handle, config,
 				struct syncops_config_data,
 				return -1);
 
-	SMB_ASSERT(srcfsp == srcfsp->conn->cwd_fsp);
-	SMB_ASSERT(dstfsp == dstfsp->conn->cwd_fsp);
-
+	old_full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+				srcfsp,
+				old_smb_fname);
+	if (old_full_fname == NULL) {
+		return -1;
+	}
+	new_full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+				dstfsp,
+				new_smb_fname);
+	if (new_full_fname == NULL) {
+		TALLOC_FREE(old_full_fname);
+		return -1;
+	}
 	ret = SMB_VFS_NEXT_LINKAT(handle,
 			srcfsp,
 			old_smb_fname,
@@ -212,9 +224,11 @@ static int syncops_linkat(vfs_handle_struct *handle,
 			flags);
 
 	if (ret == 0 && config->onmeta && !config->disable) {
-		syncops_two_names(old_smb_fname->base_name,
-				  new_smb_fname->base_name);
+		syncops_two_names(old_full_fname->base_name,
+				  new_full_fname->base_name);
 	}
+	TALLOC_FREE(old_full_fname);
+	TALLOC_FREE(new_full_fname);
 	return ret;
 }
 
diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c
index a56839c77ad..db9e9d3cf12 100644
--- a/source3/modules/vfs_time_audit.c
+++ b/source3/modules/vfs_time_audit.c
@@ -1497,10 +1497,19 @@ static int smb_time_audit_linkat(vfs_handle_struct *handle,
 				const struct smb_filename *new_smb_fname,
 				int flags)
 {
+	struct smb_filename *new_full_fname = NULL;
 	int result;
 	struct timespec ts1,ts2;
 	double timediff;
 
+	new_full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+						  dstfsp,
+						  new_smb_fname);
+	if (new_full_fname == NULL) {
+		errno = ENOMEM;
+		return -1;
+	}
+
 	clock_gettime_mono(&ts1);
 	result = SMB_VFS_NEXT_LINKAT(handle,
 			srcfsp,
@@ -1513,9 +1522,10 @@ static int smb_time_audit_linkat(vfs_handle_struct *handle,
 
 	if (timediff > audit_timeout) {
 		smb_time_audit_log_fname("linkat", timediff,
-			new_smb_fname->base_name);
+			new_full_fname->base_name);
 	}
 
+	TALLOC_FREE(new_full_fname);
 	return result;
 }
 
diff --git a/source3/modules/vfs_unityed_media.c b/source3/modules/vfs_unityed_media.c
index 4ad2d2bb656..fea026e82c9 100644
--- a/source3/modules/vfs_unityed_media.c
+++ b/source3/modules/vfs_unityed_media.c
@@ -1358,12 +1358,30 @@ static int um_linkat(vfs_handle_struct *handle,
 			int flags)
 {
 	int status;
+	struct smb_filename *old_full_fname = NULL;
+	struct smb_filename *new_full_fname = NULL;
 	struct smb_filename *old_client_fname = NULL;
 	struct smb_filename *new_client_fname = NULL;
 
+	old_full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+						  srcfsp,


-- 
Samba Shared Repository



More information about the samba-cvs mailing list