From: Jeremy Allison Date: Thu, 12 Sep 2019 19:55:49 +0000 (-0700) Subject: s3: VFS: vfs_recycle. Implement unlinkat(). X-Git-Tag: talloc-2.3.1~638 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8d9ff50f85cbcfb361ab6c4f78892ab09f60209f;p=thirdparty%2Fsamba.git s3: VFS: vfs_recycle. Implement unlinkat(). Note this isn't identical to unlink() as this must cope with (flags & AT_REMOVEDIR), which is identical to rmdir(). It calls either unlink or rmdir depending on the flags parameter. Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_recycle.c b/source3/modules/vfs_recycle.c index 77e1afc308c..cb582acd976 100644 --- a/source3/modules/vfs_recycle.c +++ b/source3/modules/vfs_recycle.c @@ -670,8 +670,29 @@ done: return rc; } +static int recycle_unlinkat(vfs_handle_struct *handle, + struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + int flags) +{ + int ret; + + if (flags & AT_REMOVEDIR) { + ret = SMB_VFS_NEXT_UNLINKAT(handle, + dirfsp, + smb_fname, + flags); + } else { + SMB_ASSERT(dirfsp == dirfsp->conn->cwd_fsp); + ret = recycle_unlink(handle, + smb_fname); + } + return ret; +} + static struct vfs_fn_pointers vfs_recycle_fns = { - .unlink_fn = recycle_unlink + .unlink_fn = recycle_unlink, + .unlinkat_fn = recycle_unlinkat }; static_decl_vfs;