Commit graph

86 commits

Author SHA1 Message Date
Val Snyder
7ff29b8c37
Bump copyright dates for 2025 2025-02-14 10:24:30 -05:00
Micah Snyder
9cb28e51e6 Bump copyright dates for 2024 2024-01-22 11:27:17 -05:00
Andrew Kiggins
6f82ba4252
ClamD: Log an error message and exit 1 for bad temp dir
If `TemporaryDirectory` in `clamd.conf` does not exist, ClamD will now
print an error message and exit with exit code 1. 

Fixes: #1028
2023-10-16 17:15:11 -05:00
Micah Snyder
6eebecc303 Bump copyright for 2023 2023-02-12 11:20:22 -08:00
Micah Snyder
059b9c8aa3 Clang-format touchup 2022-11-21 15:03:39 -08:00
Micah Snyder
836e8d4fa8 Fix clamdscan --allmatch stickiness bug
If you run clamdscan with the --allmatch option, it will cause all
subsequent clamdscan scans to have all-match mode enabled.
This bug is specific to clamd / clamdscan and does not affect clamscan.

The problem was introduced when we converted the scan options from a
single integer bitfield to a struct. The scan options set by the
clamdscan parameters should be saved in a local copy of the scan
options, but instead it is saving a copy of the pointer to the scan
options struct, and so any changes to the scan options affect future
scans.
2022-11-04 15:46:33 -07:00
mko-x
a21cc6dcd7
Add explicit log level parameter to application logging API
* Added loglevel parameter to logg()

* Fix logg and mprintf internals with new loglevels

* Update all logg calls to set loglevel

* Update all mprintf calls to set loglevel

* Fix hidden logg calls

* Executed clam-format
2022-02-15 15:13:55 -08:00
micasnyd
140c88aa4e Bump copyright for 2022
Includes minor format corrections.
2022-01-09 14:23:25 -07:00
Micah Snyder
c025afd683 Rename "shared" library to "common"
The named "shared" is confusing, especially now that these features are
built as a static library instead of being directly compiled into the
various applications.
2021-04-20 17:31:19 -07:00
Micah Snyder (micasnyd)
b9ca6ea103 Update copyright dates for 2021
Also fixes up clang-format.
2021-03-19 15:12:26 -07:00
Micah Snyder
451279876e CMake: Add fuzz support.
Enabled the metadata collection feature, scan heuristics, and all-match
mode when fuzzing in the interest of better code coverage.

Also remove deprecated STREAM command.
2021-02-25 11:41:26 -08:00
Micah Snyder (micasnyd)
9e20cdf6ea Add CMake build tooling
This patch adds experimental-quality CMake build tooling.

The libmspack build required a modification to use "" instead of <> for
header #includes. This will hopefully be included in the libmspack
upstream project when adding CMake build tooling to libmspack.

Removed use of libltdl when using CMake.

Flex & Bison are now required to build.

If -DMAINTAINER_MODE, then GPERF is also required, though it currently
doesn't actually do anything.  TODO!

I found that the autotools build system was generating the lexer output
but not actually compiling it, instead using previously generated (and
manually renamed) lexer c source. As a consequence, changes to the .l
and .y files weren't making it into the build. To resolve this, I
removed generated flex/bison files and fixed the tooling to use the
freshly generated files. Flex and bison are now required build tools.
On Windows, this adds a dependency on the winflexbison package,
which can be obtained using Chocolatey or may be manually installed.

CMake tooling only has partial support for building with external LLVM
library, and no support for the internal LLVM (to be removed in the
future). I.e. The CMake build currently only supports the bytecode
interpreter.

Many files used include paths relative to the top source directory or
relative to the current project, rather than relative to each build
target. Modern CMake support requires including internal dependency
headers the same way you would external dependency headers (albeit
with "" instead of <>). This meant correcting all header includes to
be relative to the build targets and not relative to the workspace.

For example, ...

```c
include "../libclamav/clamav.h"
include "clamd/clamd_others.h"
```

... becomes:

```c
// libclamav
include "clamav.h"

// clamd
include "clamd_others.h"
```

Fixes header name conflicts by renaming a few of the files.

Converted the "shared" code into a static library, which depends on
libclamav. The ironically named "shared" static library provides
features common to the ClamAV apps which are not required in
libclamav itself and are not intended for use by downstream projects.
This change was required for correct modern CMake practices but was
also required to use the automake "subdir-objects" option.
This eliminates warnings when running autoreconf which, in the next
version of autoconf & automake are likely to break the build.

libclamav used to build in multiple stages where an earlier stage is
a static library containing utils required by the "shared" code.
Linking clamdscan and clamdtop with this libclamav utils static lib
allowed these two apps to function without libclamav. While this is
nice in theory, the practical gains are minimal and it complicates
the build system. As such, the autotools and CMake tooling was
simplified for improved maintainability and this feature was thrown
out. clamdtop and clamdscan now require libclamav to function.

Removed the nopthreads version of the autotools
libclamav_internal_utils static library and added pthread linking to
a couple apps that may have issues building on some platforms without
it, with the intention of removing needless complexity from the
source. Kept the regular version of libclamav_internal_utils.la
though it is no longer used anywhere but in libclamav.

Added an experimental doxygen build option which attempts to build
clamav.h and libfreshclam doxygen html docs.

The CMake build tooling also may build the example program(s), which
isn't a feature in the Autotools build system.

Changed C standard to C90+ due to inline linking issues with socket.h
when linking libfreshclam.so on Linux.

Generate common.rc for win32.

Fix tabs/spaces in shared Makefile.am, and remove vestigial ifndef
from misc.c.

Add CMake files to the automake dist, so users can try the new
CMake tooling w/out having to build from a git clone.

clamonacc changes:
- Renamed FANOTIFY macro to HAVE_SYS_FANOTIFY_H to better match other
  similar macros.
- Added a new clamav-clamonacc.service systemd unit file, based on
  the work of ChadDevOps & Aaron Brighton.
- Added missing clamonacc man page.

Updates to clamdscan man page, add missing options.

Remove vestigial CL_NOLIBCLAMAV definitions (all apps now use
libclamav).

Rename Windows mspack.dll to libmspack.dll so all ClamAV-built
libraries have the lib-prefix with Visual Studio as with CMake.
2020-08-13 00:25:34 -07:00
Micah Snyder
206dbaefe8 Update copyright dates for 2020 2020-01-03 15:44:07 -05:00
Micah Snyder
52cddcbcfd Updating and cleaning up copyright notices. 2019-10-02 16:08:18 -04:00
Micah Snyder
72fd33c8b2 clang-format'd using new .clang-format rules. 2019-10-02 16:08:16 -04:00
Micah Snyder
d7979d4ff7 Restructured scan options flags from a single bitflag field to a structure containing multiple bitflag fields. This also required adding a new function to the bytecode API to get scan options a la carte, and modifying the existing function to hand back scan options in the old/deprecated uint32_t bitflag format. Re-generated bytecode iface header files.
Updated libclamav documentation detailing new scan options structure.
Renamed references to 'algorithmic' detection to 'heuristic' detection. Renaming references to 'properties' to 'collect metadata'.
Renamed references to 'scan all' to 'scan all match'.
Renamed a couple of 'Hueristic.*' signature names as 'Heuristics.*' signatures (plural) to match majority of other heuristics.
2018-12-02 23:06:59 -05:00
Mickey Sola
46a35abe56 mass update of copyright headers 2015-09-17 13:41:26 -04:00
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
Shawn Webb
e07b295d95 Remove existing stats gathering framework from clamd
Conflicts:
	clamd/clamd.c
2014-01-28 10:46:47 -05:00
Shawn Webb
d9b6b8c757 bb#8993 - Rename the STAT macro to CLAMSTAT to avoid name conflicts on AIX 2013-09-25 16:23:10 -04:00
David Raynor
23816d691c clamd: add AllowAllMatchScan config option for permit/deny ALLMATCHSCAN command 2013-06-11 11:20:31 -04:00
Shawn Webb
8b2bdb1b28 bb6578 - Fixes TODO in session.c on converting to ENUM 2013-03-01 14:01:20 -05:00
Steve Morgan
6ad45a2931 add initial allscan/allmatch mode to libclamav, clamd, clamdscan, and clamscan with unit tests 2012-10-18 14:12:58 -07:00
Steve Morgan
1de0366eb1 fix close(-1) identified by code analyzer(bb#5782). Also fixed other problems and inconsistencies in how return codes were set in scanner.c:command() function 2012-09-13 15:15:22 -07:00
Shawn webb
a2a004df25 BB#3737 - Value too large for specified data type
Create compile-time preprocessor defines for switching from calling
stat() to stat64(). Add --enable-stat64 switch in configure script.
2012-07-16 15:36:49 -04:00
Shawn webb
ba20a0c55a BB#5409 - Fix condition to follow type change inside command() 2012-07-03 12:06:18 -04:00
Tomasz Kojm
0f4639ec76 clamd: log request ip address for instream scans #bb2592
On behalf of acab
2011-05-05 16:15:57 -07:00
aCaB
8ab47ebe4e win32: UTF #6 - clamd proto 2011-04-18 17:25:23 +02:00
Tomasz Kojm
b33354e55c cosmetics (bb#2207) 2011-03-11 20:30:45 +01:00
Tomasz Kojm
b898103236 clamd: don't report file hashes to clients (bb#2409) 2010-12-09 13:50:42 +01:00
Tomasz Kojm
49f8de2207 clamd: add new commands DETSTATS and DETSTATSCLEAR (part of bb#2312) 2010-11-03 13:41:06 +01:00
aCaB
f238189223 bb#2286 2010-10-14 16:06:43 +02:00
Török Edvin
cdb3cbe089 Treat MULTISCAN as CONTSCAN on non-directories (bb #1869).
This is part 1. Part 2 will be for clamdscan to send IDSESSION for
-m <file1> <file2>, but that is for 0.97.
2010-07-26 12:57:34 +03:00
Tomasz Kojm
edbba730b3 clamd: add ExtendedDetectionInfo (bb#1228, #1626) 2010-07-06 19:46:55 +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
c0afc51729 Don't use C++ comments in C code. 2010-01-27 12:07:08 +02:00
Török Edvin
27b59717b8 previous commit fixes bb #1770, not #1700! 2010-01-27 11:59:51 +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
aCaB
e0bb54d7d4 win32: s/C_WINDOWS/_WIN32/ in clamd, shared 2009-09-30 00:54:04 +02:00
aCaB
be4bf7f4ab win32 2009-09-24 16:08:52 +02:00
Tomasz Kojm
2086dc5cab clamd, clamscan: add support for CrossFilesystems/--cross-fs (bb#1607) 2009-08-05 16:27:48 +02:00
Tomasz Kojm
51bbedb132 libclamav, clamd: handle file exclusion in cli_ftw() (bb#1656) 2009-07-31 21:28:55 +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
52cecde4c0 fix STATS for INSTREAM commands (bb #1565).
git-svn: trunk@5051
2009-04-20 14:41:20 +00:00
Tomasz Kojm
0dcb7037d6 clamd/session.c: respect TemporaryDirector in cli_gentempfd()
git-svn: trunk@4997
2009-04-01 12:01:00 +00:00
Török Edvin
36e4bc1467 stop scanning when client disconnects (bb #1446).
git-svn: trunk@4940
2009-03-13 13:50:56 +00:00
Tomasz Kojm
2accc66fef libclamav, clamd, clamscan: replace cl_engine_(set|get) with cl_engine_set_(num|str) and cl_engine_get_(num|str)
git-svn: trunk@4933
2009-03-12 15:21:36 +00:00
Török Edvin
e68d70e7e0 strerror/strerror_r->cli_strerror which is always thread safe.
git-svn: trunk@4927
2009-03-11 19:11:09 +00:00