s3:libsmb: allow store_cldap_reply() to work with a ipv6 response
[samba.git] / source3 / modules / vfs_virusfilter_dummy.c
1 /*
2    Samba-VirusFilter VFS modules
3    Dummy scanner with infected files support.
4    Copyright (C) 2022 Pavel Filipenský <pfilipen@redhat.com>
5
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.
10
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.
15
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/>.
18 */
19
20 #include "modules/vfs_virusfilter_utils.h"
21
22 static virusfilter_result virusfilter_dummy_scan(
23         struct vfs_handle_struct *handle,
24         struct virusfilter_config *config,
25         const struct files_struct *fsp,
26         char **reportp)
27 {
28         bool ok;
29
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,
33                         false);
34         return ok ? VIRUSFILTER_RESULT_INFECTED : VIRUSFILTER_RESULT_CLEAN;
35 }
36
37 static struct virusfilter_backend_fns virusfilter_backend_dummy = {
38         .connect = NULL,
39         .disconnect = NULL,
40         .scan_init = NULL,
41         .scan = virusfilter_dummy_scan,
42         .scan_end = NULL,
43 };
44
45 int virusfilter_dummy_init(struct virusfilter_config *config)
46 {
47         struct virusfilter_backend *backend = NULL;
48
49         backend = talloc_zero(config, struct virusfilter_backend);
50         if (backend == NULL) {
51                 return -1;
52         }
53
54         backend->fns = &virusfilter_backend_dummy;
55         backend->name = "dummy";
56         config->backend = backend;
57         return 0;
58 }