From: Jeremy Allison Date: Thu, 11 Feb 2021 19:05:28 +0000 (-0800) Subject: s3: VFS: media_harmony: Fix mh_readlinkat() to cope with real directory fsps. X-Git-Tag: tevent-0.11.0~1757 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=89f116689da5a9ff4e62d650c7cbadc1f3c6a13e;p=thirdparty%2Fsamba.git s3: VFS: media_harmony: Fix mh_readlinkat() to cope with real directory fsps. Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c index fb5a082c98e..1df23169472 100644 --- a/source3/modules/vfs_media_harmony.c +++ b/source3/modules/vfs_media_harmony.c @@ -1679,10 +1679,19 @@ static int mh_readlinkat(vfs_handle_struct *handle, size_t bufsiz) { int status; + struct smb_filename *full_fname = NULL; struct smb_filename *clientFname = NULL; DEBUG(MH_INFO_DEBUG, ("Entering mh_readlinkat\n")); - if (!is_in_media_files(smb_fname->base_name)) { + full_fname = full_path_from_dirfsp_atname(talloc_tos(), + dirfsp, + smb_fname); + if (full_fname == NULL) { + status = -1; + goto err; + } + + if (!is_in_media_files(full_fname->base_name)) { status = SMB_VFS_NEXT_READLINKAT(handle, dirfsp, smb_fname, @@ -1692,13 +1701,13 @@ static int mh_readlinkat(vfs_handle_struct *handle, } if ((status = alloc_get_client_smb_fname(handle, talloc_tos(), - smb_fname, + full_fname, &clientFname))) { goto err; } status = SMB_VFS_NEXT_READLINKAT(handle, - dirfsp, + handle->conn->cwd_fsp, clientFname, buf, bufsiz); @@ -1706,6 +1715,7 @@ static int mh_readlinkat(vfs_handle_struct *handle, err: TALLOC_FREE(clientFname); out: + TALLOC_FREE(full_fname); return status; }