1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
--- antivirus.c.orig Tue Jul 15 21:27:14 2003
+++ antivirus.c Wed Nov 17 07:19:12 2004
@@ -85,6 +85,8 @@
static char *FORMAT=NULL;
static sfsistat avfailcode=0;
static int purgevirus=0;
+static int skipwords=0;
+static int ignorerror2=0;
static char *avargs[]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
/*
@@ -128,6 +130,12 @@
#define FORMAT_SOPHOS ">>> Virus '%[^']s' found in file %*s"
/*
+** This one is for clamav
+*/
+#define FORMAT_CLAMAV " %s FOUND"
+#define SCANARGS_CLAMAV "--disable-summary"
+
+/*
** this can be given on the command line
*/
static char *configfile=NULL;
@@ -502,6 +510,7 @@
int retval;
int fd;
int i;
+ char *word;
char *p=NULL;
char *av[]={NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
@@ -552,13 +561,26 @@
(int)ctx, retval,priv->workdir);
}
+ if (ignorerror2 > 0 )
+ {
+ if ( retval == 2 )
+ retval = 0;
+ }
+
if (retval>0)
{
fseek(priv->childfp,0,SEEK_SET);
memset(viruses,0,sizeof(buf));
while (fgets(buf,sizeof(buf),priv->childfp)!=NULL)
{
- if (sscanf(buf,format,tmp)==1)
+ word = buf;
+ if (skipwords > 0 )
+ {
+ word = strchr( word, ' ' );
+ if ( word == NULL )
+ word = buf;
+ }
+ if (sscanf(word,format,tmp)==1)
{
if (viruses[0])
strncat(viruses," ",sizeof(viruses));
@@ -1211,6 +1233,7 @@
if (AVFAILACTION==NULL) AVFAILACTION=CONF_AVFAILACTION;
if (VIRUSACTION==NULL) VIRUSACTION=CONF_VIRUSACTION;
+ skipwords = 0;
if (strcasecmp(AVPRODUCT,"mcafee")==0)
{
FORMAT=FORMAT_MCAFEE;
@@ -1225,10 +1248,17 @@
{
FORMAT=FORMAT_FSAV;
}
+ else if (strcasecmp(AVPRODUCT,"clamav")==0)
+ {
+ FORMAT=FORMAT_CLAMAV;
+ AVSCANARGS=SCANARGS_CLAMAV;
+ skipwords = 1;
+ ignorerror2 = 1;
+ }
else
{
fprintf(stderr,"init(): unrecognized AVPRODUCT %s\n",AVPRODUCT);
- fprintf(stderr,"init(): valid values are: mcafee, fsva, sophos\n");
+ fprintf(stderr,"init(): valid values are: mcafee, fsva, sophos, clamav\n");
return(-1);
}
|