]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
VFS: shadow_copy2: Fixup shadow_copy2_symlinkat() to correctly use the dirfsp path.
authorJeremy Allison <jra@samba.org>
Mon, 25 Jan 2021 20:30:17 +0000 (12:30 -0800)
committerRalph Boehme <slow@samba.org>
Thu, 28 Jan 2021 07:03:30 +0000 (07:03 +0000)
Missed in my original fixes.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_shadow_copy2.c

index 174f246bdad11c50c88b91291241be6319c9e368..ae8afec11b1143113afe228ca9049c64fb85982e 100644 (file)
@@ -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;