]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: vfs_streams_xattr. Implement unlinkat().
authorJeremy Allison <jra@samba.org>
Thu, 12 Sep 2019 21:00:24 +0000 (14:00 -0700)
committerRalph Boehme <slow@samba.org>
Thu, 26 Sep 2019 17:20:46 +0000 (17:20 +0000)
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 <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_streams_xattr.c

index dcb1eb549752b6e8b896cc6cded2416b3b78f897..ea2f902502bc91fdb924b5e266b46c85aeae81d2 100644 (file)
@@ -594,6 +594,24 @@ static int streams_xattr_unlink(vfs_handle_struct *handle,
        return ret;
 }
 
+static int streams_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 = SMB_VFS_NEXT_UNLINKAT(handle,
+                               dirfsp,
+                               smb_fname,
+                               flags);
+       } else {
+               ret = streams_xattr_unlink(handle,
+                               smb_fname);
+       }
+       return ret;
+}
+
 static int streams_xattr_renameat(vfs_handle_struct *handle,
                                files_struct *srcfsp,
                                const struct smb_filename *smb_fname_src,
@@ -1661,6 +1679,7 @@ static struct vfs_fn_pointers vfs_streams_xattr_fns = {
        .pwrite_send_fn = streams_xattr_pwrite_send,
        .pwrite_recv_fn = streams_xattr_pwrite_recv,
        .unlink_fn = streams_xattr_unlink,
+       .unlinkat_fn = streams_xattr_unlinkat,
        .renameat_fn = streams_xattr_renameat,
        .ftruncate_fn = streams_xattr_ftruncate,
        .fallocate_fn = streams_xattr_fallocate,