git-svn: trunk@4847
Török Edvin authored on 2009/02/23 21:35:40... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Mon Feb 23 14:10:01 EET 2009 (edwin) |
|
2 |
+------------------------------------ |
|
3 |
+ * clamd/session.c: stop scanning when client disconnects in |
|
4 |
+ multiscan mode (bb #1417). |
|
5 |
+ |
|
1 | 6 |
Sat Feb 21 21:48:43 EET 2009 (edwin) |
2 | 7 |
------------------------------------ |
3 | 8 |
* Makefile.in, clamav-config.h.in, clamav-milter/, clamconf/, |
... | ... |
@@ -40,7 +40,9 @@ |
40 | 40 |
#include <sys/types.h> |
41 | 41 |
#ifndef C_WINDOWS |
42 | 42 |
#include <dirent.h> |
43 |
- |
|
43 |
+#ifdef HAVE_SYS_SELECT_H |
|
44 |
+#include <sys/select.h> |
|
45 |
+#endif |
|
44 | 46 |
#include <sys/socket.h> |
45 | 47 |
#ifdef HAVE_FD_PASSING |
46 | 48 |
#ifdef HAVE_SYS_UIO_H |
... | ... |
@@ -228,6 +230,20 @@ int command(client_conn_t *conn, int *virus) |
228 | 228 |
scandata.group = group = thrmgr_group_new(); |
229 | 229 |
break; |
230 | 230 |
case COMMAND_MULTISCANFILE: |
231 |
+ { |
|
232 |
+ fd_set rfds; |
|
233 |
+ struct timeval tv; |
|
234 |
+ |
|
235 |
+ FD_ZERO(&rfds); |
|
236 |
+ FD_SET(conn->sd, &rfds); |
|
237 |
+ tv.tv_sec = tv.tv_usec = 0; |
|
238 |
+ if (select(conn->sd+1, &rfds, NULL, NULL, &tv) > 0 && |
|
239 |
+ FD_ISSET(conn->sd, &rfds)) { |
|
240 |
+ logg("$Client disconnected while multiscan was active!\n"); |
|
241 |
+ thrmgr_group_terminate(conn->group); |
|
242 |
+ return CL_BREAK; |
|
243 |
+ } |
|
244 |
+ } |
|
231 | 245 |
thrmgr_setactivetask(NULL, "MULTISCANFILE"); |
232 | 246 |
scandata.group = NULL; |
233 | 247 |
scandata.type = TYPE_SCAN; |