From: Jeremy Allison Date: Thu, 11 Feb 2021 17:26:15 +0000 (-0800) Subject: s3: VFS: ceph: Fix cephwrap_readlinkat() to cope with real directory fsps. X-Git-Tag: tevent-0.11.0~1761 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7933ee403b6c51eb6a2b055ae1064c07ae3d70fd;p=thirdparty%2Fsamba.git s3: VFS: ceph: Fix cephwrap_readlinkat() to cope with real directory fsps. Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 9da074a31ce..47b5046cfcb 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -1090,13 +1090,21 @@ static int cephwrap_readlinkat(struct vfs_handle_struct *handle, char *buf, size_t bufsiz) { + struct smb_filename *full_fname = NULL; int result = -1; - DBG_DEBUG("[CEPH] readlink(%p, %s, %p, %llu)\n", handle, - smb_fname->base_name, buf, llu(bufsiz)); - SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp); + full_fname = full_path_from_dirfsp_atname(talloc_tos(), + dirfsp, + smb_fname); + if (full_fname == NULL) { + return -1; + } - result = ceph_readlink(handle->data, smb_fname->base_name, buf, bufsiz); + DBG_DEBUG("[CEPH] readlink(%p, %s, %p, %llu)\n", handle, + full_fname->base_name, buf, llu(bufsiz)); + + result = ceph_readlink(handle->data, full_fname->base_name, buf, bufsiz); + TALLOC_FREE(full_fname); DBG_DEBUG("[CEPH] readlink(...) = %d\n", result); WRAP_RETURN(result); }