git-svn: trunk@4237
Tomasz Kojm authored on 2008/10/08 06:29:57... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Tue Oct 7 23:47:02 CEST 2008 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * clamdscan: properly handle --infected (bb#1221) |
|
4 |
+ |
|
1 | 5 |
Tue Oct 7 22:35:22 CEST 2008 (tk) |
2 | 6 |
---------------------------------- |
3 | 7 |
* shared/options.c: handle obsolete options in cmdline parser (bb#1213) |
... | ... |
@@ -39,8 +39,7 @@ |
39 | 39 |
|
40 | 40 |
void help(void); |
41 | 41 |
|
42 |
-short printinfected = 0; |
|
43 |
- |
|
42 |
+extern int printinfected; |
|
44 | 43 |
extern int notremoved, notmoved; |
45 | 44 |
|
46 | 45 |
static void print_server_version(const struct optstruct *opt) |
... | ... |
@@ -71,6 +70,7 @@ int main(int argc, char **argv) |
71 | 71 |
"stdout", "log", "move", "copy", "remove", |
72 | 72 |
"config-file", "no-summary", "fdpass", |
73 | 73 |
"disable-summary", "multiscan", "reload", |
74 |
+ "infected", |
|
74 | 75 |
NULL }; |
75 | 76 |
|
76 | 77 |
|
... | ... |
@@ -58,6 +58,7 @@ |
58 | 58 |
|
59 | 59 |
void move_infected(const char *filename, const struct optstruct *opt); |
60 | 60 |
int notremoved = 0, notmoved = 0; |
61 |
+int printinfected = 0; |
|
61 | 62 |
|
62 | 63 |
static int dsresult(int sockd, const struct optstruct *opt) |
63 | 64 |
{ |
... | ... |
@@ -135,7 +136,7 @@ static int dsfile(int sockd, const char *scantype, const char *filename, const s |
135 | 135 |
|
136 | 136 |
ret = dsresult(sockd, opt); |
137 | 137 |
|
138 |
- if(!ret) |
|
138 |
+ if(!ret && !printinfected) |
|
139 | 139 |
logg("~%s: OK\n", filename); |
140 | 140 |
|
141 | 141 |
return ret; |
... | ... |
@@ -448,7 +449,10 @@ int client(const struct optstruct *opt, int *infected) |
448 | 448 |
char buff[4096]; |
449 | 449 |
memset(buff, 0, sizeof(buff)); |
450 | 450 |
ret = clamd_fdscan(sockd, 0, buff, sizeof(buff)); |
451 |
- logg("fd: %s%s",buff, ret == 1 ? " FOUND" : ret == -1 ? " ERROR" : "OK"); |
|
451 |
+ if(ret == 1 || ret == -1) |
|
452 |
+ logg("fd: %s%s\n",buff, ret == 1 ? " FOUND" : " ERROR"); |
|
453 |
+ else if(!printinfected) |
|
454 |
+ logg("fd: OK\n"); |
|
452 | 455 |
} |
453 | 456 |
#endif |
454 | 457 |
} else |