]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_xattr_tdb: support real dirfsps in xattr_tdb_unlinkat()
authorRalph Boehme <slow@samba.org>
Wed, 20 Jan 2021 14:22:52 +0000 (15:22 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 28 Jan 2021 08:11:49 +0000 (08:11 +0000)
Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_xattr_tdb.c

index d89a1dd0d7db48842cbac0cc2f4caa0a80123114..26e8a37bc712ba9195def608aefdc5cb34d6eb33 100644 (file)
@@ -616,6 +616,7 @@ static int xattr_tdb_unlinkat(vfs_handle_struct *handle,
                        int flags)
 {
        struct smb_filename *smb_fname_tmp = NULL;
+       struct smb_filename *full_fname = NULL;
        struct file_id id;
        struct db_context *db;
        int ret = -1;
@@ -635,14 +636,26 @@ static int xattr_tdb_unlinkat(vfs_handle_struct *handle,
                return -1;
        }
 
-       if (smb_fname_tmp->flags & SMB_FILENAME_POSIX_PATH) {
-               ret = SMB_VFS_NEXT_LSTAT(handle, smb_fname_tmp);
+       /*
+        * TODO: use SMB_VFS_STATX() once we have that
+        */
+
+       full_fname = full_path_from_dirfsp_atname(frame,
+                                                 dirfsp,
+                                                 smb_fname);
+       if (full_fname == NULL) {
+               goto out;
+       }
+
+       if (full_fname->flags & SMB_FILENAME_POSIX_PATH) {
+               ret = SMB_VFS_NEXT_LSTAT(handle, full_fname);
        } else {
-               ret = SMB_VFS_NEXT_STAT(handle, smb_fname_tmp);
+               ret = SMB_VFS_NEXT_STAT(handle, full_fname);
        }
        if (ret == -1) {
                goto out;
        }
+       smb_fname_tmp->st = full_fname->st;
 
        if (flags & AT_REMOVEDIR) {
                /* Always remove record when removing a directory succeeds. */