From: Jeremy Allison Date: Fri, 30 Aug 2019 20:54:52 +0000 (-0700) Subject: s3: VFS: vfs_snapper. Implement symlinkat(). X-Git-Tag: tevent-0.10.1~19 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=787487ae3ee7adcd68931d5834dbfc5e3ba1dce3;p=thirdparty%2Fsamba.git s3: VFS: vfs_snapper. Implement symlinkat(). Currently identical to symlink(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Böhme --- diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c index bf631ff25bc..60b78f5e394 100644 --- a/source3/modules/vfs_snapper.c +++ b/source3/modules/vfs_snapper.c @@ -2042,7 +2042,6 @@ static int snapper_gmt_renameat(vfs_handle_struct *handle, smb_fname_dst); } - static int snapper_gmt_symlink(vfs_handle_struct *handle, const char *link_contents, const struct smb_filename *new_smb_fname) @@ -2071,6 +2070,38 @@ static int snapper_gmt_symlink(vfs_handle_struct *handle, return SMB_VFS_NEXT_SYMLINK(handle, link_contents, new_smb_fname); } +static int snapper_gmt_symlinkat(vfs_handle_struct *handle, + const char *link_contents, + struct files_struct *dirfsp, + const struct smb_filename *new_smb_fname) +{ + time_t timestamp_old = 0; + time_t timestamp_new = 0; + + if (!snapper_gmt_strip_snapshot(talloc_tos(), + handle, + link_contents, + ×tamp_old, + NULL)) { + return -1; + } + if (!snapper_gmt_strip_snapshot(talloc_tos(), + handle, + new_smb_fname->base_name, + ×tamp_new, + NULL)) { + return -1; + } + if ((timestamp_old != 0) || (timestamp_new != 0)) { + errno = EROFS; + return -1; + } + return SMB_VFS_NEXT_SYMLINKAT(handle, + link_contents, + dirfsp, + new_smb_fname); +} + static int snapper_gmt_linkat(vfs_handle_struct *handle, files_struct *srcfsp, const struct smb_filename *old_smb_fname, @@ -2886,6 +2917,7 @@ static struct vfs_fn_pointers snapper_fns = { .renameat_fn = snapper_gmt_renameat, .linkat_fn = snapper_gmt_linkat, .symlink_fn = snapper_gmt_symlink, + .symlinkat_fn = snapper_gmt_symlinkat, .stat_fn = snapper_gmt_stat, .lstat_fn = snapper_gmt_lstat, .open_fn = snapper_gmt_open,