Török Edvin
80681b50c7
Initialize mutex.
...
Fix poll_fd to properly lock/unlock mutex.
This fixes the STREAM command.
git-svn: trunk@4787
17 years ago
Török Edvin
36784cad4b
fix nFILDES command
...
git-svn: trunk@4783
17 years ago
Tomasz Kojm
086eab5c26
update old copyright headers
...
git-svn: trunk@4775
17 years ago
Török Edvin
6e3256f492
Unify error paths.
...
Remove unix socket we created if startup fails due to invalid config.
git-svn: trunk@4768
17 years ago
Török Edvin
949c6fe54f
merge from clamd-proto branch:
...
handle multiple %v parameters
introduce poll_fds that also does the read into a buffer
introduce thrmgr_group* commands for keeping track of groups of commands
(multiscan, IDSESSION)
introduce 2 queues in thrmgr, multiscan queues get lower priority. Commands
are processed from both queues in a 4:1 ratio to avoid starvation.
unify reply code: conn_reply*
unify scanner code into scan_callback that is called from cli_ftw
multiscan doesn't need stat() now if readdir() provides dt_type
redesign clamd main loop: there is now an accept thread, and a
recv()/dispatch thread, +MaxThreads worker (scanner) threads.
introduce limiting on commands when worker threads are contended.
introduce IDSESSION, a replacement for the old SESSION command, that allows
asyncronous (scan) commands and scan replies
introduce INSTREAM that allows sending the data to scan on same connection
(vs STREAM that requires another port)
introduce zCOMMANDS
git-svn: trunk@4755
17 years ago
Török Edvin
004f8386ce
output "stream" instead of "fd[]" for INSTREAM.
...
Add INSTREAM command test.
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4753 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
0115f12ffc
fix some more warnings
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4746 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
10ab5e32f4
fix some compiler warnings
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4745 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
9ef7e0bdae
fix memory leaks
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4743 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
d0f6ecae1c
Never close a file descriptor that is monitored using
...
poll()/select() from another thread.
It introduces subtle bugs.
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4742 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
f243f00fc5
fix some races reported by valgrind
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4737 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
bac978a8f8
move the break to the proper place, so we don't parse same command twice!
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4734 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
0c8c3a5463
fix use-after-free
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4732 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
699bfc282c
dumpname(filename) is going to be dispatched, don't allow a later error path to
...
free it.
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4728 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
91cafbe095
break loop
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4727 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
3f26090eb7
clamdscan doesn't give us any deadbeef any more, so don't look for it.
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4725 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Tomasz Kojm
00eab4092f
clamd/others.c: handle multiple %v parameters
...
clamd/server-th.c: fix dbstat memleak
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4724 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
aCaB
544e7fd814
allow clamd to be stopped and backgrounded
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4721 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
30e36bfb5c
fix build
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4720 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
4f266591a0
fix INSTREAM when not in IDSESSION mode
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4718 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
e640277428
fix INSTREAM/IDSESSION.
...
Introduced a chunksize marker.
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4717 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
467ac26c95
fix INSTREAM end handling
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4715 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
76f21b4a30
introduce RR of connections.
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4713 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
e001f2838e
Use 2 queues: one for single, one for bulk messages.
...
Also introduce MaxQueue, this will prevent clamdscan from flooding
clamd with too many FILDES requests.
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4710 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
fd468937fc
keep MODE_WAITREPLY in select still, so if garbage is sent we can close.
...
Though when poll says that socket is closed, we shouldn't try closing again
if we're in WAIT_REPLY mode (since we alraedy closed it from another thread).
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4698 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
07ac8bb23a
also remove socket from tracked sockets after switching mode to WAITREPLY.
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4697 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
869d03832d
add proto debug messages to LogVerbose temporarely
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4696 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
8f74b8e4ee
handle multiple commands and ancillary data in one packet
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4692 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
8eac8d3e88
fix FILDES infloop
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4690 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
060c6715bb
introduce MODE_WAITREPLY.
...
MULTISCAN now quits if client quits
(TODO: CONTSCAN/SCAN should have a group too!)
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4685 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
2ea8946280
don't execute commands if client disconnected.
...
fix MULTISCAN
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4682 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
ef4ed2e180
preliminary INSTREAM support.
...
TODO: the code starts to look ugly, clean up the code.
INSTREAM shouldn't reply fd[]
make jobgroup own the resources (sockets, tempfiles)
allow to notify jobgroup to terminate when remote disconnects
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4681 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
54c1f41b34
unify replies: add ids on all replies from IDSESSION.
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4679 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
ac30aff8ea
properly close disconnected sockets
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4674 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
98dcb91ef0
reject invalid commands
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4673 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
937c8ec187
preliminary ID support, only on engine messages, not clamd messages
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4672 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
79b43cf868
preliminary IDSESSION support, no IDs yet
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4671 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
28e89f60ca
fix warnings
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4669 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
cc59cb00db
temp commit
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4668 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
ed2b37c685
another temp commit
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4667 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
3de54fe471
WIP switch to new multiscan code.
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4655 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
7a95bd5795
tell accept to quit before we start waiting for threads to quit.
...
Show a verbose message that we are waiting for threads to quit.
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4649 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
e66fd86ac0
fix FILDES
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4644 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
14ccb41923
fix replies to honor zCMDs
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4639 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
58b5cb19a6
fix poll, we add a new fd so we need to iterate on old nfds.
...
Various other work on recursion, unified scan, etc.
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4635 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
dc3a1def55
acceptloop/recvloop as in bb #1339
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4624 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
cb95779e9c
remove fd from poll list, before closing it, handle EBADF in select.
...
If select/poll fails for reason other than EINTR, make that error fatal.
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4623 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
aCaB
3ec259a602
preliminary zCMD sport
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4609 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
6eea8d4f3a
fix progexit handling. Now clamd should be able to handle most commands.
...
Except SESSION is probably broken now
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4601 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago
Török Edvin
4f5a740806
fix accept logic
...
git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4600 77e5149b-7576-45b1-b177-96237e5ba77b
17 years ago