2 Samba-VirusFilter VFS modules
3 Dummy scanner with infected files support.
4 Copyright (C) 2022 Pavel Filipenský <pfilipen@redhat.com>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #include "modules/vfs_virusfilter_utils.h"
22 static virusfilter_result
virusfilter_dummy_scan(
23 struct vfs_handle_struct
*handle
,
24 struct virusfilter_config
*config
,
25 const struct files_struct
*fsp
,
30 DBG_INFO("Scanning file: %s\n", fsp_str_dbg(fsp
));
31 ok
= is_in_path(fsp
->fsp_name
->base_name
,
32 config
->infected_files
,
34 return ok
? VIRUSFILTER_RESULT_INFECTED
: VIRUSFILTER_RESULT_CLEAN
;
37 static struct virusfilter_backend_fns virusfilter_backend_dummy
= {
41 .scan
= virusfilter_dummy_scan
,
45 int virusfilter_dummy_init(struct virusfilter_config
*config
)
47 struct virusfilter_backend
*backend
= NULL
;
49 backend
= talloc_zero(config
, struct virusfilter_backend
);
50 if (backend
== NULL
) {
54 backend
->fns
= &virusfilter_backend_dummy
;
55 backend
->name
= "dummy";
56 config
->backend
= backend
;