From: Jeremy Allison Date: Thu, 12 Sep 2019 20:19:39 +0000 (-0700) Subject: s3: VFS: vfs_shadow_copy2. Implement unlinkat(). X-Git-Tag: talloc-2.3.1~635 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=43b9d9adfe3ac5135bee4918e2769cf912e12b7d;p=thirdparty%2Fsamba.git s3: VFS: vfs_shadow_copy2. 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 --- diff --git a/source3/modules/vfs_shadow_copy2.c b/source3/modules/vfs_shadow_copy2.c index 5417c9f3b82..da8097ca58f 100644 --- a/source3/modules/vfs_shadow_copy2.c +++ b/source3/modules/vfs_shadow_copy2.c @@ -1511,6 +1511,28 @@ static int shadow_copy2_unlink(vfs_handle_struct *handle, return SMB_VFS_NEXT_UNLINK(handle, smb_fname); } +static int shadow_copy2_unlinkat(vfs_handle_struct *handle, + struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + int flags) +{ + time_t timestamp = 0; + + if (!shadow_copy2_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 shadow_copy2_chmod(vfs_handle_struct *handle, const struct smb_filename *smb_fname, mode_t mode) @@ -3166,6 +3188,7 @@ static struct vfs_fn_pointers vfs_shadow_copy2_fns = { .fstat_fn = shadow_copy2_fstat, .open_fn = shadow_copy2_open, .unlink_fn = shadow_copy2_unlink, + .unlinkat_fn = shadow_copy2_unlinkat, .chmod_fn = shadow_copy2_chmod, .chown_fn = shadow_copy2_chown, .chdir_fn = shadow_copy2_chdir,