samba-vscan/global vscan-fileaccesslog.c,1.8.2.2,1.8.2.3 vscan-filetype.c,1.3.2.8,1.3.2.9

Rainer Link <[email protected]> Fri, 24 Sep 2004 21:42:23 +0000
Newsgroups gmane.comp.security.virus.openantivirus.cvs
Message-ID <[email protected]>
Update of /cvsroot/openantivirus/samba-vscan/global
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5558/global

Modified Files:
      Tag: VSCAN_0_3
	vscan-fileaccesslog.c vscan-filetype.c 
Log Message:
some changes to make the code (esp. return values) more read-able


Index: vscan-filetype.c
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/global/vscan-filetype.c,v
retrieving revision 1.3.2.8
retrieving revision 1.3.2.9
diff -u -d -r1.3.2.8 -r1.3.2.9
--- vscan-filetype.c	2 May 2004 19:45:31 -0000	1.3.2.8
+++ vscan-filetype.c	24 Sep 2004 21:42:20 -0000	1.3.2.9
@@ -113,7 +113,7 @@
 
 		if ( !filetype_init_magic ) {
 			DEBUG(5, ("libmagic init has failed or exclude list is empty - feature disabled\n"));
-			return -1;
+			return VSCAN_FT_ERROR_MUST_SCAN;
 		}
 		
 		/* get the file type */
@@ -121,7 +121,7 @@
 		if ( ft_string == NULL ) {  /* error */
 			vscan_syslog("could not get file type, %s", magic_error(filetype_magic));
 			/* error occured */
-			return -1;
+			return VSCAN_FT_ERROR_MUST_SCAN;
 		} /* end if */ 
 		trim_string(ft_string, " ", " ");
 		/* hack alert ... */
@@ -142,13 +142,13 @@
 				/* file type is in exlude list */
 				DEBUG(5, ("file type '%s' is in exclude list\n", exclude));
 				/* advise to skip scanning of file */
-				return 1;
+				return VSCAN_FT_SKIP_SCAN;
 			} /* end if */
 		} /* end while */
 
 		/* file must be scanned */
 		DEBUG(5, ("no match - file must be scanned\n"));
-		return 0;
+		return VSCAN_FT_MUST_SCAN;
 }
 
 #else /* HAVE_FILETYPE_SUPPORT */

Index: vscan-fileaccesslog.c
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/global/vscan-fileaccesslog.c,v
retrieving revision 1.8.2.2
retrieving revision 1.8.2.3
diff -u -d -r1.8.2.2 -r1.8.2.3
--- vscan-fileaccesslog.c	6 Nov 2003 14:30:59 -0000	1.8.2.2
+++ vscan-fileaccesslog.c	24 Sep 2004 21:42:20 -0000	1.8.2.3
@@ -254,7 +254,7 @@
 	if ( lrufiles_max_entries <= 0 ) {
 		DEBUG(10, ("lru files feature is disabled, do nothing\n"));
 		/* do nothing, simply return 1 to advise scanning of file */
-		return 1;
+		return VSCAN_LRU_SCAN_FILE;
 	}
 
 	DEBUG(10, ("lookup '%s'\n", fname));
@@ -264,7 +264,7 @@
 		/* not found */ 
 		DEBUG(10, ("entry '%s' not found\n", fname));
 		/* file must be scanned */
-		return 1;
+		return VSCAN_LRU_SCAN_FILE;
 	} else {
 		if ( found->time_added > time(NULL) ) {
 			/* uhm, someone has changed the clock?!? */
@@ -272,14 +272,14 @@
 			DEBUG(10, ("Clock has changed. Invalidate '%s'\n", found->fname));
 			lrufiles_delete_p(found);
 			/* file must be scanned */
-			return 1;
+			return VSCAN_LRU_SCAN_FILE;
 		} else if ( time(NULL) >= (found->time_added + lrufiles_invalidate_time) ) {
 			/* lifetime expired */
 			/* remove entry, advide to scan */
                         DEBUG(10, ("Lifetime expired. Invalidate '%s'\n", found->fname));
 			lrufiles_delete_p(found);
 			/* file must be scanned */
-			return 1;
+			return VSCAN_LRU_SCAN_FILE;
 		} else {
 			if ( found->mtime == mtime ) {
 				/* found, not modified */
@@ -287,20 +287,20 @@
 				if ( found->infected ) {
 					DEBUG(10, ("entry '%s' marked as infected\n", fname));
 					/* file mark as infected, access must be denied */
-					return -1;
+					return VSCAN_LRU_DENY_ACCESS;
 				} else {
 					DEBUG(10, ("entry '%s' marked as not infected\n", fname));
 					/* ok, it's safe to grant access without virus scan */
-					return 0;
+					return VSCAN_LRU_GRANT_ACCESS;
 				}
 			} else {
 				/* found, was modified */
 				DEBUG(10, ("entry '%s' found, file was modified\n", fname));
 				/* file was modified, it must be scanned */
-				return 1;
+				return VSCAN_LRU_SCAN_FILE;
 			}
 		}
 	}
 	/* shouln't get there - but to be safe file must be scanned */
-	return 1;
+	return VSCAN_LRU_SCAN_FILE;
 }



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