Commit graph

45 commits

Author SHA1 Message Date
Shawn Webb
60d8d2c352 Move all the crypto API to clamav.h 2014-07-01 19:38:01 -04:00
Shawn Webb
b2e7c931d0 Use OpenSSL for hashing. 2014-02-08 00:31:12 -05:00
Steve Morgan
6163712000 Change initialization of variable umin to work with signed arithmetic, bb#5786 2012-09-17 12:53:14 -07:00
Shawn webb
b2c04b6c28 BB#5449 2012-07-09 10:59:49 -04:00
aCaB
18f620f234 bb#3926 2012-01-17 11:21:00 +01:00
aCaB
f238189223 bb#2286 2010-10-14 16:06:43 +02:00
Török Edvin
e4a0f2c94f fix compiler warnings (bb #1872, bb #1934, bb #1935) 2010-04-13 16:19:47 +03:00
Török Edvin
1514794c49 make STATS a non-bulk command (bb #1732).
This is needed to allow clamdtop to watch in realtime what is happening in
clamd, otherwise STATS would always lag behind 50 other multiscan commands.
2010-02-01 14:38:36 +02:00
Török Edvin
6a5ec1f967 Don't allow bulk requests (multiscan, idsession) to fill more than 50% of the queue. (bb #1732)
This makes clamd responsive to simple (version,contscan,etc.) requests
even during multiscan.
Previously these would get stuck behind a ~100 item queue, and the 1:4 ratio
of executing these commands wasn't working, since the commands weren't in the queue
in the first place.
2010-02-01 14:07:48 +02:00
Török Edvin
80301d0cd6 Fix clamd hang when number of multiscan commands == MaxThreads (bb #1700).
Each multiscan command needs 1 control thread, and 1 (possibly shared) scanner
thread.
If the number of multiscan control threads would be equal to MaxThreads no
progress could be made, since each one would be waiting for 1 free scanner
thread (but none can be spawned since maxthreads was already reached).
As long as there is 1 thread free for scanning, we can have N-1 multiscan
commands active, with N MaxThreads.
2010-01-27 11:56:10 +02:00
Török Edvin
cab1b4759f Use a double instead of an integer to avoid negative time (bb #1731). 2009-10-28 15:16:56 +02:00
aCaB
be4bf7f4ab win32 2009-09-24 16:08:52 +02:00
Tomasz Kojm
e78b518630 fix some debug format 2009-09-15 22:46:35 +02:00
Török Edvin
7660b7cb35 Fix 60 byte/STREAM command memory leak on FreeBSD. (bb #1567,
thanks to Jay Deiman <jay*splitstreams.com> and Chris Mikkelson <cmikk*qwest.net> for tracking down the leak!).

git-svn: trunk@5061
2009-05-06 07:56:28 +00:00
Török Edvin
75ce59c12f errno is not thread-safe on AIX by default, ask for thread-safe version. (bb #1480)
Default stack size on AIX is too small, define BIGSTACK by default. (bb #1481).

git-svn: trunk@5054
2009-04-23 13:55:22 +00:00
Török Edvin
4b93f2b633 check for mallinfo availability (bb #1445).
git-svn: trunk@5001
2009-04-01 17:51:44 +00:00
Török Edvin
9390411bf0 Automatically fix MaxQueue settings (bb #1521).
Also use rlim_cur instead of rlim_max, because that is what the kernel enforces.

git-svn: trunk@5000
2009-04-01 17:19:06 +00:00
Török Edvin
59deef7d8c print N/A if libc memory usage is not available (bb #1445).
git-svn: trunk@4951
2009-03-16 12:29:25 +00:00
Török Edvin
fb6fe4f5d1 Introduce '$' in logg, it is active when logg_verbose=2, i.e. when Debug yes.
Fix leak reported by valgrind.

git-svn: trunk@4806
2009-02-17 15:59:36 +00:00
Török Edvin
b25fdae488 fix valgrind warning about locking order
git-svn: trunk@4799
2009-02-16 18:27:13 +00:00
Török Edvin
0378a9ab77 introduce timeouts for send(), this is needed for IDSESSION to work reliably,
since a buggy client implementation may get stuck in send(), and then clamd
gets stuck in send() -> deadlock. To avoid this we need nonblocking sockets, and
(low) timeouts on send.
Add more tests for clamd protocol, including a stress test for IDSESSION.

git-svn: trunk@4798
2009-02-16 18:27:08 +00:00
Tomasz Kojm
086eab5c26 update old copyright headers
git-svn: trunk@4775
2009-02-13 10:55:45 +00:00
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
2009-02-12 16:51:09 +00:00
Tomasz Kojm
47d40feb7a libclamav: use LibTomMath by Tom St Denis instead of libgmp for multiple precision integer arithmetic (bb#1366)
git-svn: trunk@4650
2009-01-26 19:47:02 +00:00
Török Edvin
15adbc849a update unit tests to new API.
Initialization order changed, make sure stats_tls_key is initialized.

git-svn: trunk@4387
2008-11-12 18:02:33 +00:00
Török Edvin
08402afa4c fix more compiler warnings (bb #273)
git-svn: trunk@4353
2008-11-07 18:49:47 +00:00
Török Edvin
5a1034b991 fix more compiler warnings (bb #273).
git-svn: trunk@4349
2008-11-06 22:49:53 +00:00
Török Edvin
b9b477842d fix compiler warnings, more to come (bb #273)
git-svn: trunk@4346
2008-11-06 14:27:43 +00:00
Török Edvin
deb3031222 mempool statistics support
git-svn: trunk@4344
2008-11-06 14:27:27 +00:00
Török Edvin
764f76c841 * clamd/thrmgr.c (thrmgr_printstats, IDLE_TASK): add comments
* contrib/clamdtop/TODO: more TODO items

git-svn: trunk@4328
2008-11-04 09:13:24 +00:00
Török Edvin
64cb380717 fix whitespace
git-svn: trunk@4327
2008-11-04 09:13:18 +00:00
Török Edvin
6bdb35ea6a use mdprintf instead of fdopen on socket (bb #1270) (thanks to Gianluigi Tiesi <sherpya*netfarm.it>)
git-svn: trunk@4325
2008-11-04 08:58:44 +00:00
Török Edvin
aa22174b30 new command STATS
new top-like tool using ncurses: clamdtop

it shows what clamd is currently scanning (and since how long),
including which file(s) multiscan is working on currently,
how many items it has in the queue (and since how long they are waiting),
how many active/idle threads it has,
memory usage statistics,
can monitor local or remote clamd

git-svn: trunk@4324
2008-11-03 19:27:20 +00:00
Török Edvin
b8edbb880d clamd/thrmgr.c: fix valgrind warning (bb #1184)
unit_tests: add more valgrind tests, add a reload and a multiscan test (bb #1092)

git-svn: trunk@4175
2008-09-14 14:15:39 +00:00
Török Edvin
4a0bd44290 Multiscan queues a lot of scan tasks. If thread_idle wasn't zero when multiscan
started queueing, it will only spawn at most one thread, and keep queueing
without spawning more threads (because threads_idle now non-zero), but the idle
thread doesn't get a chance to pick up the tasks.

Fix this by testing whether we have enough idle threads to pick up the items in
the work queue. If there aren't then spawn some more until max limit is reached,
or we have enough idle threads to handle all tasks in the queue.

git-svn: trunk@4066
2008-08-03 14:09:29 +00:00
Török Edvin
4270f93bcc (bb #913, #916)
* fix scan of partial messages
* allow for tempfiles to be cleaned up based on age
* new clamd.conf option ScanPartialMessages
* sample cleanup script
* clamd/thrmgr.c: fix item_count


git-svn: trunk@4031
2008-07-30 13:54:34 +00:00
Tomasz Kojm
5a66732fdc clamd: revert patch from bb#1028 (bb#1113)
git-svn: trunk@4029
2008-07-29 21:35:58 +00:00
aCaB
cc4232a3b1 add some missing checks for pthread api calls - bb#384
git-svn: trunk@4004
2008-07-27 21:38:35 +00:00
Tomasz Kojm
600a7f2b08 configure, clamd: fix compilation error on systems without pthread_yield() (bb#1058)
git-svn: trunk@3910
2008-07-04 16:34:30 +00:00
Tomasz Kojm
22e4ec878a clamd/thrmgr.c: move some msgs to debug (bb#1028)
git-svn: trunk@3882
2008-06-03 18:25:44 +00:00
Tomasz Kojm
04ba76d2cb minimize memory fragmentation after db reload (bb#1028)
git-svn: trunk@3873
2008-06-02 12:00:37 +00:00
Török Edvin
d6df9ffb5a use pthread_cond_* instead of usleep() in MULTISCAN (bb #758)
enable entconv by default
others.c: fix compiler warning
regex_list.c: remove unused code, because a better solution is scheduled for 0.94 (bb #725)


git-svn: trunk@3627
2008-02-13 10:57:33 +00:00
Török Edvin
efac2f09b7 don't ignore SIGBUS, SIGFPE, SIGILL, and SIGSEGV.
POSIX says the behaviour is undefined if they are ignored.
  (on HP-UX behaviour was: hang)
make BIGSTACK the default on HPUX 


git-svn: trunk@3593
2008-02-07 20:47:50 +00:00
Tomasz Kojm
8ca8a18e2d drop shared/memory.[ch]
git-svn: trunk@2874
2007-02-28 02:44:23 +00:00
Sven Strickroth
a99111f050 remove old CVS-stuff and make the repository look more like SVN
git-svn: trunk@2755
2007-02-17 19:02:20 +00:00
Renamed from clamav-devel/clamd/thrmgr.c (Browse further)