Commit graph

50 commits

Author SHA1 Message Date
Micah Snyder
38386349c5 Fix many warnings 2023-04-13 00:11:34 -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
72fd33c8b2 clang-format'd using new .clang-format rules. 2019-10-02 16:08:16 -04:00
Josh Soref
7cd9337a70 Spelling Adjustments (#30)
* spelling: accessed

* spelling: alignment

* spelling: amalgamated

* spelling: answers

* spelling: another

* spelling: acquisition

* spelling: apitid

* spelling: ascii

* spelling: appending

* spelling: appropriate

* spelling: arbitrary

* spelling: architecture

* spelling: asynchronous

* spelling: attachments

* spelling: argument

* spelling: authenticode

* spelling: because

* spelling: boundary

* spelling: brackets

* spelling: bytecode

* spelling: calculation

* spelling: cannot

* spelling: changes

* spelling: check

* spelling: children

* spelling: codegen

* spelling: commands

* spelling: container

* spelling: concatenated

* spelling: conditions

* spelling: continuous

* spelling: conversions

* spelling: corresponding

* spelling: corrupted

* spelling: coverity

* spelling: crafting

* spelling: daemon

* spelling: definition

* spelling: delivered

* spelling: delivery

* spelling: delimit

* spelling: dependencies

* spelling: dependency

* spelling: detection

* spelling: determine

* spelling: disconnects

* spelling: distributed

* spelling: documentation

* spelling: downgraded

* spelling: downloading

* spelling: endianness

* spelling: entities

* spelling: especially

* spelling: empty

* spelling: expected

* spelling: explicitly

* spelling: existent

* spelling: finished

* spelling: flexibility

* spelling: flexible

* spelling: freshclam

* spelling: functions

* spelling: guarantee

* spelling: hardened

* spelling: headaches

* spelling: heighten

* spelling: improper

* spelling: increment

* spelling: indefinitely

* spelling: independent

* spelling: inaccessible

* spelling: infrastructure

Conflicts:
	docs/html/node68.html

* spelling: initializing

* spelling: inited

* spelling: instream

* spelling: installed

* spelling: initialization

* spelling: initialize

* spelling: interface

* spelling: intrinsics

* spelling: interpreter

* spelling: introduced

* spelling: invalid

* spelling: latency

* spelling: lawyers

* spelling: libclamav

* spelling: likelihood

* spelling: loop

* spelling: maximum

* spelling: million

* spelling: milliseconds

* spelling: minimum

* spelling: minzhuan

* spelling: multipart

* spelling: misled

* spelling: modifiers

* spelling: notifying

* spelling: objects

* spelling: occurred

* spelling: occurs

* spelling: occurrences

* spelling: optimization

* spelling: original

* spelling: originated

* spelling: output

* spelling: overridden

* spelling: parenthesis

* spelling: partition

* spelling: performance

* spelling: permission

* spelling: phishing

* spelling: portions

* spelling: positives

* spelling: preceded

* spelling: properties

* spelling: protocol

* spelling: protos

* spelling: quarantine

* spelling: recursive

* spelling: referring

* spelling: reorder

* spelling: reset

* spelling: resources

* spelling: resume

* spelling: retrieval

* spelling: rewrite

* spelling: sanity

* spelling: scheduled

* spelling: search

* spelling: section

* spelling: separator

* spelling: separated

* spelling: specify

* spelling: special

* spelling: statement

* spelling: streams

* spelling: succession

* spelling: suggests

* spelling: superfluous

* spelling: suspicious

* spelling: synonym

* spelling: temporarily

* spelling: testfiles

* spelling: transverse

* spelling: turkish

* spelling: typos

* spelling: unable

* spelling: unexpected

* spelling: unexpectedly

* spelling: unfinished

* spelling: unfortunately

* spelling: uninitialized

* spelling: unlocking

* spelling: unnecessary

* spelling: unpack

* spelling: unrecognized

* spelling: unsupported

* spelling: usable

* spelling: wherever

* spelling: wishlist

* spelling: white

* spelling: infrastructure

* spelling: directories

* spelling: overridden

* spelling: permission

* spelling: yesterday

* spelling: initialization

* spelling: intrinsics

* space adjustment for spelling changes

* minor modifications by klin
2018-02-27 22:00:09 -05:00
Steven Morgan
b20eeffadb bb11209: fix for static-only build for uClibc - patch supplied by Yann E. Morin. 2015-10-02 12:24:58 -04:00
Steven Morgan
f092d0a1a1 bb11260: fix compile error when './configure --disable-pthreads' is specified. 2015-02-10 15:16:48 -05:00
Shawn Webb
cd94be7a52 Silence a bunch of compiler warnings in libclamav 2014-07-10 18:11:49 -04:00
Shawn Webb
60d8d2c352 Move all the crypto API to clamav.h 2014-07-01 19:38:01 -04:00
Shawn Webb
b3c40dc6f9 Properly upconvert from char to int 2014-05-29 15:52:56 -04:00
Steven Morgan
56d6962b17 support libjson-c 0.10, 1.11, and 1.12 2014-05-23 09:53:08 -04:00
Steven Morgan
e182c02ce3 support libjson-c 0.10, 1.11, and 1.12 2014-05-23 09:46:06 -04:00
Shawn Webb
424fb3b5d6 bb10997 - Add <sys/param.h> header if we have it for stats 2014-05-12 11:00:16 -05:00
Steven Morgan
58f224b879 bz#10991 Add to stats.c missing #if HAVE_SYSCTLBYNAME 2014-05-10 15:25:54 -04:00
Kevin Lin
2c855a24eb Merge branch 'master' of git.clam.sourcefire.com:/var/lib/git/clamav-devel 2014-05-09 16:39:12 -04:00
Kevin Lin
e198df77ab bb#10988 - fixed stats overwrite on settings transfer
stats: fixed issue with mutex unlocking
2014-05-09 16:27:16 -04:00
Shawn Webb
9e47301bc9 Return anonymous UUID if sysctl didn't find anything 2014-05-08 03:12:40 -04:00
Shawn Webb
70ab826f95 Fix linking in a custom OpenSSL. Add Solaris fixes for the stats work. 2014-03-10 16:21:51 -04:00
Shawn Webb
387021619b Turn stats into an opt-in feature rather than an opt-out feature for the 0.98.2 release 2014-03-07 13:09:37 -05:00
Shawn Webb
4d0353424f Fix CIDs 12008, 12007, 12005, 12002, 12001, 11787, 11774, and 11724 2014-02-24 14:20:35 -05:00
Shawn Webb
690a27b8cc bb#10521 - Enhancement: logging for the Intel/Stat Gathering 2014-02-20 12:49:29 -05:00
Shawn Webb
b842e8bf75 Migrate ClamAV's crypto routines over to OpenSSL. 2014-02-12 17:55:38 -05:00
Shawn Webb
b2e7c931d0 Use OpenSSL for hashing. 2014-02-08 00:31:12 -05:00
Shawn Webb
0c58ddd290 Fix some bugs 2014-02-06 12:17:00 -05:00
Shawn Webb
3fc1fc6985 Fix accessing an array 2014-02-05 12:35:16 -05:00
Shawn Webb
1bdaf81389 Update copyrights 2014-02-04 10:14:25 -05:00
Shawn Webb
d4f90ad449 Add DCONF support to the stats feature. 2014-02-04 10:08:19 -05:00
Shawn Webb
4e1236c802 Add option for configuring the timeout for stats submissions 2014-02-03 17:23:26 -05:00
Shawn Webb
b86e39088b Remove debugging statements from stats code 2014-02-03 11:51:13 -05:00
Shawn Webb
58ca30cf0d Revert "Temporarily disable the actual submission of stats to the stats server in order to run the regression suite"
This reverts commit dd2f7d743e.
2014-01-28 10:48:26 -05:00
Shawn Webb
4ba4b72f82 Temporarily disable the actual submission of stats to the stats server in order to run the regression suite 2014-01-28 10:48:21 -05:00
Shawn Webb
e6bcbd5add Fix Valgrind. Fix bug with clamd reloading database, forcing a stats submission. 2014-01-28 10:48:17 -05:00
Shawn Webb
e6786fef39 Fix Windows build 2014-01-28 10:48:13 -05:00
Shawn Webb
186712e09f Free the section hash data in the right spot 2014-01-28 10:48:08 -05:00
Shawn Webb
43adde3e77 Fix a couple bugs 2014-01-28 10:47:46 -05:00
Shawn Webb
3c29ca0b10 Phase 1 of reporting hashes of PE sections
Conflicts:
	libclamav/stats.h
2014-01-28 10:47:38 -05:00
Shawn Webb
b7485a222c Add support for setting the HostID in freshclam 2014-01-28 10:39:36 -05:00
Shawn Webb
7c92a662d9 Add functions to set the stats callbacks. Don't submit stats when verifying CVDs. 2014-01-28 10:39:05 -05:00
Shawn Webb
f721facae0 Support GET, PUT, and POST. Ditch chunked transfer encoding. Always use form encoding when POSTing or PUTing data. 2014-01-28 10:37:49 -05:00
Shawn Webb
cfeb77233f Remove some debugging code. Add explanatory comments. 2014-01-28 10:32:26 -05:00
Shawn Webb
2d6361a9d0 Submit stats to dev server
Conflicts:
	libclamav/stats.h
2014-01-28 10:32:09 -05:00
Shawn Webb
53242b9796 Use the system GUID on Windows systems 2014-01-28 10:31:07 -05:00
Shawn Webb
4a4b84daca Fix Windows build
Conflicts:
	win32/libclamav.vcxproj
	win32/libclamav.vcxproj.filters
2014-01-28 10:30:39 -05:00
Shawn Webb
9e0f01d995 Use hashed MAC addresses as the hostid for Linux.
We determine if we're Linux by the absense of the sysctlbyname()
function. As the code introduced in this commit for getting MAC
addresses is specific to Linux, additional work will need to be
made to handle other operating systems (namely, OpenBSD and Solaris).

Conflicts:
	libclamav/Makefile.in
2014-01-28 10:29:32 -05:00
Shawn Webb
02c1affff6 Fix on FreeBSD.
Conflicts:
	unit_tests/Makefile.in
2014-01-28 10:28:12 -05:00
Shawn Webb
c8bf9b6cb5 Add start of the code to grab the system's hostid 2014-01-28 10:27:38 -05:00
Shawn Webb
4473a0a954 Add more callbacks. Simplify the checks for submitting stats in the add sample callback 2014-01-28 10:27:31 -05:00
Shawn Webb
d45267e49b Fix bug 2014-01-28 10:27:24 -05:00
Shawn Webb
30bdcf4edb Fix bugs 2014-01-28 10:27:17 -05:00
Shawn Webb
68e60b1234 Fix bugs
Conflicts:
	unit_tests/Makefile.in
2014-01-28 10:27:04 -05:00
Shawn Webb
f2571e344b First initial commit of the stats gathering feature
Conflicts:
	libclamav/Makefile.am
	libclamav/Makefile.in
	libclamav/others.c
	libclamav/others.h
	unit_tests/Makefile.in
2014-01-28 10:25:36 -05:00