summaryrefslogtreecommitdiff
path: root/source3/modules/vfs_snapper.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2019-08-16 16:01:22 -0700
committerJeremy Allison <jra@samba.org>2019-08-20 21:09:28 +0000
commitdad377dbe4795f110da35bb751f800d6658fa7c0 (patch)
treeba55b48297cfb09f152d80b10e4a2c87a6cf7d1e /source3/modules/vfs_snapper.c
parentc55b43ba13a162d07befc27361632cdf2ef8aeb2 (diff)
downloadsamba-dad377dbe4795f110da35bb751f800d6658fa7c0.tar.gz
s3: VFS: vfs_snapper. Implement linkat().
Currently identical to link(). Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ralph Böhme <slow@samba.org>
Diffstat (limited to 'source3/modules/vfs_snapper.c')
-rw-r--r--source3/modules/vfs_snapper.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c
index 4975cdf6fb4..910591b1219 100644
--- a/source3/modules/vfs_snapper.c
+++ b/source3/modules/vfs_snapper.c
@@ -2099,6 +2099,42 @@ static int snapper_gmt_link(vfs_handle_struct *handle,
return SMB_VFS_NEXT_LINK(handle, old_smb_fname, new_smb_fname);
}
+static int snapper_gmt_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)
+{
+ time_t timestamp_old = 0;
+ time_t timestamp_new = 0;
+
+ if (!snapper_gmt_strip_snapshot(talloc_tos(),
+ handle,
+ old_smb_fname->base_name,
+ &timestamp_old,
+ NULL)) {
+ return -1;
+ }
+ if (!snapper_gmt_strip_snapshot(talloc_tos(),
+ handle,
+ new_smb_fname->base_name,
+ &timestamp_new,
+ NULL)) {
+ return -1;
+ }
+ if ((timestamp_old != 0) || (timestamp_new != 0)) {
+ errno = EROFS;
+ return -1;
+ }
+ return SMB_VFS_NEXT_LINKAT(handle,
+ srcfsp,
+ old_smb_fname,
+ dstfsp,
+ new_smb_fname,
+ flags);
+}
+
static int snapper_gmt_stat(vfs_handle_struct *handle,
struct smb_filename *smb_fname)
{
@@ -2863,6 +2899,7 @@ static struct vfs_fn_pointers snapper_fns = {
.get_quota_fn = snapper_gmt_get_quota,
.renameat_fn = snapper_gmt_renameat,
.link_fn = snapper_gmt_link,
+ .linkat_fn = snapper_gmt_linkat,
.symlink_fn = snapper_gmt_symlink,
.stat_fn = snapper_gmt_stat,
.lstat_fn = snapper_gmt_lstat,