s3:rpc_client: Implement dcerpc_lsa_open_policy_fallback()
[Samba.git] / source3 / modules / vfs_virusfilter_common.h
blob24359bf5a3a0b53e113c835269552c0498dc18fd
1 /*
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
22 #include <stdint.h>
23 #include <time.h>
25 /* Samba common include file */
26 #include "includes.h"
28 #include "smbd/smbd.h"
29 #include "smbd/globals.h"
30 #include "system/filesys.h"
31 #include "transfer_file.h"
32 #include "auth.h"
33 #include "passdb.h"
34 #include "../librpc/gen_ndr/ndr_netlogon.h"
35 #include "../lib/tsocket/tsocket.h"
37 /* Samba debug class for VIRUSFILTER */
38 #undef DBGC_CLASS
39 #define DBGC_CLASS virusfilter_debug_class
40 extern int virusfilter_debug_class;
42 #define VIRUSFILTER_VERSION "0.1.5"
44 /* ====================================================================== */
46 typedef enum {
47 VIRUSFILTER_ACTION_DO_NOTHING,
48 VIRUSFILTER_ACTION_QUARANTINE,
49 VIRUSFILTER_ACTION_RENAME,
50 VIRUSFILTER_ACTION_DELETE,
51 } virusfilter_action;
53 typedef enum {
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, */
60 } virusfilter_result;
62 struct virusfilter_config {
63 int scan_request_count;
64 int scan_request_limit;
66 /* Scan on file operations */
67 bool scan_on_open;
68 bool scan_on_close;
70 /* Special scan options */
71 bool scan_archive;
72 int max_nested_scan_archive;
73 bool scan_mime;
74 bool block_suspected_file;
76 /* Size limit */
77 size_t max_file_size;
78 size_t min_file_size;
80 /* Exclude files */
81 name_compare_entry *exclude_files;
83 /* Infected files */
84 name_compare_entry *infected_files;
86 /* Scan result cache */
87 struct virusfilter_cache *cache;
88 int cache_entry_limit;
89 int cache_time_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 {
124 int (*connect)(
125 struct vfs_handle_struct *handle,
126 struct virusfilter_config *config,
127 const char *svc,
128 const char *user);
129 void (*disconnect)(
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,
137 char **reportp);
138 void (*scan_end)(
139 struct virusfilter_config *config);
142 struct virusfilter_backend {
143 unsigned version;
144 const char *name;
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 */