From: Jeremy Allison Date: Thu, 11 Feb 2021 19:02:28 +0000 (-0800) Subject: s3: VFS: glusterfs: Fix vfs_gluster_readlinkat() to cope with real directory fsps. X-Git-Tag: tevent-0.11.0~1758 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2786a564e6afcc678347b616ab2ab0a8cca58d18;p=thirdparty%2Fsamba.git s3: VFS: glusterfs: Fix vfs_gluster_readlinkat() to cope with real directory fsps. Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index b1fd2a7f098..af0ce70e1e8 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -1876,11 +1876,23 @@ static int vfs_gluster_readlinkat(struct vfs_handle_struct *handle, char *buf, size_t bufsiz) { + struct smb_filename *full_fname = NULL; int ret; START_PROFILE(syscall_readlinkat); - SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp); - ret = glfs_readlink(handle->data, smb_fname->base_name, buf, bufsiz); + + full_fname = full_path_from_dirfsp_atname(talloc_tos(), + dirfsp, + smb_fname); + if (full_fname == NULL) { + END_PROFILE(syscall_readlinkat); + return -1; + } + + ret = glfs_readlink(handle->data, full_fname->base_name, buf, bufsiz); + + TALLOC_FREE(full_fname); + END_PROFILE(syscall_readlinkat); return ret;