samba-vscan/nai vscan-mcdaemon.c,1.1.2.2,1.1.2.3 vscan-mcdaemon.h,1.1.2.2,1.1.2.3

Rainer Link <[email protected]>
Newsgroups gmane.comp.security.virus.openantivirus.cvs
Message-ID <[email protected]>
Update of /cvsroot/openantivirus/samba-vscan/nai
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18571

Modified Files:
      Tag: VSCAN_0_3
	vscan-mcdaemon.c vscan-mcdaemon.h 
Log Message:
some more fixes and updates


Index: vscan-mcdaemon.h
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/nai/Attic/vscan-mcdaemon.h,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- vscan-mcdaemon.h	5 Dec 2003 14:29:53 -0000	1.1.2.2
+++ vscan-mcdaemon.h	3 Apr 2004 11:57:21 -0000	1.1.2.3
@@ -67,6 +67,10 @@
 /* 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 ""
+
 /* IP:PORT OAV ScannerDaemon listens on */
 #define VSCAN_MCDAEMON_IP	"127.0.0.1"
 #define VSCAN_MCDAEMON_PORT 	8128

Index: vscan-mcdaemon.c
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/nai/Attic/vscan-mcdaemon.c,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -d -r1.1.2.2 -r1.1.2.3
--- vscan-mcdaemon.c	5 Dec 2003 14:29:53 -0000	1.1.2.2
+++ vscan-mcdaemon.c	3 Apr 2004 11:57:21 -0000	1.1.2.3
@@ -220,6 +220,8 @@
         /* time after an entry is considered as expired */
         lrufiles_invalidate_time = VSCAN_LRUFILES_INVALIDATE_TIME;
 
+	/* file type exclude ist */
+	pstrcpy(exclude_file_types, VSCAN_FT_EXCLUDE_LIST);   
 
 	vscan_syslog("INFO: connect to service %s by user %s", 
 	       svc, user);
@@ -305,10 +307,15 @@
 	SMB_STRUCT_STAT stat_buf;
 	int sockfd;
 	pstring filepath;
-	char client_ip[18];
+	char client_ip[CLIENT_IP_SIZE];
 
 	int rc;
 
+	/* Assemble complete file path */
+	pstrcpy(filepath, conn->connectpath);
+	pstrcat(filepath, "/");
+	pstrcat(filepath, fname);
+
         /* scan files while opening? */
         if ( !scan_on_open ) {
                 /* we should use vscan_syslog instead of DEBUG here ... */
@@ -361,13 +368,8 @@
                         return -1;
 		} else if ( sockfd >= 0 ) 
 		{
-	                /* Assemble complete file path */       
-        	        fstrcpy(filepath, conn->connectpath);
-	                fstrcat(filepath, "/");  /* is "/" correct? */
-	                fstrcat(filepath, fname);       
-
-			fstrcpy(client_ip, conn->client_address);
-
+			/* get client IP */
+			safe_strcpy(client_ip, conn->client_address, CLIENT_IP_SIZE -1);			
                         /* must file actually be scanned? */
                         must_be_checked = lrufiles_must_be_checked(filepath, stat_buf.st_mtime);
                         if ( must_be_checked == -1 ) {
@@ -469,7 +471,7 @@
 	pstring filepath;
         int retval, rv, rc;
 	int sockfd;
-	char client_ip[18];
+	char client_ip[CLIENT_IP_SIZE];
 
         /* First close the file */
 #if (SMB_VFS_INTERFACE_VERSION >= 6)
@@ -486,15 +488,15 @@
 
 
 	/* get the file name */
-        fstrcpy(filepath, fsp->conn->connectpath);
-        fstrcat(filepath, "/"); 
-        fstrcat(filepath, fsp->fsp_name);        
+        pstrcpy(filepath, fsp->conn->connectpath);
+        pstrcat(filepath, "/"); 
+        pstrcat(filepath, fsp->fsp_name);        
 	
         /* Don't scan directorys */
         if ( fsp->is_directory )
             return retval;
 
-
+	/* don't scan files which have not been modified */
 	if ( !fsp->modified ) {
                 if ( verbose_file_logging ) 
                         vscan_syslog("INFO: file %s was not modified - not scanned", filepath);
@@ -502,19 +504,19 @@
 		return retval;
 	}
 
-        /* don't scan files which are in the list of exclude file types */
-        if ( filetype_skipscan(filepath) == 1 ) {
+	/* don't scan files which are in the list of exclude file types */
+	if ( filetype_skipscan(filepath) == 1 ) {
                 if ( verbose_file_logging )
                         vscan_syslog("File '%s' not scanned as file type is on exclude list", filepath);
-                return retval;
-        }
+		return retval;
+	}
 
 
 	/* scan only file, do nothing */	
         sockfd = vscan_mcdaemon_init();
 
         if ( sockfd >= 0 ) {
-		fstrcpy(client_ip, fsp->conn->client_address);
+		safe_strcpy(client_ip, fsp->conn->client_address, CLIENT_IP_SIZE -1);
 		rv = vscan_mcdaemon_scanfile(sockfd, filepath, client_ip);
 		vscan_mcdaemon_end(sockfd);
 		if ( rv == 1 ) {



-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.