From: Jeremy Allison Date: Fri, 30 Aug 2019 21:02:53 +0000 (-0700) Subject: s3: VFS: vfs_unityed_media. Implement symlinkat(). X-Git-Tag: tevent-0.10.1~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c851da40f0482efc59b2d0e7f44e9d2b98d3d5c;p=thirdparty%2Fsamba.git s3: VFS: vfs_unityed_media. Implement symlinkat(). Currently identical to symlink(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Böhme --- diff --git a/source3/modules/vfs_unityed_media.c b/source3/modules/vfs_unityed_media.c index 68178691cda..75da73765c4 100644 --- a/source3/modules/vfs_unityed_media.c +++ b/source3/modules/vfs_unityed_media.c @@ -1365,6 +1365,47 @@ err: return status; } +static int um_symlinkat(vfs_handle_struct *handle, + const char *link_contents, + struct files_struct *dirfsp, + const struct smb_filename *new_smb_fname) +{ + int status; + char *client_link_contents = NULL; + struct smb_filename *new_client_fname = NULL; + + DEBUG(10, ("Entering um_symlinkat\n")); + + if (!is_in_media_files(link_contents) && + !is_in_media_files(new_smb_fname->base_name)) { + return SMB_VFS_NEXT_SYMLINKAT(handle, + link_contents, + dirfsp, + new_smb_fname); + } + + status = alloc_get_client_path(handle, talloc_tos(), + link_contents, &client_link_contents); + 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_SYMLINKAT(handle, + client_link_contents, + dirfsp, + new_client_fname); + +err: + TALLOC_FREE(client_link_contents); + TALLOC_FREE(new_client_fname); + return status; +} + static int um_readlinkat(vfs_handle_struct *handle, files_struct *dirfsp, const struct smb_filename *smb_fname, @@ -1932,6 +1973,7 @@ static struct vfs_fn_pointers vfs_um_fns = { .chdir_fn = um_chdir, .ntimes_fn = um_ntimes, .symlink_fn = um_symlink, + .symlinkat_fn = um_symlinkat, .readlinkat_fn = um_readlinkat, .linkat_fn = um_linkat, .mknodat_fn = um_mknodat,