samba-vscan/clamav vscan-clamav.c,1.1.2.15,1.1.2.16 vscan-clamav.conf,1.1.2.7,1.1.2.8 vscan-clamav.h,1.1.2.7,1.1.2.8 vscan-clamav_core.c,1.5.2.11,1.5.2.12

Rainer Link <[email protected]> Tue, 29 Mar 2005 19:16:49 +0000
Newsgroups gmane.comp.security.virus.openantivirus.cvs
Message-ID <[email protected]>
Update of /cvsroot/openantivirus/samba-vscan/clamav
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13043/clamav

Modified Files:
      Tag: VSCAN_0_3
	vscan-clamav.c vscan-clamav.conf vscan-clamav.h 
	vscan-clamav_core.c 
Log Message:
scan inside archives or not now configurable. Patch by Sven


Index: vscan-clamav.h
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/clamav/vscan-clamav.h,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -d -r1.1.2.7 -r1.1.2.8
--- vscan-clamav.h	29 Sep 2004 13:59:02 -0000	1.1.2.7
+++ vscan-clamav.h	29 Mar 2005 19:16:46 -0000	1.1.2.8
@@ -15,6 +15,8 @@
    socket name of Clam daemon */
 #define VSCAN_CLAMD_SOCKET_NAME      "/var/run/clamd"
 
+#define VSCAN_SCAN_ARCHIVES True
+
 /* Clam AntiVirus (libclamav) stuff:
    maximum number of files in archive */
 #define VSCAN_CL_MAXFILES 1000

Index: vscan-clamav.c
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/clamav/vscan-clamav.c,v
retrieving revision 1.1.2.15
retrieving revision 1.1.2.16
diff -u -d -r1.1.2.15 -r1.1.2.16
--- vscan-clamav.c	23 Feb 2005 02:49:37 -0000	1.1.2.15
+++ vscan-clamav.c	29 Mar 2005 19:16:45 -0000	1.1.2.16
@@ -58,6 +58,7 @@
 struct cl_limits clamav_limits;
 BOOL clamav_loaded = False;
 #else
+BOOL scanarchives;
 fstring clamd_socket_name;      /* name of clamd socket */
 #endif  
 
@@ -92,6 +93,10 @@
 			/* sanity check? */
 			clamav_limits.maxreclevel = atoi(value);
 			DEBUG(3, ("libclamav max recursion level limit is: %i\n", clamav_limits.maxreclevel));
+#else
+		} else if ( StrCaseCmp("scan archives", param) == 0 ) {
+			set_boolean(&scanarchives, value);
+			DEBUG(3, ("scan archives: %d\n", scanarchives));
 #endif
 		} else
         	        DEBUG(3, ("unknown parameter: %s\n", param));
@@ -146,6 +151,9 @@
 	clamav_limits.maxfilesize = VSCAN_CL_MAXFILESIZE;
 	clamav_limits.maxreclevel = VSCAN_CL_MAXRECLEVEL;
 #else
+	/* set default value for scanning archives */
+	scanarchives = VSCAN_SCAN_ARCHIVES;
+
         /* name of clamd socket */
         fstrcpy(clamd_socket_name, VSCAN_CLAMD_SOCKET_NAME);
 #endif

Index: vscan-clamav_core.c
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/clamav/vscan-clamav_core.c,v
retrieving revision 1.5.2.11
retrieving revision 1.5.2.12
diff -u -d -r1.5.2.11 -r1.5.2.12
--- vscan-clamav_core.c	18 Jan 2005 21:05:42 -0000	1.5.2.11
+++ vscan-clamav_core.c	29 Mar 2005 19:16:46 -0000	1.5.2.12
@@ -27,6 +27,7 @@
 extern struct cl_limits clamav_limits;
 extern BOOL clamav_loaded;
 #else
+extern BOOL scanarchives;
 extern fstring clamd_socket_name;
 #endif
 
@@ -115,6 +116,7 @@
     char *request = NULL;
     size_t len = 0;
     char buff[1024];   
+    char *scanart = NULL;
     FILE *fpin;
 
     /* open stream sockets */
@@ -127,7 +129,13 @@
     memset(buff, 0, sizeof(buff));
 
     /* +1 is for '\0' termination --metze */
-    len = strlen("SCAN ")+strlen(scan_file)+1;
+    if ( scanarchives ) {
+    	scanart = "SCAN ";
+    } else {
+    	scanart = "RAWSCAN ";
+    }
+    len = strlen(scanart)+strlen(scan_file)+1;
+
     /* prepare clamd command */
     if (!(request = (char *)malloc(len))) {
         vscan_syslog("ERROR: can not allocate memory");
@@ -137,7 +145,7 @@
     if (verbose_file_logging)
         vscan_syslog("INFO: Scanning file : '%s'", scan_file);
 
-    safe_strcpy(request, "SCAN ", len-1);
+    safe_strcpy(request, scanart, len-1);
     safe_strcat(request, scan_file, len-1); 
     if (write(sockfd, request, strlen(request)) != strlen(request)) {
         free(request);

Index: vscan-clamav.conf
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/clamav/vscan-clamav.conf,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -d -r1.1.2.7 -r1.1.2.8
--- vscan-clamav.conf	5 Feb 2005 14:01:38 -0000	1.1.2.7
+++ vscan-clamav.conf	29 Mar 2005 19:16:46 -0000	1.1.2.8
@@ -61,6 +61,10 @@
 ; libclamav is used
 clamd socket name = /var/run/clamd
 
+; scan inside of archives (only with clamd)
+; (default: yes)
+;scan archives = yes
+
 ; limits, if vscan-clamav was build for using the clamav library (libclamav)
 ; instead of clamd
 



-------------------------------------------------------
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