]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
vfs_virusfilter: support real dirfsps in virusfilter_vfs_unlinkat()
authorRalph Boehme <slow@samba.org>
Wed, 20 Jan 2021 14:22:16 +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_virusfilter.c

index 290d9a23335f6371a8f9d7ed37604afa28b7a70a..e0712b99b4270c117b0d7413c731b7db3ab3bb6e 100644 (file)
@@ -1511,8 +1511,9 @@ static int virusfilter_vfs_unlinkat(struct vfs_handle_struct *handle,
                        smb_fname,
                        flags);
        struct virusfilter_config *config = NULL;
+       struct smb_filename *full_fname = NULL;
        char *fname = NULL;
-       char *cwd_fname = handle->conn->cwd_fsp->fsp_name->base_name;
+       char *cwd_fname = dirfsp->fsp_name->base_name;
 
        if (ret != 0 && errno != ENOENT) {
                return ret;
@@ -1525,11 +1526,19 @@ static int virusfilter_vfs_unlinkat(struct vfs_handle_struct *handle,
                return 0;
        }
 
-       fname = smb_fname->base_name;
+       full_fname = full_path_from_dirfsp_atname(talloc_tos(),
+                                                 dirfsp,
+                                                 smb_fname);
+       if (full_fname == NULL) {
+               return -1;
+       }
+
+       fname = full_fname->base_name;
 
        DBG_DEBUG("Removing cache entry (if existent): fname: %s\n", fname);
        virusfilter_cache_remove(config->cache, cwd_fname, fname);
 
+       TALLOC_FREE(full_fname);
        return 0;
 }