From 6b6298b02392e30044efd9fbc236d9ffb8f1ec1a Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 16 Aug 2019 16:08:22 -0700 Subject: [PATCH] s3: VFS: vfs_unityed_media. Implement linkat(). MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Currently identical to link(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Böhme --- source3/modules/vfs_unityed_media.c | 47 +++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/source3/modules/vfs_unityed_media.c b/source3/modules/vfs_unityed_media.c index ad97fd79265..cdda1a7adc3 100644 --- a/source3/modules/vfs_unityed_media.c +++ b/source3/modules/vfs_unityed_media.c @@ -1426,6 +1426,52 @@ err: return status; } +static int um_linkat(vfs_handle_struct *handle, + files_struct *srcfsp, + const struct smb_filename *old_smb_fname, + files_struct *dstfsp, + const struct smb_filename *new_smb_fname, + int flags) +{ + int status; + struct smb_filename *old_client_fname = NULL; + struct smb_filename *new_client_fname = NULL; + + DEBUG(10, ("Entering um_linkat\n")); + if (!is_in_media_files(old_smb_fname->base_name) && + !is_in_media_files(new_smb_fname->base_name)) { + return SMB_VFS_NEXT_LINKAT(handle, + srcfsp, + old_smb_fname, + dstfsp, + new_smb_fname, + flags); + } + + status = alloc_get_client_smb_fname(handle, talloc_tos(), + old_smb_fname, &old_client_fname); + if (status != 0) { + goto err; + } + status = alloc_get_client_smb_fname(handle, talloc_tos(), + new_smb_fname, &new_client_fname); + if (status != 0) { + goto err; + } + + status = SMB_VFS_NEXT_LINKAT(handle, + srcfsp, + old_client_fname, + dstfsp, + new_client_fname, + flags); + +err: + TALLOC_FREE(old_client_fname); + TALLOC_FREE(new_client_fname); + return status; +} + static int um_mknod(vfs_handle_struct *handle, const struct smb_filename *smb_fname, mode_t mode, @@ -1904,6 +1950,7 @@ static struct vfs_fn_pointers vfs_um_fns = { .symlink_fn = um_symlink, .readlink_fn = um_readlink, .link_fn = um_link, + .linkat_fn = um_linkat, .mknod_fn = um_mknod, .realpath_fn = um_realpath, .chflags_fn = um_chflags, -- 2.11.4.GIT