]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3:modules:vfs_virusfilter: Recent New_VFS changes break vfs_virusfilter_openat.
authorTrever L. Adams <trever.adams@gmail.com>
Sat, 13 Mar 2021 19:47:21 +0000 (12:47 -0700)
committerNoel Power <npower@samba.org>
Mon, 22 Mar 2021 19:44:30 +0000 (19:44 +0000)
The_New_VFS introduces several changes that broke vfs_virusfilter_openat. The assert to make sure certain checks would work broke.

This patch fixes those breaks and converts to the SMB_VFS_FSTAT_NEXT instead of SMB_VFS_STAT_NEXT.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14671
RN: vfs_virusfilter_openat support New_VFS FSTAT, avoid SMB_ASSERT(fsp_get_pathref_fd(dirfsp) == AT_FDCWD); problem.

Signed-off-by: Trever L. Adams" <trever.adams@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Mon Mar 22 19:44:30 UTC 2021 on sn-devel-184

source3/modules/vfs_virusfilter.c

index e7017ee1c7a90182637ccaaa3272afe85f703c19..25ef4b3249070f436a24384dd653151badb22d77 100644 (file)
@@ -1243,11 +1243,7 @@ static int virusfilter_vfs_openat(struct vfs_handle_struct *handle,
        bool ok1;
        char *sret = NULL;
        struct smb_filename *smb_fname = NULL;
-
-       /*
-        * For now assert this, so SMB_VFS_NEXT_STAT() below works.
-        */
-       SMB_ASSERT(fsp_get_pathref_fd(dirfsp) == AT_FDCWD);
+       SMB_STRUCT_STAT sbuf = smb_fname_in->st;
 
        SMB_VFS_HANDLE_GET_DATA(handle, config,
                                struct virusfilter_config, return -1);
@@ -1289,7 +1285,7 @@ static int virusfilter_vfs_openat(struct vfs_handle_struct *handle,
                goto virusfilter_vfs_open_next;
        }
 
-       ret = SMB_VFS_NEXT_STAT(handle, smb_fname);
+       ret = SMB_VFS_NEXT_FSTAT(handle, fsp, &sbuf);
        if (ret != 0) {
 
                /*