2 Samba-VirusFilter VFS modules
3 Copyright (C) 2010-2016 SATOH Fumiyasu @ OSS Technology Corp., Japan
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
19 #ifndef _VIRUSFILTER_COMMON_H
20 #define _VIRUSFILTER_COMMON_H
25 /* Samba common include file */
28 #include "smbd/smbd.h"
29 #include "smbd/globals.h"
30 #include "system/filesys.h"
31 #include "transfer_file.h"
34 #include "../librpc/gen_ndr/ndr_netlogon.h"
35 #include "../lib/tsocket/tsocket.h"
37 /* Samba debug class for VIRUSFILTER */
39 #define DBGC_CLASS virusfilter_debug_class
40 extern int virusfilter_debug_class
;
42 #define VIRUSFILTER_VERSION "0.1.5"
44 /* ====================================================================== */
47 VIRUSFILTER_ACTION_DO_NOTHING
,
48 VIRUSFILTER_ACTION_QUARANTINE
,
49 VIRUSFILTER_ACTION_RENAME
,
50 VIRUSFILTER_ACTION_DELETE
,
54 VIRUSFILTER_RESULT_OK
,
55 VIRUSFILTER_RESULT_CLEAN
,
56 VIRUSFILTER_RESULT_ERROR
,
57 VIRUSFILTER_RESULT_INFECTED
,
58 VIRUSFILTER_RESULT_SUSPECTED
,
59 /* FIXME: VIRUSFILTER_RESULT_RISKWARE, */
62 struct virusfilter_config
{
63 int scan_request_count
;
64 int scan_request_limit
;
66 /* Scan on file operations */
70 /* Special scan options */
72 int max_nested_scan_archive
;
74 bool block_suspected_file
;
81 struct name_compare_entry
*exclude_files
;
84 struct name_compare_entry
*infected_files
;
86 /* Scan result cache */
87 struct virusfilter_cache
*cache
;
88 int cache_entry_limit
;
91 /* Infected file options */
92 virusfilter_action infected_file_action
;
93 const char * infected_file_command
;
94 int infected_open_errno
;
95 int infected_close_errno
;
97 /* Scan error options */
98 const char * scan_error_command
;
99 int scan_error_open_errno
;
100 int scan_error_close_errno
;
101 bool block_access_on_error
;
103 /* Quarantine infected files */
104 const char * quarantine_dir
;
105 const char * quarantine_prefix
;
106 const char * quarantine_suffix
;
107 bool quarantine_keep_tree
;
108 bool quarantine_keep_name
;
109 mode_t quarantine_dir_mode
;
111 /* Rename infected files */
112 const char * rename_prefix
;
113 const char * rename_suffix
;
115 /* Network options */
116 const char * socket_path
;
117 struct virusfilter_io_handle
*io_h
;
119 /* The backend AV engine */
120 struct virusfilter_backend
*backend
;
123 struct virusfilter_backend_fns
{
125 struct vfs_handle_struct
*handle
,
126 struct virusfilter_config
*config
,
130 struct vfs_handle_struct
*handle
);
131 virusfilter_result (*scan_init
)(
132 struct virusfilter_config
*config
);
133 virusfilter_result (*scan
)(
134 struct vfs_handle_struct
*handle
,
135 struct virusfilter_config
*config
,
136 const struct files_struct
*fsp
,
139 struct virusfilter_config
*config
);
142 struct virusfilter_backend
{
145 const struct virusfilter_backend_fns
*fns
;
146 void *backend_private
;
149 int virusfilter_sophos_init(struct virusfilter_config
*config
);
150 int virusfilter_fsav_init(struct virusfilter_config
*config
);
151 int virusfilter_clamav_init(struct virusfilter_config
*config
);
152 int virusfilter_dummy_init(struct virusfilter_config
*config
);
154 #endif /* _VIRUSFILTER_COMMON_H */