git-svn-id: file:///var/lib/svn/clamav-devel/trunk/clamav-devel@450 77e5149b-7576-45b1-b177-96237e5ba77b
Trog authored on 2004/03/29 23:34:01... | ... |
@@ -22,7 +22,7 @@ |
22 | 22 |
#define CL_DEFAULT_CFG CONFDIR"/clamav.conf" |
23 | 23 |
#define CL_DEFAULT_BACKLOG 15 |
24 | 24 |
#define CL_DEFAULT_MAXTHREADS 5 |
25 |
-#define CL_DEFAULT_SCANTIMEOUT 60 |
|
25 |
+#define CL_DEFAULT_SCANTIMEOUT 120 |
|
26 | 26 |
#define CL_DEFAULT_LOGSIZE 1048576 |
27 | 27 |
#define CL_DEFAULT_CLAMUKOMAXFILESIZE 5 * 1048576 |
28 | 28 |
#define CL_DEFAULT_SELFCHECK 3600 |
... | ... |
@@ -194,7 +194,7 @@ int scan(const char *filename, unsigned long int *scanned, const struct cl_node |
194 | 194 |
|
195 | 195 |
int scanstream(int odesc, unsigned long int *scanned, const struct cl_node *root, const struct cl_limits *limits, int options, const struct cfgstruct *copt) |
196 | 196 |
{ |
197 |
- int ret, portscan = CL_DEFAULT_MAXPORTSCAN, sockfd, port, acceptd, tmpd, bread, retval; |
|
197 |
+ int ret, portscan = CL_DEFAULT_MAXPORTSCAN, sockfd, port, acceptd, tmpd, bread, retval, timeout; |
|
198 | 198 |
long int size = 0, maxsize = 0; |
199 | 199 |
short bound = 0; |
200 | 200 |
const char *virname; |
... | ... |
@@ -221,6 +221,12 @@ int scanstream(int odesc, unsigned long int *scanned, const struct cl_node *root |
221 | 221 |
bound = 1; |
222 | 222 |
|
223 | 223 |
} |
224 |
+ |
|
225 |
+ if((cpt = cfgopt(copt, "ReadTimeout"))) { |
|
226 |
+ timeout = cpt->numarg; |
|
227 |
+ } else { |
|
228 |
+ timeout = CL_DEFAULT_SCANTIMEOUT; |
|
229 |
+ } |
|
224 | 230 |
|
225 | 231 |
if(!bound && !portscan) { |
226 | 232 |
mdprintf(odesc, "ERROR\n"); |
... | ... |
@@ -231,7 +237,7 @@ int scanstream(int odesc, unsigned long int *scanned, const struct cl_node *root |
231 | 231 |
mdprintf(odesc, "PORT %d\n", port); |
232 | 232 |
} |
233 | 233 |
|
234 |
- retval = poll_fd(sockfd, CL_DEFAULT_SCANTIMEOUT); |
|
234 |
+ retval = poll_fd(sockfd, timeout); |
|
235 | 235 |
switch (retval) { |
236 | 236 |
case 0: /* timeout */ |
237 | 237 |
mdprintf(sockfd, "ERROR\n"); |
... | ... |
@@ -268,7 +274,7 @@ int scanstream(int odesc, unsigned long int *scanned, const struct cl_node *root |
268 | 268 |
if((cpt = cfgopt(copt, "StreamMaxLength"))) |
269 | 269 |
maxsize = cpt->numarg; |
270 | 270 |
|
271 |
- while((retval = poll_fd(acceptd, CL_DEFAULT_SCANTIMEOUT)) == 1) { |
|
271 |
+ while((retval = poll_fd(acceptd, timeout)) == 1) { |
|
272 | 272 |
bread = read(acceptd, buff, sizeof(buff)); |
273 | 273 |
if (bread <= 0) { |
274 | 274 |
break; |
... | ... |
@@ -59,9 +59,16 @@ |
59 | 59 |
int command(int desc, const struct cl_node *root, const struct cl_limits *limits, int options, const struct cfgstruct *copt) |
60 | 60 |
{ |
61 | 61 |
char buff[1025]; |
62 |
- int bread, opt, ret, retval; |
|
62 |
+ int bread, opt, ret, retval, timeout; |
|
63 |
+ struct cfgstruct *cpt; |
|
63 | 64 |
|
64 |
- retval = poll_fd(desc, CL_DEFAULT_SCANTIMEOUT); |
|
65 |
+ if((cpt = cfgopt(copt, "ReadTimeout"))) { |
|
66 |
+ timeout = cpt->numarg; |
|
67 |
+ } else { |
|
68 |
+ timeout = CL_DEFAULT_SCANTIMEOUT; |
|
69 |
+ } |
|
70 |
+ |
|
71 |
+ retval = poll_fd(desc, timeout); |
|
65 | 72 |
switch (retval) { |
66 | 73 |
case 0: /* timeout */ |
67 | 74 |
mdprintf(desc, "ERROR\n"); |