Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clam 2427 dead code #1217

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 1 addition & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -456,38 +456,22 @@ include(CPack)

# libclamav efficacy dependencies
find_package(OpenSSL REQUIRED)
if(OPENSSL_FOUND)
set(HAVE_LIBSSL 1)
endif()

find_package(ZLIB REQUIRED)
if(ZLIB_FOUND)
set(HAVE_ZLIB_H 1)
set(HAVE_LIBZ 1)
endif()

find_package(BZip2 REQUIRED)
if(BZIP2_FOUND)
set(HAVE_BZLIB_H 1)
endif()

# Disable CMAKE_FIND_PACKAGE_PREFER_CONFIG, temporarily, because
# we don't presently support the using libxml2's Config.cmake
set(PACKAGE_PREFER_CONFIG_BAK ${CMAKE_FIND_PACKAGE_PREFER_CONFIG})
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG FALSE)

find_package(LibXml2 REQUIRED)
if(LibXml2_FOUND)
set(HAVE_LIBXML2 1)
endif()

# Restore the requested CMAKE_FIND_PACKAGE_PREFER_CONFIG setting
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ${PACKAGE_PREFER_CONFIG_BAK})

find_package(PCRE2 REQUIRED)
if(PCRE2_FOUND)
set(HAVE_PCRE 1)
set(USING_PCRE2 1)
endif()

# libclamav feature dependencies
if(NOT WIN32)
Expand All @@ -502,8 +486,6 @@ else()
set(JSONC_USE_STATIC ON)
endif()
find_package(JSONC REQUIRED)
# Set variable required by libclamav to use libjson-c
set(HAVE_JSON 1)

set(LLVM_MAX_VER "13")
set(LLVM_MIN_VER "8")
Expand Down
31 changes: 0 additions & 31 deletions clamav-config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@
/* attrib packed */
#cmakedefine HAVE_ATTRIB_PACKED 1

/* have bzip2 */
#cmakedefine HAVE_BZLIB_H 1

/* Define to 1 if you have the `ctime_r' function. */
#cmakedefine HAVE_CTIME_R 1

Expand All @@ -120,10 +117,6 @@
you don't. */
#cmakedefine HAVE_DECL_CYGWIN_CONV_PATH 1

/* Define to 1 if you have a deprecated version of the 'libjson' library
(-ljson). */
#cmakedefine HAVE_DEPRECATED_JSON 1

/* Define to 1 if you have the <dirent.h> header file. */
#cmakedefine HAVE_DIRENT_H 1

Expand Down Expand Up @@ -181,9 +174,6 @@
/* Define to 1 if you have the <inttypes.h> header file (for libjson-c). */
#cmakedefine JSON_C_HAVE_INTTYPES_H 1

/* Define to 1 if you have the 'libjson' library (-ljson). */
#cmakedefine HAVE_JSON 1

/* Define to '1' if you have the check.h library */
#cmakedefine HAVE_LIBCHECK 1

Expand All @@ -193,15 +183,6 @@
/* Define to '1' if you have the curses.h library */
#cmakedefine HAVE_LIBPDCURSES 1

/* Define to 1 if you have the `ssl' library (-lssl). */
#cmakedefine HAVE_LIBSSL 1

/* Define to 1 if you have the 'libxml2' library (-lxml2). */
#cmakedefine HAVE_LIBXML2 1

/* Define to 1 if you have the `z' library (-lz). */
#cmakedefine HAVE_LIBZ 1

/* Define to 1 if you have the <limits.h> header file. */
#cmakedefine HAVE_LIMITS_H 1

Expand All @@ -221,12 +202,6 @@
MAP_PRIVATE. */
#cmakedefine HAVE_MMAP 1

/* Define to 1 if you have a pcre library (-lpcre). */
#cmakedefine HAVE_PCRE 1

/* Define to 1 if you using the pcre2 library. */
#cmakedefine USING_PCRE2 1

/* Define to 1 if you have the `poll' function. */
#cmakedefine HAVE_POLL 1

Expand Down Expand Up @@ -389,9 +364,6 @@
/* yara sources are compiled in */
#define HAVE_YARA 1

/* Define to 1 if you have the <zlib.h> header file. */
#cmakedefine HAVE_ZLIB_H 1

/* For internal use only - DO NOT DEFINE */
#cmakedefine HAVE__INTERNAL__SHA_COLLECT 1

Expand Down Expand Up @@ -493,9 +465,6 @@
/* Define to if you have the ANSI C header files. */
#cmakedefine STDC_HEADERS 1

/* Support for IPv6 */
#cmakedefine SUPPORT_IPv6 1

/* enable memory pools */
#cmakedefine USE_MPOOL 1

Expand Down
22 changes: 0 additions & 22 deletions clamconf/clamconf.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,6 @@ int main(int argc, char **argv)
#ifdef USE_MPOOL
printf("MEMPOOL ");
#endif
#ifdef SUPPORT_IPv6
printf("IPv6 ");
#endif
#ifdef CLAMUKO
printf("CLAMUKO ");
#endif
#ifdef C_BIGSTACK
printf("BIGSTACK ");
#endif
Expand All @@ -462,25 +456,9 @@ int main(int argc, char **argv)
if (get_fpu_endian() != FPU_ENDIAN_UNKNOWN)
#endif
printf("AUTOIT_EA06 ");
#ifdef HAVE_BZLIB_H
printf("BZIP2 ");
#endif

#ifdef HAVE_LIBXML2
printf("LIBXML2 ");
#endif
#ifdef HAVE_PCRE
#if USING_PCRE2
printf("PCRE2 ");
#else
printf("PCRE ");
#endif
#endif
#ifdef HAVE_ICONV
printf("ICONV ");
#endif
#ifdef HAVE_JSON
printf("JSON ");
#endif
if (have_rar)
printf("RAR ");
Expand Down
8 changes: 0 additions & 8 deletions clamd/server-th.c
Original file line number Diff line number Diff line change
Expand Up @@ -1377,17 +1377,9 @@ int recvloop(int *socketds, unsigned nsockets, struct cl_engine *engine, unsigne
options.dev |= CL_SCAN_DEV_COLLECT_SHA;
#endif

#if HAVE_JSON
/* JSON check to prevent engine loading if specified without libjson-c */
if (optget(opts, "GenerateMetadataJson")->enabled)
options.general |= CL_SCAN_GENERAL_COLLECT_METADATA;
#else
if (optget(opts, "GenerateMetadataJson")->enabled) {
logg(LOGG_ERROR, "Can't generate json (gen-json). libjson-c dev library was missing or misconfigured when ClamAV was built.\n");
cl_engine_free(engine);
return 1;
}
#endif

selfchk = optget(opts, "SelfCheck")->numarg;
if (!selfchk) {
Expand Down
2 changes: 0 additions & 2 deletions clamscan/clamscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,11 +336,9 @@ void help(void)
mprintf(LOGG_INFO, " --max-partitions=#n Maximum number of partitions in disk image to be scanned\n");
mprintf(LOGG_INFO, " --max-iconspe=#n Maximum number of icons in PE file to be scanned\n");
mprintf(LOGG_INFO, " --max-rechwp3=#n Maximum recursive calls to HWP3 parsing function\n");
#if HAVE_PCRE
mprintf(LOGG_INFO, " --pcre-match-limit=#n Maximum calls to the PCRE match function.\n");
mprintf(LOGG_INFO, " --pcre-recmatch-limit=#n Maximum recursive calls to the PCRE match function.\n");
mprintf(LOGG_INFO, " --pcre-max-filesize=#n Maximum size file to perform PCRE subsig matching.\n");
#endif /* HAVE_PCRE */
mprintf(LOGG_INFO, " --disable-cache Disable caching and cache checks for hash sums of scanned files.\n");
mprintf(LOGG_INFO, "\n");
mprintf(LOGG_INFO, "Pass in - as the filename for stdin.\n");
Expand Down
16 changes: 2 additions & 14 deletions clamscan/manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -1236,18 +1236,8 @@ int scanmanager(const struct optstruct *opts)
}
}

/* JSON check to prevent engine loading if specified without libjson-c */
#if HAVE_JSON
if (optget(opts, "gen-json")->enabled)
options.general |= CL_SCAN_GENERAL_COLLECT_METADATA;
#else
if (optget(opts, "gen-json")->enabled) {
logg(LOGG_ERROR, "Can't generate json (gen-json). libjson-c dev library was missing or misconfigured when ClamAV was built.\n");

ret = 2;
goto done;
}
#endif

if ((opt = optget(opts, "tempdir"))->enabled) {
if ((ret = cl_engine_set_str(engine, CL_ENGINE_TMPDIR, opt->strarg))) {
Expand Down Expand Up @@ -1676,13 +1666,11 @@ int scanmanager(const struct optstruct *opts)
if (!strcasecmp(opt->strarg, "bytecode")) {
cli_sigperf_print();
cli_sigperf_events_destroy();
}
#if HAVE_PCRE
else if (!strcasecmp(opt->strarg, "pcre")) {
} else if (!strcasecmp(opt->strarg, "pcre")) {
cli_pcre_perf_print();
cli_pcre_perf_events_destroy();
}
#endif

opt = opt->nextarg;
}
}
Expand Down
7 changes: 0 additions & 7 deletions libclamav/bytecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@
#include <assert.h>
#include <fcntl.h>

#if HAVE_JSON
#include "json.h"
#endif

#include "dconf.h"
#include "clamav.h"
#include "others.h"
Expand Down Expand Up @@ -195,13 +192,11 @@ static void bytecode_context_reset(struct cli_bc_ctx *ctx)
ctx->lzmas = NULL;
ctx->nlzmas = 0;

#if HAVE_BZLIB_H
for (i = 0; i < ctx->nbzip2s; i++)
cli_bcapi_bzip2_done(ctx, i);
free(ctx->bzip2s);
ctx->bzip2s = NULL;
ctx->nbzip2s = 0;
#endif

for (i = 0; i < ctx->nbuffers; i++)
cli_bcapi_buffer_pipe_done(ctx, i);
Expand Down Expand Up @@ -231,11 +226,9 @@ static void bytecode_context_reset(struct cli_bc_ctx *ctx)
/* Use input_switch() to free the extracted file fmap, if one exists */
cli_bcapi_input_switch(ctx, 0);

#if HAVE_JSON
free((json_object **)(ctx->jsonobjs));
ctx->jsonobjs = NULL;
ctx->njsonobjs = 0;
#endif

ctx->containertype = CL_TYPE_ANY;
}
Expand Down
Loading
Loading