s3:idmap_ad: add support for ADS_AUTH_SASL_{STARTTLS,LDAPS}
[Samba.git] / source3 / modules / vfs_virusfilter_dummy.c
blob03405cd662906246aeef804c8e205391204424e9
1 /*
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,
26 char **reportp)
28 bool ok;
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;
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,
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) {
51 return -1;
54 backend->fns = &virusfilter_backend_dummy;
55 backend->name = "dummy";
56 config->backend = backend;
57 return 0;