s3: VFS: glusterfs: Fix vfs_gluster_symlinkat() to cope with a real dirfsp.
authorJeremy Allison <jra@samba.org>
Fri, 15 Jan 2021 22:35:58 +0000 (14:35 -0800)
committerJeremy Allison <jra@samba.org>
Sun, 17 Jan 2021 04:43:31 +0000 (04:43 +0000)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_glusterfs.c

index 59b7654611295294a0c247b885a79dbc65156a50..9cc27b5c352e5758e01c4d09bf326192aaf36092 100644 (file)
@@ -1844,13 +1844,25 @@ static int vfs_gluster_symlinkat(struct vfs_handle_struct *handle,
                                struct files_struct *dirfsp,
                                const struct smb_filename *new_smb_fname)
 {
+       struct smb_filename *full_fname = NULL;
        int ret;
 
        START_PROFILE(syscall_symlinkat);
-       SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp);
+
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                               dirfsp,
+                                               new_smb_fname);
+       if (full_fname == NULL) {
+               END_PROFILE(syscall_symlinkat);
+               return -1;
+       }
+
        ret = glfs_symlink(handle->data,
                        link_target->base_name,
-                       new_smb_fname->base_name);
+                       full_fname->base_name);
+
+       TALLOC_FREE(full_fname);
+
        END_PROFILE(syscall_symlinkat);
 
        return ret;