From: Jeremy Allison Date: Wed, 11 Sep 2019 23:49:38 +0000 (-0700) Subject: s3: VFS: vfs_acl_xattr. Implement unlinkat(). X-Git-Tag: talloc-2.3.1~650 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a7e472e5ca02bb3c6685e38042b23ee27422a5a;p=thirdparty%2Fsamba.git s3: VFS: vfs_acl_xattr. 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_acl_xattr.c b/source3/modules/vfs_acl_xattr.c index b8190fd4b1c..80779cd9577 100644 --- a/source3/modules/vfs_acl_xattr.c +++ b/source3/modules/vfs_acl_xattr.c @@ -20,6 +20,7 @@ #include "includes.h" #include "smbd/smbd.h" +#include "system/filesys.h" #include "librpc/gen_ndr/xattr.h" #include "auth.h" #include "vfs_acl_common.h" @@ -277,6 +278,21 @@ static int connect_acl_xattr(struct vfs_handle_struct *handle, return 0; } +static int acl_xattr_unlinkat(vfs_handle_struct *handle, + struct files_struct *dirfsp, + const struct smb_filename *smb_fname, + int flags) +{ + int ret; + + if (flags & AT_REMOVEDIR) { + ret = rmdir_acl_common(handle, smb_fname); + } else { + ret = unlink_acl_common(handle, smb_fname); + } + return ret; +} + static NTSTATUS acl_xattr_fget_nt_acl(vfs_handle_struct *handle, files_struct *fsp, uint32_t security_info, @@ -317,6 +333,7 @@ static struct vfs_fn_pointers vfs_acl_xattr_fns = { .connect_fn = connect_acl_xattr, .rmdir_fn = rmdir_acl_common, .unlink_fn = unlink_acl_common, + .unlinkat_fn = acl_xattr_unlinkat, .chmod_fn = chmod_acl_module_common, .fchmod_fn = fchmod_acl_module_common, .fget_nt_acl_fn = acl_xattr_fget_nt_acl,