samba-vscan/trend vscan-trend.c,1.47.2.3,1.47.2.4 vscan-trend.h,1.19.2.1,1.19.2.2
Rainer Link <[email protected]> Tue, 28 Sep 2004 15:54:39 +0000
| Newsgroups | gmane.comp.security.virus.openantivirus.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/openantivirus/samba-vscan/trend
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5612/trend
Modified Files:
Tag: VSCAN_0_3
vscan-trend.c vscan-trend.h
Log Message:
updated to use the new global configuration parsing module
Index: vscan-trend.h
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/trend/vscan-trend.h,v
retrieving revision 1.19.2.1
retrieving revision 1.19.2.2
diff -u -d -r1.19.2.1 -r1.19.2.2
--- vscan-trend.h 12 Sep 2003 07:12:17 -0000 1.19.2.1
+++ vscan-trend.h 28 Sep 2004 15:54:37 -0000 1.19.2.2
@@ -6,77 +6,14 @@
/* Configuration Section :-) */
-/* Trophie stuff:
- socket name of Trophie daemon */
-#define TROPHIE_SOCKET_NAME "/var/run/trophie"
-
/* default location of samba-style configuration file (needs Samba >= 2.2.4
or Samba 3.0 */
#define PARAMCONF "/etc/samba/vscan-trend.conf"
-
-/* False = log only infected file, True = log every file access */
-
-#ifndef VSCAN_VERBOSE_FILE_LOGGING
-# define VSCAN_VERBOSE_FILE_LOGGING False
-#endif
-
-/* if a file is bigger than VSCAN_MAX_SIZE it won't be scanned. Has to be
- specified in bytes! If it set to 0, the file size check is disabled */
-
-#ifndef VSCAN_MAX_SIZE
-# define VSCAN_MAX_SIZE 0
-#endif
-
-
-/* True = scan files on open */
-
-#ifndef VSCAN_SCAN_ON_OPEN
-# define VSCAN_SCAN_ON_OPEN True
-#endif
-
-/* True = scan files on close */
-
-#ifndef VSCAN_SCAN_ON_CLOSE
-# define VSCAN_SCAN_ON_CLOSE False
-#endif
-
-/* True = deny access in case of virus scanning failure */
-
-#ifndef VSCAN_DENY_ACCESS_ON_ERROR
-# define VSCAN_DENY_ACCESS_ON_ERROR True
-#endif
-
-/* True = deny access in case of minor virus scanning failure */
-
-#ifndef VSCAN_DENY_ACCESS_ON_MINOR_ERROR
-# define VSCAN_DENY_ACCESS_ON_MINOR_ERROR True
-#endif
-
-/* True = send a warning message via window messenger service for viruses found */
-
-#ifndef VSCAN_SEND_WARNING_MESSAGE
-# define VSCAN_SEND_WARNING_MESSAGE True
-#endif
-
-/* default infected file action */
-#define VSCAN_INFECTED_FILE_ACTION INFECTED_QUARANTINE
-
-/* default quarantine settings; hopefully the user changes this */
-#define VSCAN_QUARANTINE_DIRECTORY "/tmp"
-#define VSCAN_QUARANTINE_PREFIX "vir-"
-
-/* set default value for maximum lrufile entries */
-#define VSCAN_MAX_LRUFILES 100
-
-/* time after an entry is considered as expired */
-#define VSCAN_LRUFILES_INVALIDATE_TIME 5
-
-/* MIME-types of files to be exluded from scanning; that's an
- semi-colon seperated list */
-#define VSCAN_FT_EXCLUDE_LIST ""
-
+/* Trophie stuff:
+ socket name of Trophie daemon */
+#define TROPHIE_SOCKET_NAME "/var/run/trophie"
/* End Configuration Section */
Index: vscan-trend.c
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/trend/vscan-trend.c,v
retrieving revision 1.47.2.3
retrieving revision 1.47.2.4
diff -u -d -r1.47.2.3 -r1.47.2.4
--- vscan-trend.c 25 Sep 2004 12:27:09 -0000 1.47.2.3
+++ vscan-trend.c 28 Sep 2004 15:54:37 -0000 1.47.2.4
@@ -45,112 +45,27 @@
#define VSCAN_MODULE_STR "vscan-trend"
-fstring config_file; /* location of config file, either
- PARAMCONF or as set via vfs options
- */
-
-ssize_t max_size; /* do not scan files greater than max_size
- if max_size = 0, scan any file
- */
+vscan_config_struct vscan_config; /* contains the vscan module configuration */
BOOL verbose_file_logging; /* log ever file access */
-
-BOOL scan_on_open; /* scan a file before it is opened
- Defaults to True
- */
-
-BOOL scan_on_close; /* scan a new file put on share or
- if file was modified
- Defaults to False
- */
-
-BOOL deny_access_on_error; /* if connection to daemon fails, should access to any
- file be denied? Defaults to True
- */
-
-
-BOOL deny_access_on_minor_error; /* if daemon returns non-critical error,
- should access to the file be denied? */
-
BOOL send_warning_message; /* send a warning message using the windows
messenger service? */
-fstring trophie_socket_name; /* name of Trophie socket */
-
-fstring quarantine_dir; /* directory for infected files */
-fstring quarantine_prefix; /* prefix for infected files */
-
-enum infected_file_action_enum infected_file_action; /* what to do with infected files;
- defaults to quarantine */
-
-int max_lrufiles; /* specified the maximum entries in lrufiles list */
-time_t lrufiles_invalidate_time; /* specified the time in seconds after the lifetime
- of an entry is expired and entry will be invalidated */
-
-pstring exclude_file_types; /* list of file types which should be excluded from scanning */
-
-
/* module version */
static const char module_id[]=VSCAN_MODULE_STR" "SAMBA_VSCAN_VERSION_STR;
static BOOL do_parameter(const char *param, const char *value)
{
- if ( StrCaseCmp("max file size", param) == 0 ) {
- /* FIXME: sanity check missing! what, if value is out of range?
- atoi returns int - what about LFS? atoi should be avoided!
- */
- max_size = atoi(value);
- DEBUG(3, ("max file size is: %d\n", max_size));
- } else if ( StrCaseCmp("verbose file logging", param) == 0 ) {
- set_boolean(&verbose_file_logging, value);
- DEBUG(3, ("verbose file logging is: %d\n", verbose_file_logging));
- } else if ( StrCaseCmp("scan on open", param) == 0 ) {
- set_boolean(&scan_on_open, value);
- DEBUG(3, ("scan on open: %d\n", scan_on_open));
- } else if ( StrCaseCmp("scan on close", param) == 0 ) {
- set_boolean(&scan_on_close, value);
- DEBUG(3, ("scan on close is: %d\n", scan_on_close));
- } else if ( StrCaseCmp("deny access on error", param) == 0 ) {
- set_boolean(&deny_access_on_error, value);
- DEBUG(3, ("deny access on error is: %d\n", deny_access_on_error));
- } else if ( StrCaseCmp("deny access on minor error", param) == 0 ) {
- set_boolean(&deny_access_on_minor_error, value);
- DEBUG(3, ("deny access on minor error is: %d\n", deny_access_on_minor_error));
- } else if ( StrCaseCmp("send warning message", param) == 0 ) {
- set_boolean(&send_warning_message, value);
- DEBUG(3, ("send warning message is: %d\n", send_warning_message));
- } else if ( StrCaseCmp("infected file action", param) == 0 ) {
- if (StrCaseCmp("quarantine", value) == 0) {
- infected_file_action = INFECTED_QUARANTINE;
- } else if (StrCaseCmp("delete", value) == 0) {
- infected_file_action = INFECTED_DELETE;
- } else if (StrCaseCmp("nothing", value) == 0) {
- infected_file_action = INFECTED_DO_NOTHING;
- } else {
- DEBUG(2, ("samba-vscan: badly formed infected file action in configuration file, parameter %s\n", value));
+ if ( do_common_parameter(&vscan_config, param, value) == False ) {
+ /* parse VFS module specific configuration values */
+ if ( StrCaseCmp("trophie socket name", param) == 0) {
+ fstrcpy(trophie_socket_name, value);
+ DEBUG(3, ("trophie socket name is %s\n", trophie_socket_name));
+ } else
+ DEBUG(3, ("unknown parameter: %s\n", param));
}
- DEBUG(3, ("infected file action is: %d\n", infected_file_action));
- } else if ( StrCaseCmp("quarantine directory", param) == 0 ) {
- fstrcpy(quarantine_dir, value);
- DEBUG(3, ("quarantine directory is: %s\n", quarantine_dir));
- } else if ( StrCaseCmp("quarantine prefix", param) == 0 ) {
- fstrcpy(quarantine_prefix, value);
- DEBUG(3, ("quarantine prefix is: %s\n", quarantine_prefix));
- } else if ( StrCaseCmp("max lru files entries", param) == 0 ) {
- max_lrufiles = atoi(value);
- DEBUG(3, ("max lru files entries is: %d\n", max_lrufiles));
- } else if ( StrCaseCmp("lru file entry lifetime", param) == 0 ) {
- lrufiles_invalidate_time = atol(value);
- DEBUG(3, ("lru file entry lifetime is: %li\n", (long)lrufiles_invalidate_time));
- } else if ( StrCaseCmp("exclude file types", param) == 0 ) {
- pstrcpy(exclude_file_types, value);
- DEBUG(3, ("Exclude list is: %s\n", exclude_file_types));
- } else if ( StrCaseCmp("trophie socket name", param) == 0) {
- fstrcpy(trophie_socket_name, value);
- DEBUG(3, ("trophie socket name is %s\n", trophie_socket_name));
- } else
- DEBUG(3, ("unknown parameter: %s\n", param));
+ }
return True;
}
-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM.
Deadline: Sept. 24. Go here: http://sf.net/ppc_contest.php