samba3-vscan/antivir vscan-antivir.c,1.2,1.3

Rainer Link <[email protected]> Mon, 25 Jul 2005 14:14:03 +0000
Newsgroups gmane.comp.security.virus.openantivirus.cvs
Message-ID <[email protected]>
Update of /cvsroot/openantivirus/samba3-vscan/antivir
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27543

Modified Files:
	vscan-antivir.c 
Log Message:
some changes in logic


Index: vscan-antivir.c
===================================================================
RCS file: /cvsroot/openantivirus/samba3-vscan/antivir/vscan-antivir.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- vscan-antivir.c	23 Jul 2005 14:47:44 -0000	1.2
+++ vscan-antivir.c	25 Jul 2005 14:14:00 -0000	1.3
@@ -221,17 +221,26 @@
 	/* scan files while opening? */
 	if ( !vscan_config.common.scan_on_open ) {
 		DEBUG(3, ("samba-vscan - open: File '%s' not scanned as scan_on_open is not set\n", fname));
-		return SMB_VFS_NEXT_OPEN(handle, conn, fname, flags, mode);
 	}
-
-	if ( (SMB_VFS_NEXT_STAT(handle, conn, fname, &stat_buf)) != 0 )    /* an error occured */
-		return SMB_VFS_NEXT_OPEN(handle, conn, fname, flags, mode);
-	else if ( S_ISDIR(stat_buf.st_mode) ) 	/* is it a directory? */
-		return SMB_VFS_NEXT_OPEN(handle, conn, fname, flags, mode);
+	else if ( (SMB_VFS_NEXT_STAT(handle, conn, fname, &stat_buf)) != 0 )    /* an error occured */
+		if ( errno == ENOENT ) {
+			if ( verbose_file_logging )
+				vscan_syslog("INFO: File %s not found! Not scanned!", fname);
+		}
+		else {
+			vscan_syslog("ERROR: File %s not readable or an error occured", fname);
+		}
+	}
+	else if ( S_ISDIR(stat_buf.st_mode) ) { 	/* is it a directory? */
+		if ( verbose_file_logging )
+			vscan_syslog("INFO: File %s is a directory! Not scanned!", fname);
+	}
 	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 */
-		return SMB_VFS_NEXT_OPEN(handle, conn, fname, flags, mode);
+	else if ( stat_buf.st_size == 0 ) { /* do not scan empty files */
+		if ( vscan_config.common.verbose_file_logging )
+			vscan_syslog("INFO: File %s has size zero! Not scanned!", fname);
+	}
 	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);
@@ -239,7 +248,6 @@
 	else if ( filetype_skipscan(filepath) == VSCAN_FT_SKIP_SCAN ) {
 		if ( vscan_config.common.verbose_file_logging )
 			vscan_syslog("INFO: file '%s' not scanned as file type is on exclude list", filepath);
-		return SMB_VFS_NEXT_OPEN(handle, conn, fname, flags, mode);
 	} else
 	{
 		/* prepare file scan, (re)open connection to the scanner */



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click