]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: VFS: vfs_unityed_media. Implement unlinkat().
authorJeremy Allison <jra@samba.org>
Thu, 12 Sep 2019 21:14:01 +0000 (14:14 -0700)
committerRalph Boehme <slow@samba.org>
Thu, 26 Sep 2019 17:20:47 +0000 (17:20 +0000)
This is identical to unlink(), as there
are no special cases needed for rmdir().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/modules/vfs_unityed_media.c

index 6f4ec54143ee608bd008479a94920304bc260eaa..a28e59ba9da95e518ce38847139757623effc099 100644 (file)
@@ -1196,6 +1196,40 @@ err:
        return status;
 }
 
+static int um_unlinkat(vfs_handle_struct *handle,
+                       struct files_struct *dirfsp,
+                       const struct smb_filename *smb_fname,
+                       int flags)
+{
+       int ret;
+       struct smb_filename *client_fname = NULL;
+
+       DEBUG(10, ("Entering um_unlinkat\n"));
+
+       if (!is_in_media_files(smb_fname->base_name)) {
+               return SMB_VFS_NEXT_UNLINKAT(handle,
+                               dirfsp,
+                               smb_fname,
+                               flags);
+       }
+
+       ret = alloc_get_client_smb_fname(handle, talloc_tos(),
+                                           smb_fname,
+                                           &client_fname);
+       if (ret != 0) {
+               goto err;
+       }
+
+       ret = SMB_VFS_NEXT_UNLINKAT(handle,
+                               dirfsp,
+                               client_fname,
+                               flags);
+
+err:
+       TALLOC_FREE(client_fname);
+       return ret;
+}
+
 static int um_chmod(vfs_handle_struct *handle,
                        const struct smb_filename *smb_fname,
                        mode_t mode)
@@ -1936,6 +1970,7 @@ static struct vfs_fn_pointers vfs_um_fns = {
        .lstat_fn = um_lstat,
        .fstat_fn = um_fstat,
        .unlink_fn = um_unlink,
+       .unlinkat_fn = um_unlinkat,
        .chmod_fn = um_chmod,
        .chown_fn = um_chown,
        .lchown_fn = um_lchown,