samba-vscan/kaspersky vscan-kavp.c,1.38.2.5,1.38.2.6 vscan-kavp.conf,1.7.2.5,1.7.2.6

Rainer Link <[email protected]> Sun, 10 Apr 2005 15:22:54 +0000
Newsgroups gmane.comp.security.virus.openantivirus.cvs
Message-ID <[email protected]>
Update of /cvsroot/openantivirus/samba-vscan/kaspersky
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8392/kaspersky

Modified Files:
      Tag: VSCAN_0_3
	vscan-kavp.c vscan-kavp.conf 
Log Message:
use file regexp stuff
modified some syslog satements to contain the INFO tag
some other small changes


Index: vscan-kavp.c
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/kaspersky/vscan-kavp.c,v
retrieving revision 1.38.2.5
retrieving revision 1.38.2.6
diff -u -d -r1.38.2.5 -r1.38.2.6
--- vscan-kavp.c	23 Feb 2005 02:49:38 -0000	1.38.2.5
+++ vscan-kavp.c	10 Apr 2005 15:22:52 -0000	1.38.2.6
@@ -152,6 +152,8 @@
 	DEBUG(5, ("init file type\n"));
 	filetype_init(0, vscan_config.common.exclude_file_types);
 
+        /* initialise file regexp */
+        fileregexp_init(vscan_config.common.exclude_file_regexp);
 
 	#if (SMB_VFS_INTERFACE_VERSION >= 6)
 	 return SMB_VFS_NEXT_CONNECT(handle, conn, svc, user);
@@ -226,12 +228,12 @@
         	if ( (SMB_VFS_NEXT_STAT(handle, conn, fname, &stat_buf)) != 0 ) {    /* an error occured */ 
 			vscan_kavp_end();
 			return SMB_VFS_NEXT_OPEN(handle, conn, fname, flags, mode);
-			}
+		}
 #else
 	        if ( (default_vfs_ops.stat(conn, fname, &stat_buf)) != 0 ) {   /* an error occured */ 
 			vscan_kavp_end();
 			return default_vfs_ops.open(conn, fname, flags, mode);
-			}
+		}
 #endif
 		else if ( S_ISDIR(stat_buf.st_mode) ) { 	/* is it a directory? */
 			vscan_kavp_end();
@@ -240,10 +242,10 @@
 #else
 			return default_vfs_ops.open(conn, fname, flags, mode);
 #endif
-			}
+		}
 		else if ( ( stat_buf.st_size > vscan_config.common.max_size ) && ( vscan_config.common.max_size > 0 ) ) { /* file is too large */
 			vscan_syslog("INFO: File %s is larger than specified maximum file size! Not scanned!", fname);
-			}
+		}
 		else if ( stat_buf.st_size == 0 ) { /* do not scan empty files */
 			vscan_kavp_end();
 #if (SMB_VFS_INTERFACE_VERSION >= 6)
@@ -251,16 +253,21 @@
 #else
 			return default_vfs_ops.open(conn, fname, flags, mode);
 #endif
-			}
+		}
+		else if ( fileregexp_skipscan(filepath) == VSCAN_FR_SKIP_SCAN ) {
+	                if ( vscan_config.common.verbose_file_logging )
+        	                vscan_syslog("INFO: file '%s' not scanned as file is machted by exclude regexp", filepath);
+        	}
+
 		else if ( filetype_skipscan(filepath) == VSCAN_FT_SKIP_SCAN ) {
 			if ( vscan_config.common.verbose_file_logging )
-				vscan_syslog("File '%s' not scanned as file type is on exclude list", filepath);
+				vscan_syslog("INFO: File '%s' not scanned as file type is on exclude list", filepath);
 #if (SMB_VFS_INTERFACE_VERSION >= 6)
 	                return SMB_VFS_NEXT_OPEN(handle, conn, fname, flags, mode);
 #else
         	        return default_vfs_ops.open(conn, fname, flags, mode);
 #endif
-			}
+		}
 
 		else {
 
@@ -273,7 +280,7 @@
                                 /* file has already been checked and marked as infected */
                                 /* deny access */
                                 if ( vscan_config.common.verbose_file_logging )
-                                        vscan_syslog("File '%s' has already been scanned and marked as infected. Not scanned any more. Access denied", filepath);
+                                        vscan_syslog("INFO: File '%s' has already been scanned and marked as infected. Not scanned any more. Access denied", filepath);
 			
 				/* close socket */
 				vscan_kavp_end();
@@ -284,7 +291,7 @@
                         } else if ( must_be_checked == VSCAN_LRU_GRANT_ACCESS )  {
                                 /* file has already been checked, not marked as infected and not modified */
                                 if ( vscan_config.common.verbose_file_logging )
-                                        vscan_syslog("File '%s' has already been scanned, not marked as infected and not modified. Not scanned anymore. Access granted", filepath);
+                                        vscan_syslog("INFO: File '%s' has already been scanned, not marked as infected and not modified. Not scanned anymore. Access granted", filepath);
 
 				/* close socket */
 				vscan_kavp_end();
@@ -398,10 +405,17 @@
 		return retval;
 	}
 
+        /* dont' scan file which matches exclude regexp */
+        if ( fileregexp_skipscan(filepath) == VSCAN_FR_SKIP_SCAN ) {
+                if ( vscan_config.common.verbose_file_logging )
+                        vscan_syslog("INFO: file '%s' not scanned as file is machted by exclude regexp", filepath);
+                return retval;
+        }
+
 	/* don't scan files which are in the list of exclude file types */
 	if ( filetype_skipscan(filepath) == VSCAN_FT_SKIP_SCAN ) {
                 if ( vscan_config.common.verbose_file_logging )
-                        vscan_syslog("File '%s' not scanned as file type is on exclude list", filepath);
+                        vscan_syslog("INFO: file '%s' not scanned as file type is on exclude list", filepath);
 		return retval;
 	}
 

Index: vscan-kavp.conf
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/kaspersky/vscan-kavp.conf,v
retrieving revision 1.7.2.5
retrieving revision 1.7.2.6
diff -u -d -r1.7.2.5 -r1.7.2.6
--- vscan-kavp.conf	7 Dec 2004 21:57:26 -0000	1.7.2.5
+++ vscan-kavp.conf	10 Apr 2005 15:22:52 -0000	1.7.2.6
@@ -52,6 +52,9 @@
 ; seperated list (default: empty list). Use this with care!
 exclude file types =
 
+; exclude files from being scanned via regular expression (PCRE)
+; (default: empty)
+exclude file regexp =
 
 ; name of kavdaemon socket file (default: /var/run/AvpCtl)
 avp socket file = /var/run/AvpCtl



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click