samba-vscan/clamav vscan-clamav.c,1.1.2.5,1.1.2.6 vscan-clamav.h,1.1.2.5,1.1.2.6 vscan-clamav_core.c,1.5.2.6,1.5.2.7 vscan-clamav_core.h,1.1.2.1,1.1.2.2
Rainer Link <[email protected]> Thu, 09 Sep 2004 13:01:32 +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-serv6565
Modified Files:
Tag: VSCAN_0_3
vscan-clamav.c vscan-clamav.h vscan-clamav_core.c
vscan-clamav_core.h
Log Message:
The functions programmed in vscan-clamav_core.c are declared in
vscan-clamav_core.h and the other declerations are cleared
Only the functions that are needed by the library or the daemon version
are declared and called by the specific versions
Patch by Helmut
Index: vscan-clamav.h
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/clamav/vscan-clamav.h,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -d -r1.1.2.5 -r1.1.2.6
--- vscan-clamav.h 8 Sep 2004 16:13:19 -0000 1.1.2.5
+++ vscan-clamav.h 9 Sep 2004 13:01:30 -0000 1.1.2.6
@@ -2,6 +2,7 @@
#define __VSCAN_CLAMAV_H_
#include "vscan-global.h"
+#include "vscan-clamav_core.h"
/* Configuration Section :-) */
@@ -86,21 +87,4 @@
/* End Configuration Section */
-/* functions by vscan-clamav_core */
-/* opens socket */
-int vscan_clamav_init(void);
-
-void vscan_clamav_lib_init();
-void vscan_clamav_lib_done();
-
-
-#ifdef LIBCLAMAV
-int vscan_clamav_scanfile_lib(char* scan_file, char* client_ip);
-#else
-/* scans a file */
-int vscan_clamav_scanfile(int sockfd, char *scan_file, char *client_ip);
-/* closes socket */
-void vscan_clamav_end(int sockfd);
-#endif
-
#endif /* __VSCAN_CLAMAV_H_ */
Index: vscan-clamav.c
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/clamav/vscan-clamav.c,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -d -r1.1.2.5 -r1.1.2.6
--- vscan-clamav.c 8 Sep 2004 16:13:19 -0000 1.1.2.5
+++ vscan-clamav.c 9 Sep 2004 13:01:29 -0000 1.1.2.6
@@ -451,7 +451,7 @@
/* scan file */
#ifdef LIBCLAMAV
- retval = vscan_clamav_scanfile_lib(filepath, client_ip);
+ retval = vscan_clamav_lib_scanfile(filepath, client_ip);
#else
retval = vscan_clamav_scanfile(sockfd, filepath, client_ip);
#endif
@@ -528,7 +528,9 @@
{
pstring filepath;
int retval, rv, rc;
+#ifndef LIBCLAMAV
int sockfd;
+#endif
char client_ip[CLIENT_IP_SIZE];
/* First close the file */
@@ -569,12 +571,14 @@
}
+#ifndef LIBCLAMAV
sockfd = vscan_clamav_init();
if ( sockfd >= 0 ) {
+#endif
safe_strcpy(client_ip, fsp->conn->client_address, CLIENT_IP_SIZE -1);
/* scan only file, do nothing */
#ifdef LIBCLAMAV
- rv = vscan_clamav_scanfile_lib(filepath, client_ip);
+ rv = vscan_clamav_lib_scanfile(filepath, client_ip);
#else
rv = vscan_clamav_scanfile(sockfd, filepath, client_ip);
vscan_clamav_end(sockfd);
@@ -587,8 +591,9 @@
rc = vscan_do_infected_file_action(&default_vfs_ops, fsp->conn, filepath, quarantine_dir, quarantine_prefix, infected_file_action);
#endif
}
-
+#ifndef LIBCLAMAV
}
+#endif
return retval;
}
Index: vscan-clamav_core.c
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/clamav/vscan-clamav_core.c,v
retrieving revision 1.5.2.6
retrieving revision 1.5.2.7
diff -u -d -r1.5.2.6 -r1.5.2.7
--- vscan-clamav_core.c 8 Sep 2004 16:13:19 -0000 1.5.2.6
+++ vscan-clamav_core.c 9 Sep 2004 13:01:30 -0000 1.5.2.7
@@ -50,9 +50,8 @@
}
}
-#endif /* LIBCLAMAV */
-
+#else /* LIBCLAMAV */
/* initialise socket to clamd
returns -1 on error or the socket descriptor */
@@ -74,12 +73,13 @@
vscan_send_warning_message(infected_file, results, client_ip);
}
+#endif /* LIBCLAMAV */
#ifdef LIBCLAMAV
/* Scan a file using lib clamav
Returns -2 on minor error, -1 on error, 0 if a no virus was found, 1 if a virus was found
*/
-int vscan_clamav_scanfile_lib(char* scan_file, char* client_ip)
+int vscan_clamav_lib_scanfile(char* scan_file, char* client_ip)
{
int ret;
unsigned long int size = 0;
@@ -106,7 +106,7 @@
return -2;
}
-#endif
+#else /* LIBCLAMAV */
/*
Scans a file (*FILE*, not a directory - keep that in mind) for a virus
@@ -196,6 +196,7 @@
vscan_syslog("ERROR: can not get result from clamd");
return -1;
}
+#endif /* LIBCLAMAV */
#ifdef LIBCLAMAV
@@ -203,7 +204,7 @@
{
cl_freetrie(clamav_root);
}
-#endif
+#else /* LIBCLAMAV */
/*
close socket
@@ -215,3 +216,4 @@
}
+#endif /* LIBCLAMAV */
Index: vscan-clamav_core.h
===================================================================
RCS file: /cvsroot/openantivirus/samba-vscan/clamav/vscan-clamav_core.h,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -d -r1.1.2.1 -r1.1.2.2
--- vscan-clamav_core.h 14 Jul 2003 13:09:15 -0000 1.1.2.1
+++ vscan-clamav_core.h 9 Sep 2004 13:01:30 -0000 1.1.2.2
@@ -3,4 +3,22 @@
#include "vscan-clamav.h"
+#ifdef LIBCLAMAV
+/* load signature tree */
+void vscan_clamav_lib_init();
+/* cleanup signature tree */
+void vscan_clamav_lib_done();
+/* scans a file */
+int vscan_clamav_lib_scanfile(char *scan_file, char *client_ip);
+
+#else
+/* opens socket */
+int vscan_clamav_init(void);
+/* closes socket */
+void vscan_clamav_end(int sockfd);
+/* scans a file */
+int vscan_clamav_scanfile(int sockfd, char *scan_file, char *client_ip);
+
+#endif
+
#endif /* __VSCAN_CLAMAV_CORE_H */
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click