[PATCH] Samba-VirusFilter - optimization for directories in virusfitler_vfs_open/close

Jeremy Allison jra at samba.org
Wed Jan 24 21:16:51 UTC 2018


On Wed, Jan 24, 2018 at 11:36:33AM -0700, Trever L. Adams via samba-technical wrote:
> During the bug fixing process I though it best to optimize away directories.

LGTM. RB+. Ralph, can I get a second Team review ?

> From e0cc94503718c0381018e28acc46f5ea1daf5b49 Mon Sep 17 00:00:00 2001
> From: "Trever L. Adams" <trever.adams at gmail.com>
> Date: Wed, 24 Jan 2018 11:21:11 -0700
> Subject: [PATCH 2/2] Clean up directory checking in virusfiter_vfs_close and
>  add to virusfilter_vfs_open.
> 
> Signed-off-by: Trever L. Adams <trever.adams at gmail.com>
> ---
>  source3/modules/vfs_virusfilter.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/source3/modules/vfs_virusfilter.c b/source3/modules/vfs_virusfilter.c
> index 571073fbfff..ef9dc78263b 100644
> --- a/source3/modules/vfs_virusfilter.c
> +++ b/source3/modules/vfs_virusfilter.c
> @@ -1153,6 +1153,11 @@ static int virusfilter_vfs_open(
>  	SMB_VFS_HANDLE_GET_DATA(handle, config,
>  				struct virusfilter_config, return -1);
>  
> +	if (fsp->is_directory) {
> +		DBG_INFO("Not scanned: Directory: %s/\n", cwd_fname);
> +		goto virusfilter_vfs_open_next;
> +	}
> +
>  	test_prefix = strlen(config->rename_prefix);
>  	test_suffix = strlen(config->rename_suffix);
>  	if (test_prefix > 0) {
> @@ -1338,8 +1343,7 @@ static int virusfilter_vfs_close(
>  	}
>  
>  	if (fsp->is_directory) {
> -		DBG_INFO("Not scanned: Directory: %s/%s\n", cwd_fname,
> -			 fname);
> +		DBG_INFO("Not scanned: Directory: %s/\n", cwd_fname);
>  		return close_result;
>  	}
>  
> -- 
> 2.14.3
> 







More information about the samba-technical mailing list