Commit graph

42 commits

Author SHA1 Message Date
Micah Snyder
0bc766f15b Remove Cargo.lock file from .gitignore
We commit Cargo.lock now. Wouldn't want to ignore it!
2023-05-04 10:42:21 -07:00
Micah Snyder
5135a3e5fd Remove legacy common.rc file
common.rc is generated by CMake from common.rc.in.
But we do need to have it generate in the same directory as the other
resource files.

We simply forgot to remove common.rc after removing the Visual Studio
project files.
2023-05-04 10:42:21 -07:00
Micah Snyder
38cc06f5f6 Cmake: Additional symbol version-script fixes
libclamav.map: Add missing symbol and correct symbol version.

libclamunrar.map: Use symbol version-script for libclamunrar, too.
Thank you to Sebastian Andrzej Siewior for the help.

Also fix a unittest linker issue...
Adding libclamav.map causes libclamav to no longer export zlib
when zlib is statically linked.

What was weird is that libxml2 depends on zlib and the check_clamav
unit test program was using those symbols from libclamav.

Introducing libclamav.map broke that even though we were explicitly
trying to link check_clamav with ZLIB::ZLIB as well.

For reasons I can't explain, linking check_clamav with the
ClamAV::common library managed to properly link it with ZLIB::ZLIB
and so the undefined references go away.

Also in this commit, I've removed the `.map` files from .gitignore
I'm not sure why they were ignored before.
2023-03-23 09:10:41 -07:00
micasnyd
4d34bc10b8 Rust bindgen: Only generate if CMake MAINTAINER_MODE is ON
In testing, I found that libclang.so/clang.dll is required by bindgen
and was not found on all of our test machines. To resolve this we will
only generate sys.rs bindings when CMake MAINTAINER_MODE option is "ON".

This is unfortunate that we have to commit generated source to version
control. But as a benefit it makes rust-analyzer happier when editing a
workspace that hasn't yet been compiled. And it makes it more reasonable
that the generated sys.rs file generated to the source directory and not
the build directory (something we hadn't resolved yet).
2022-01-14 11:50:07 -07:00
micasnyd
ba0a21c31f Generate Rust-bindings for some internal C-headers
Use bindgen to generate Rust-bindings for some libclamav internal
functions and structures in an new "sys.rs" module.

"sys.rs" will be generated at build-time and unfortunately must be
dropped in the source/libclamav_rust/src directory rather than under the
build directory. As far as I know, Cargo/Rust provide no way to set an
include path to the build directory to separately place generated files.
TODO: Verify if this is true and move sys.rs to the build directory if
possible.

Using the new bindings with:
- the logging module.
- the cdiff module.

Also:
- Removed clamav_rust.h from .gitignore, because we generate it in the
  build directory now.
- Removed the hand-written bindings from the cbindgen exclusions.
  lib.rs has an annotation that prevents cbindgen from looking at sys.rs.
- Fixed a `u8` -> `c_char` type issue in cdiff in the cli_getdsig() call
  parameters.
2022-01-14 11:50:07 -07:00
Scott Hutton
278ba2923e Integrate cbindgen via build.rs 2021-12-08 13:15:46 -07:00
John Humlick
7e36ec4686 Rust: update .gitignore for generated rust files 2021-11-15 12:33:05 -08:00
Micah Snyder
a746d344df Remove Autotools build system & built-in LLVM
CMake is now required to build.

The built-in LLVM is no longer available.

Also removed support for libltdl calls, which is not used in the CMake
builds, was only used when building with Autotools.

TODO: Fix CMake LLVM support & update to work with modern versions.
2021-05-19 14:20:59 -07:00
Micah Snyder
840b559c7a Remove Visual Studio project files
Visual Studio projects removed in favor of CMake because it's far easier
to build and maintain. Also removed the old InnoSetup installer now that
CMake's CPack provides installer creation.

While working on this I found that the THIS_IS_CLAMAV macro was missing,
resulting in warnings for the `have_rar` and `have_clamjit` exported
global variables.

I also stumbled across some code duplication and more cl_error_t / int
type issues in the pcre code, so this commit includes a little cleanup.
2021-02-25 11:41:27 -08:00
Micah Snyder
2552cfd0d1 CMake: Add CTest support to match Autotools checks
An ENABLE_TESTS CMake option is provided so that users can disable
testing if they don't want it. Instructions for how to use this
included in the INSTALL.cmake.md file.

If you run `ctest`, each testcase will write out a log file to the
<build>/unit_tests directory.

As with Autotools' make check, the test files are from test/.split
and unit_tests/.split files, but for CMake these are generated at
build time instead of at test time.

On Posix systems, sets the LD_LIBRARY_PATH so that ClamAV-compiled
libraries can be loaded when running tests.

On Windows systems, CTest will identify and collect all library
dependencies and assemble a temporarily install under the
build/unit_tests directory so that the libraries can be loaded when
running tests.

The same feature is used on Windows when using CMake to install to
collect all DLL dependencies so that users don't have to install them
manually afterwards.

Each of the CTest tests are run using a custom wrapper around Python's
unittest framework, which is also responsible for finding and inserting
valgrind into the valgrind tests on Posix systems.

Unlike with Autotools, the CMake CTest Valgrind-tests are enabled by
default, if Valgrind can be found. There's no need to set VG=1.
CTest's memcheck module is NOT supported, because we use Python to
orchestrate our tests.

Added a bunch of Windows compatibility changes to the unit tests.
These were primarily changing / to PATHSEP and making adjustments
to use Win32 C headers and ifdef out the POSIX ones which aren't
available on Windows. Also disabled a bunch of tests on Win32
that don't work on Windows, notably the mmap ones and FD-passing
(i.e. FILEDES) ones.

Add JSON_C_HAVE_INTTYPES_H definition to clamav-config.h to eliminate
warnings on Windows where json.h is included after inttypes.h because
json-c's inttypes replacement relies on it.
This is a it of a hack and may be removed if json-c fixes their
inttypes header stuff in the future.

Add preprocessor definitions on Windows to disable MSVC warnings about
CRT secure and nonstandard functions. While there may be a better
solution, this is needed to be able to see other more serious warnings.

Add missing file comment block and copyright statement for clamsubmit.c.
Also change json-c/json.h include filename to json.h in clamsubmit.c.
The directory name is not required.

Changed the hash table data integer type from long, which is poorly
defined, to size_t -- which is capable of storing a pointer. Fixed a
bunch of casts regarding this variable to eliminate warnings.

Fixed two bugs causing utf8 encoding unit tests to fail on Windows:
- The in_size variable should be the number of bytes, not the character
  count. This was was causing the SHIFT_JIS (japanese codepage) to UTF8
  transcoding test to only transcode half the bytes.
- It turns out that the MultiByteToWideChar() API can't transcode
  UTF16-BE to UTF16-LE. The solution is to just iterate over the buffer
  and flip the bytes on each uint16_t. This but was causing the UTF16-BE
  to UTF8 tests to fail.

I also split up the utf8 transcoding tests into separate tests so I
could see all of the failures instead of just the first one.

Added a flags parameter to the unit test function to open testfiles
because it turns out that on Windows if a file contains the \r\n it will
replace it with just \n if you opened the file as a text file instead of
as binary. However, if we open the CBC files as binary, then a bunch of
bytecode tests fail. So I've changed the tests to open the CBC files in
the bytecode tests as text files and open all other files as binary.

Ported the feature tests from shell scripts to Python using a modified
version of our QA test-framework, which is largely compatible and will
allow us to migrate some QA tests into this repo. I'd like to add GitHub
Actions pipelines in the future so that all public PR's get some testing
before anyone has to manually review them.

The clamd --log option was missing from the help string, though it
definitely works. I've added it in this commit.
It appears that clamd.c was never clang-format'd, so this commit also
reformats clamd.c.

Some of the check_clamd tests expected the path returned by clamd to
match character for character with original path sent to clamd. However,
as we now evaluate real paths before a scan, the path returned by clamd
isn't going to match the relative (and possibly symlink-ridden) path
passed to clamdscan. I fixed this test by changing the test to search
for the basename: <signature> FOUND within the response instead of
matching the exact path.

Autotools: Link check_clamd with libclamav so we can use our utility
functions in check_clamd.c.
2021-02-25 11:41:26 -08:00
Micah Snyder
1db4787f8a Remove autotools generated files, add autogen.sh
Removed all autotools generates files. Autotools (autoconf, automake,
libtool, pkg-config, m4) will be required from now on for builds from
git clones.

Added autogen.sh to be run before ./configure.

Significant update to main .gitignore file.

Removed extraneous .gitignore files. A Git repository only needs one
.gitignore file.
2020-07-17 15:40:32 -07:00
Micah Snyder (micasnyd)
9a54f5ccd7 Documentation improvements regarding ClamAV installation, initial setup. 2018-12-02 23:07:03 -05:00
Micah Snyder
d3f2158617 Win32 build system updates to account for relocating libmspack and updating to libmspack 0.7.1alpha (had to re-add mspack.def) 2018-12-02 23:07:02 -05:00
Micah Snyder
d39cb6581f Updating libclamunrar from legacy C implementation to modern unrar 5.6.5. API changes and supporting changes included to pass the filepath of the scanned file into libclamav through the cli_ctx structure, required by the unrar library to open archives. The filename argument may be optional for the scandesc scanning variant, but libclamav will make a best effort to identify the filename from the file descriptor if it was not provided. In addition, included the ability to prefix temp file and directory names with file basenames. 2018-12-02 23:06:59 -05:00
Mickey Sola
47cccb4a82 0.101.x - adding mspack autom4te cache to git ignore list 2018-07-30 09:14:07 -04:00
Micah Snyder
5812c75fa3 updating git commits, sln to fix build, and most importantly adding macro definitions to cltypes in support of Windows. 2017-10-12 17:00:27 -04:00
Jake Fehr
9767b1ba24 disable building of sigui 2017-09-14 01:21:47 -04:00
Mickey Sola
fca6fe9569 bb11378 - updating ClamAV to support VS 2015, patch based on pull request by Keith Jones
Conflicts:
	win32/libclamav.vcxproj
2016-04-18 16:31:14 -04:00
Shawn Webb
35394bbceb Revert recent autoconf work 2014-06-27 12:22:04 -04:00
Shawn Webb
32d1c427b8 Ignore the artifacts created from the unit tests 2014-06-26 15:22:05 -04:00
Shawn Webb
0a36029c8d Add clamav-config to .gitignore 2014-06-26 15:09:12 -04:00
Shawn Webb
045fcc4d7f Remove more autotools artifacts 2014-06-26 15:02:42 -04:00
Shawn Webb
375de722c1 Remove more autotools artifacts
Conflicts:
	.gitignore
	libclamav/c++/clamavcxx-config.h.in
2014-06-26 14:01:12 -04:00
Shawn Webb
d603e692af Remove more autotools artifacts
Conflicts:
	.gitignore
	aclocal.m4
	config/config.guess
	config/config.sub
	config/depcomp
	config/install-sh
	config/ltmain.sh
	config/missing
	libclamav/c++/aclocal.m4
	libclamav/c++/config/config.guess
	libclamav/c++/config/config.sub
	libclamav/c++/config/depcomp
	libclamav/c++/config/install-sh
	libclamav/c++/config/ltmain.sh
	libclamav/c++/config/missing
	libclamav/c++/configure
	libclamav/c++/m4/libtool.m4
	m4/libtool.m4
2014-06-26 13:58:27 -04:00
Shawn webb
ce03dc4428 Properly ignore autotools artifacts
Conflicts:
	clamav-config.h.in
2014-06-26 13:56:53 -04:00
Shawn webb
c85e7e4d61 Remove unnecessary autotools artifacts
Conflicts:
	Makefile.in
	clamav-milter/Makefile.in
	clambc/Makefile.in
	clamconf/Makefile.in
	clamd/Makefile.in
	clamdscan/Makefile.in
	clamdtop/Makefile.in
	clamscan/Makefile.in
	configure.ac
	database/Makefile.in
	docs/Makefile.in
	etc/Makefile.in
	freshclam/Makefile.in
	libclamav/Makefile.in
	libclamav/c++/Makefile.in
	libltdl/Makefile.in
	shared/Makefile.in
	sigtool/Makefile.in
	test/Makefile.in
	unit_tests/Makefile.in
2014-06-26 13:56:07 -04:00
Shawn webb
d1ffa04fe7 Add back in the Makefile.in files 2012-08-13 08:54:05 -04:00
Shawn webb
d3bcc64d1b Leave libltdl/Makefile.in 2012-08-10 15:16:38 -04:00
Shawn webb
be3af4aeb1 Properly ignore autotools artifacts 2012-08-10 14:47:19 -04:00
Shawn webb
913826d168 Remove unnecessary autotools artifacts 2012-08-10 14:44:37 -04:00
Török Edvin
f805891010 Run tblgen only in maintainer-mode.
And ship prebuilt .inc files instead.
This should improve build times a bit.
2009-12-16 19:50:00 +02:00
Török Edvin
087a7543b8 Update .gitignore. 2009-12-16 15:17:51 +02:00
Török Edvin
46e2863c4c Merge branch 'master' into bytecode
* master: (182 commits)
  libclamav/qsort.c: fix CMP1 macro (bb#1769)
  handle floating chars
  libclamav/readdb.c: make sure static sigs with floating chars go into AC
  sigtool: --decode-sigs: handle alternatives
  sigtool: --decode-sigs: handle .ldb sigs
  inflateinit spam
  sigtool: --decode-sigs: handle .ndb sigs
  fix sig printing
  Set limit to 255 so that warning is shown if maxthreads*maxrec would exceed it.
  Enable more than 256 FD support on Solaris (bb #1764).
  fix memleaks
  sigtool: --decode-sigs; decode .db entries (bb#1246)
  fsk sxs, gimme back my dll hell!
  Fix Solaris build: cli_hex2ui has to be added to libclamav.map
  Don't error on unused functions.
  sigtool: basic sig decoding
  sigtool/sigtool.c: handle .ign2 files (bb#1625)
  libclamav/qsort.c: don't call med3 when using internal cmp
  win32: fix globbing
  unify DUPMAX def
  ...

Conflicts:
	.gitignore
	Makefile.am
	configure
	libclamav/Makefile.in
	libclamav/clamav.h
	libclamav/disasm.c
	libclamav/libclamav.map
	libclamav/matcher.c
	libclamav/others.c
	libclamav/pe.c
	libclamav/pe.h
	libclamav/readdb.c
2009-12-03 11:25:24 +02:00
aCaB
4ad03e8026 add forgotten win32/target.h 2009-10-30 12:01:13 +01:00
Török Edvin
72a03f9bd5 Merge branch 'master' into bytecode
* master: (60 commits)
  Fix build when git is not installed and using BSD make.
  Only use -fno-strict-aliasing for gcc-4.3+, to avoid bugs with older compilers (bb #1581).
  libclamav/matcher-bm.c: fix cli_bm_freeoff() (bb#1710)
  bb#1708
  implove poolsize.pl
  win32: s/C_WINDOWS/_WIN32/ in clamd, shared
  libclamav/matcher-ac.c: fix matching of logical sigs (bb#1707)
  libclamav/readdb.c: fix handling of broken .ldb sigs (bb#1701)
  libclamav: new signature blacklisting format (bb#1625)
  killclamd must always succeed (except when there's a stuck clamd).
  Fix typo.
  Better error message when clamd gets killed
  merge win32 patches from sherpya
  remove bogus debug printf
  libclamav/matcher-ac.c: add support for line marker (L) (matches CR, CRLF and boundaries)
  fix EOL in platform.h
  sis.c: fix size check
  fix several problems introduced by the win32 commits
  fix in cli_is_abspath
  win32#3
  ...

Conflicts:
	.gitignore
	Makefile.am
	configure
	configure.in
	libclamav/readdb.c
2009-10-02 10:08:44 +03:00
Török Edvin
bda59c6804 Update ignore, also sort it. 2009-09-24 18:46:50 +03:00
aCaB
4c4353fe88 fix /.gitignore 2009-09-24 17:30:56 +02:00
Török Edvin
3c5f686d75 Use automake's parallel tests feature.
This simplifies the various clamd/clamscan tests a lot,
since the valgrind tests can now be parallelized by automake,
and we don't need to do that in the script itself.
2009-09-14 19:02:50 +03:00
Török Edvin
2c4c464098 Regenerate the buildfiles. 2009-08-31 15:52:44 +03:00
aCaB
6a4e792836 update ignore 2009-07-19 17:52:14 +02:00
aCaB
489acd9ddc update ignore 2009-07-19 16:19:18 +02:00
aCaB
c4afd0b458 update ignore files 2009-06-29 11:27:46 +02:00