From 62f92f8b29a4d860ee0062de27edb466f699633d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 12 Sep 2019 13:21:41 -0700 Subject: [PATCH] s3: VFS: vfs_snapper. Implement unlinkat(). This is identical to unlink(), as there are no special cases needed for rmdir(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- source3/modules/vfs_snapper.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c index 2a4ebb48ec3..9f3d876317d 100644 --- a/source3/modules/vfs_snapper.c +++ b/source3/modules/vfs_snapper.c @@ -2236,6 +2236,28 @@ static int snapper_gmt_unlink(vfs_handle_struct *handle, return SMB_VFS_NEXT_UNLINK(handle, smb_fname); } +static int snapper_gmt_unlinkat(vfs_handle_struct *handle, + struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + int flags) +{ + time_t timestamp = 0; + + if (!snapper_gmt_strip_snapshot(talloc_tos(), handle, + smb_fname->base_name, + ×tamp, NULL)) { + return -1; + } + if (timestamp != 0) { + errno = EROFS; + return -1; + } + return SMB_VFS_NEXT_UNLINKAT(handle, + dirfsp, + smb_fname, + flags); +} + static int snapper_gmt_chmod(vfs_handle_struct *handle, const struct smb_filename *smb_fname, mode_t mode) @@ -2897,6 +2919,7 @@ static struct vfs_fn_pointers snapper_fns = { .lstat_fn = snapper_gmt_lstat, .open_fn = snapper_gmt_open, .unlink_fn = snapper_gmt_unlink, + .unlinkat_fn = snapper_gmt_unlinkat, .chmod_fn = snapper_gmt_chmod, .chown_fn = snapper_gmt_chown, .chdir_fn = snapper_gmt_chdir, -- 2.11.4.GIT