vfs_streams_depot: support real dirfsps in streams_depot_rmdir_internal()
authorRalph Boehme <slow@samba.org>
Thu, 21 Jan 2021 15:07:03 +0000 (16:07 +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_streams_depot.c

index e1f17afff74882c0a5b0eb4d005170f982a761fc..4cf0bb479547d0584864bd70158626c7b5c46496 100644 (file)
@@ -787,21 +787,30 @@ static int streams_depot_rmdir_internal(vfs_handle_struct *handle,
                        struct files_struct *dirfsp,
                        const struct smb_filename *smb_fname)
 {
+       struct smb_filename *full_fname = NULL;
        struct smb_filename *smb_fname_base = NULL;
        int ret = -1;
 
-       DBG_DEBUG("called for %s\n", smb_fname->base_name);
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                                 dirfsp,
+                                                 smb_fname);
+       if (full_fname == NULL) {
+               return -1;
+       }
+
+       DBG_DEBUG("called for %s\n", full_fname->base_name);
 
        /*
         * We potentially need to delete the per-inode streams directory
         */
 
        smb_fname_base = synthetic_smb_fname(talloc_tos(),
-                               smb_fname->base_name,
+                               full_fname->base_name,
                                NULL,
                                NULL,
-                               smb_fname->twrp,
-                               smb_fname->flags);
+                               full_fname->twrp,
+                               full_fname->flags);
+       TALLOC_FREE(full_fname);
        if (smb_fname_base == NULL) {
                errno = ENOMEM;
                return -1;
@@ -842,7 +851,7 @@ static int streams_depot_rmdir_internal(vfs_handle_struct *handle,
                                return -1;
                        }
                        SMB_VFS_NEXT_UNLINKAT(handle,
-                                       dirfsp,
+                                       dirfsp->conn->cwd_fsp,
                                        smb_fname_dir,
                                        AT_REMOVEDIR);
                        TALLOC_FREE(smb_fname_dir);
@@ -852,7 +861,7 @@ static int streams_depot_rmdir_internal(vfs_handle_struct *handle,
 
        ret = SMB_VFS_NEXT_UNLINKAT(handle,
                                dirfsp,
-                               smb_fname_base,
+                               smb_fname,
                                AT_REMOVEDIR);
        TALLOC_FREE(smb_fname_base);
        return ret;