Commit Graph

61 Commits

Author SHA1 Message Date
Micah Snyder (micasnyd)
b9ca6ea103 Update copyright dates for 2021
Also fixes up clang-format.
2021-03-19 15:12:26 -07: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
b3e82e5e61 Replacing libclamav/cltypes.h with clamav-types.h.in, which generates a header clamav-types.h that we install alongside clamav.h. 2019-10-02 16:08:17 -04:00
Micah Snyder
72fd33c8b2 clang-format'd using new .clang-format rules. 2019-10-02 16:08:16 -04:00
Micah Snyder (micasnyd)
89d5207b31 Added new pdf object stream parsing capability. 2018-12-02 23:06:58 -05:00
Mickey Sola
46a35abe56 mass update of copyright headers 2015-09-17 13:41:26 -04:00
Kevin Lin
0ff13b3138 clambc: added diagnostic tools for bytecode IR
clambc: added option to print bytecode IR
TODO: add diagnostic functions to win32 project

Conflicts:

	shared/optparser.c
2014-07-25 12:06:13 -04:00
Steve Morgan
16c4fcdd10 performance statistics for bytecode hooks 2012-12-07 08:09:10 -08:00
Steve Morgan
54402320c0 Add bytecode performance statistics 2012-12-05 15:48:52 -08: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
Török Edvin
540fc128a0 freshclam is using private symbol that changed proto (bb #2187).
Change name to prevent crash with 0.96.1 freshclam and 0.96.2 libclamav.
You'll get a missing symbol error.
2010-08-11 14:26:10 +03:00
Török Edvin
762d46e8ea Fix matchicon bytecode API (bb #2139).
Now you can call it both from a normal lsig triggered BC, and from a PE hook BC.
The normal lsig triggered BC has exe_info (but not PE info) which allows it to
invoke the icon matcher API.
Also putting ICONGROUP1 into the ldb trigger of the bytecode works.
2010-08-02 21:52:15 +03:00
Török Edvin
dc200c6b19 Add bytecode API for pdf. 2010-08-02 18:21:24 +03:00
Török Edvin
927d054838 Add engine param to bytecode, and remove dconf from _init. 2010-07-29 13:48:18 +03:00
Török Edvin
2545f9767c Rearrange some fields in structs to avoid holes. 2010-06-09 13:44:29 +03:00
Török Edvin
2a7f1cdaf5 Print C++ compiler version.
This requires exporting a function from libclamav, since clamconf is not C++...
2010-04-19 18:35:30 +03:00
Török Edvin
20327f931f compute global offsets. 2010-03-06 16:28:08 +02:00
Török Edvin
6eeadbfeda dconf for bytecode. 2010-02-15 17:32:41 +02:00
Török Edvin
236fb13647 New pointer handling rules. 2010-02-15 17:32:40 +02:00
Török Edvin
57f14280a7 Fix use-after-free on bytecode load/execution.
lsig->bc was referring to the bytecode directly (via a pointer),
but the bytecode struct changes place in memory (it is realloced on each .cbc
load). So use an index instead of the direct pointer.
2010-02-02 15:30:20 +02:00
Török Edvin
847d7fc1b8 2009->2010 2010-02-02 14:03:32 +02:00
Tomasz Kojm
baf2e702e2 libclamav: provide information about lsig matches to bytecode (bb#1799) 2010-01-28 12:54:28 +01:00
Török Edvin
a35cfe5137 print bytecode metadata. 2010-01-22 16:50:35 +02:00
Török Edvin
be43f951c6 BytecodeSecurity setting. 2010-01-22 16:50:35 +02:00
Török Edvin
f4e3421592 Support PE hook bytecodes triggered by logical signature. 2010-01-19 16:41:26 +02:00
Tomasz Kojm
12c6a97e9b fix some compiler warnings 2010-01-12 16:16:08 +01:00
Török Edvin
688799d126 yc_bytecode is able to unpack a file now! 2009-12-17 17:40:35 +02:00
Török Edvin
92ba8d661c Attempt to fix SunC build: enum/unsigned mismatch is not allowed. 2009-12-12 15:14:40 +02:00
Török Edvin
853b6e5da1 Add LLVM win32 proj files generated by cmake.
Fix win32 build issues.
Enable CPU detection on win32 too.
Enable LLVM JIT on win32 too.
Define NDEBUG for libclamavc++ for release win32 builds.
2009-12-12 15:14:39 +02:00
Török Edvin
29cbf0787b stdint.h -> cltypes.h 2009-12-11 21:07:36 +02:00
Török Edvin
d0934caf99 Distcheck fixes. 2009-12-11 21:02:19 +02:00
Török Edvin
0a11015bf5 Refactor trace API, so that trace printing happens in clambc.
This will allow clambc to implement breakpoints, and watchpoints.
2009-12-09 17:05:05 +02:00
Török Edvin
65c740d7d8 Add support for tracing (if bytecode compiled with support).
TODO: global id 0 is now a null pointer, need to adjust rest of conversion code
accordingly.
2009-12-08 23:02:49 +02:00
Török Edvin
74b0023374 Fix after merge: update to fmap API. 2009-12-03 11:37:38 +02:00
Török Edvin
3ae0a76d03 Support for scanning files created by bytecode. 2009-12-02 17:30:17 +02:00
Török Edvin
53bd5bb14d read optional debug metadata. 2009-11-30 15:22:20 +02:00
Török Edvin
250d92c533 Sync with compiler. 2009-11-06 16:34:46 +02:00
Török Edvin
ec41017bba WiP 2009-10-06 17:32:38 +03:00
Török Edvin
ab63657088 Add generic and PE hooks. 2009-10-02 17:33:11 +03:00
Török Edvin
9fac78c72e Update to latest bytecode format. 2009-10-02 10:26:47 +03:00
Török Edvin
d38d6dadef Logical signature hook for bytecode. 2009-09-22 11:04:33 +03:00
Török Edvin
dcee45cce2 Update to latest bytecode format. 2009-09-21 18:48:43 +03:00
Török Edvin
ec07792943 Support for constant global with global initializers. 2009-09-10 22:51:11 +03:00
Török Edvin
a1781898ec inputfile support 2009-09-08 22:25:33 +03:00
Török Edvin
2922746173 Fix make distcheck. 2009-09-07 19:29:50 +03:00
Török Edvin
4789b8a5a6 Add draft file API, doesn't work yet. 2009-09-04 17:29:13 +03:00
Török Edvin
1a486dca3b Add hidden ctx param to APIcalls. 2009-09-04 12:09:17 +03:00
Török Edvin
2487a4a342 Various bytecode JIT fixes, teach clamconf about JIT, and make sure make check runs the JIT! 2009-08-28 20:07:25 +03:00