mirror of
https://github.com/Cisco-Talos/clamav.git
synced 2026-05-24 16:31:58 -04:00
Remove libbz2 dead code
As of ClamAV 0.105, libbz2 is required. There is also no option to disable bz2 support. This commit removes the dead code associated with the old build option.
This commit is contained in:
committed by
Micah Snyder
parent
71ff5c579c
commit
45c6938be8
@@ -467,9 +467,6 @@ if(ZLIB_FOUND)
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -462,9 +462,6 @@ 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_ICONV
|
||||
printf("ICONV ");
|
||||
|
||||
@@ -195,13 +195,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);
|
||||
|
||||
@@ -38,9 +38,7 @@
|
||||
#if HAVE_JSON
|
||||
#include <json.h>
|
||||
#endif
|
||||
#if HAVE_BZLIB_H
|
||||
#include <bzlib.h>
|
||||
#endif
|
||||
|
||||
#include "clamav.h"
|
||||
#include "clambc.h"
|
||||
@@ -72,13 +70,11 @@ struct bc_lzma {
|
||||
int32_t to;
|
||||
};
|
||||
|
||||
#if HAVE_BZLIB_H
|
||||
struct bc_bzip2 {
|
||||
bz_stream stream;
|
||||
int32_t from;
|
||||
int32_t to;
|
||||
};
|
||||
#endif
|
||||
|
||||
uint32_t cli_bcapi_test1(struct cli_bc_ctx *ctx, uint32_t a, uint32_t b)
|
||||
{
|
||||
@@ -1048,7 +1044,6 @@ int32_t cli_bcapi_lzma_done(struct cli_bc_ctx *ctx, int32_t id)
|
||||
|
||||
int32_t cli_bcapi_bzip2_init(struct cli_bc_ctx *ctx, int32_t from, int32_t to)
|
||||
{
|
||||
#if HAVE_BZLIB_H
|
||||
int ret;
|
||||
struct bc_bzip2 *b;
|
||||
unsigned n = ctx->nbzip2s + 1;
|
||||
@@ -1086,23 +1081,17 @@ int32_t cli_bcapi_bzip2_init(struct cli_bc_ctx *ctx, int32_t from, int32_t to)
|
||||
}
|
||||
|
||||
return n - 1;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#if HAVE_BZLIB_H
|
||||
static struct bc_bzip2 *get_bzip2(struct cli_bc_ctx *ctx, int32_t id)
|
||||
{
|
||||
if (id < 0 || (unsigned int)id >= ctx->nbzip2s || !ctx->bzip2s)
|
||||
return NULL;
|
||||
return &ctx->bzip2s[id];
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t cli_bcapi_bzip2_process(struct cli_bc_ctx *ctx, int32_t id)
|
||||
{
|
||||
#if HAVE_BZLIB_H
|
||||
int ret;
|
||||
unsigned avail_in_orig, avail_out_orig;
|
||||
struct bc_bzip2 *b = get_bzip2(ctx, id);
|
||||
@@ -1135,23 +1124,16 @@ int32_t cli_bcapi_bzip2_process(struct cli_bc_ctx *ctx, int32_t id)
|
||||
}
|
||||
|
||||
return ret;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int32_t cli_bcapi_bzip2_done(struct cli_bc_ctx *ctx, int32_t id)
|
||||
{
|
||||
#if HAVE_BZLIB_H
|
||||
struct bc_bzip2 *b = get_bzip2(ctx, id);
|
||||
if (!b || b->from == -1 || b->to == -1)
|
||||
return -1;
|
||||
BZ2_bzDecompressEnd(&b->stream);
|
||||
b->from = b->to = -1;
|
||||
return 0;
|
||||
#else
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
int32_t cli_bcapi_bytecode_rt_error(struct cli_bc_ctx *ctx, int32_t id)
|
||||
|
||||
@@ -199,9 +199,7 @@ struct cli_bc_ctx {
|
||||
unsigned found;
|
||||
unsigned ninflates;
|
||||
unsigned nlzmas;
|
||||
#if HAVE_BZLIB_H
|
||||
unsigned nbzip2s;
|
||||
#endif
|
||||
bc_dbg_callback_trace trace;
|
||||
bc_dbg_callback_trace_op trace_op;
|
||||
bc_dbg_callback_trace_val trace_val;
|
||||
@@ -216,9 +214,7 @@ struct cli_bc_ctx {
|
||||
mpool_t *mpool;
|
||||
struct bc_inflate *inflates;
|
||||
struct bc_lzma *lzmas;
|
||||
#if HAVE_BZLIB_H
|
||||
struct bc_bzip2 *bzip2s;
|
||||
#endif
|
||||
struct bc_buffer *buffers;
|
||||
unsigned nbuffers;
|
||||
unsigned nhashsets;
|
||||
|
||||
@@ -37,14 +37,12 @@
|
||||
#if HAVE_LIBZ
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
#if HAVE_BZLIB_H
|
||||
#include <bzlib.h>
|
||||
#ifdef NOBZ2PREFIX
|
||||
#define BZ2_bzDecompress bzDecompress
|
||||
#define BZ2_bzDecompressEnd bzDecompressEnd
|
||||
#define BZ2_bzDecompressInit bzDecompressInit
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <libxml/xmlreader.h>
|
||||
|
||||
@@ -552,13 +550,8 @@ static int dmg_track_sectors(uint64_t *total, uint8_t *data_to_write,
|
||||
#endif
|
||||
break;
|
||||
case DMG_STRIPE_BZ:
|
||||
#if HAVE_BZLIB_H
|
||||
*data_to_write = 1;
|
||||
usable = 1;
|
||||
#else
|
||||
cli_warnmsg("dmg_track_sectors: Need bzip2 decompression to properly scan this file.\n");
|
||||
return CL_EFORMAT;
|
||||
#endif
|
||||
break;
|
||||
case DMG_STRIPE_EMPTY:
|
||||
case DMG_STRIPE_ZEROES:
|
||||
@@ -846,16 +839,13 @@ static int dmg_stripe_bzip(cli_ctx *ctx, int fd, uint32_t index, struct dmg_mish
|
||||
size_t len = mish_set->stripes[index].dataLength;
|
||||
uint64_t size_so_far = 0;
|
||||
uint64_t expected_len = mish_set->stripes[index].sectorCount * DMG_SECTOR_SIZE;
|
||||
#if HAVE_BZLIB_H
|
||||
int rc;
|
||||
bz_stream strm;
|
||||
uint8_t obuf[BUFSIZ];
|
||||
#endif
|
||||
|
||||
cli_dbgmsg("dmg_stripe_bzip: stripe " STDu32 " initial len " STDu64 " expected len " STDu64 "\n",
|
||||
index, (uint64_t)len, (uint64_t)expected_len);
|
||||
|
||||
#if HAVE_BZLIB_H
|
||||
memset(&strm, 0, sizeof(strm));
|
||||
strm.next_out = (char *)obuf;
|
||||
strm.avail_out = sizeof(obuf);
|
||||
@@ -953,7 +943,6 @@ static int dmg_stripe_bzip(cli_ctx *ctx, int fd, uint32_t index, struct dmg_mish
|
||||
} while ((rc == BZ_OK) && (len > 0));
|
||||
|
||||
BZ2_bzDecompressEnd(&strm);
|
||||
#endif
|
||||
|
||||
if (ret == CL_CLEAN) {
|
||||
if (size_so_far != expected_len) {
|
||||
|
||||
@@ -64,10 +64,7 @@
|
||||
#include <wchar.h>
|
||||
#include <locale.h>
|
||||
#include <zlib.h>
|
||||
|
||||
#if HAVE_BZLIB_H
|
||||
#include <bzlib.h>
|
||||
#endif
|
||||
|
||||
#include "lzma_iface.h"
|
||||
|
||||
@@ -2040,7 +2037,6 @@ done:
|
||||
return status;
|
||||
}
|
||||
|
||||
#ifdef HAVE_BZLIB_H
|
||||
cl_error_t cli_egg_bzip2_decompress(char* compressed, size_t compressed_size, char** decompressed, size_t* decompressed_size)
|
||||
{
|
||||
cl_error_t status = CL_EPARSE;
|
||||
@@ -2153,7 +2149,6 @@ done:
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
||||
cl_error_t cli_egg_lzma_decompress(char* compressed, size_t compressed_size, char** decompressed, size_t* decompressed_size)
|
||||
{
|
||||
@@ -2402,7 +2397,6 @@ cl_error_t cli_egg_extract_file(void* hArchive, const char** filename, const cha
|
||||
break;
|
||||
}
|
||||
case BLOCK_HEADER_COMPRESS_ALGORITHM_BZIP2: {
|
||||
#if HAVE_BZLIB_H
|
||||
char* decompressed_block = NULL;
|
||||
size_t decompressed_block_size = 0;
|
||||
|
||||
@@ -2429,10 +2423,6 @@ cl_error_t cli_egg_extract_file(void* hArchive, const char** filename, const cha
|
||||
|
||||
retval = CL_SUCCESS;
|
||||
break;
|
||||
#else
|
||||
cli_warnmsg("cli_egg_extract_file: BZIP2 decompression support not available.\n");
|
||||
goto done;
|
||||
#endif
|
||||
}
|
||||
case BLOCK_HEADER_COMPRESS_ALGORITHM_AZO: {
|
||||
cli_warnmsg("cli_egg_extract_file: AZO decompression not yet supported.\n");
|
||||
|
||||
@@ -121,9 +121,7 @@
|
||||
// libclamunrar_iface
|
||||
#include "unrar_iface.h"
|
||||
|
||||
#ifdef HAVE_BZLIB_H
|
||||
#include <bzlib.h>
|
||||
#endif
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
@@ -1236,15 +1234,6 @@ static cl_error_t cli_scangzip(cli_ctx *ctx)
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef HAVE_BZLIB_H
|
||||
static cl_error_t cli_scanbzip(cli_ctx *ctx)
|
||||
{
|
||||
cli_warnmsg("cli_scanbzip: bzip2 support not compiled in\n");
|
||||
return CL_CLEAN;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#ifdef NOBZ2PREFIX
|
||||
#define BZ2_bzDecompressInit bzDecompressInit
|
||||
#define BZ2_bzDecompress bzDecompress
|
||||
@@ -1341,7 +1330,6 @@ static cl_error_t cli_scanbzip(cli_ctx *ctx)
|
||||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
static cl_error_t cli_scanxz(cli_ctx *ctx)
|
||||
{
|
||||
|
||||
@@ -39,9 +39,8 @@
|
||||
|
||||
#include <zlib.h>
|
||||
#include "inflate64.h"
|
||||
#if HAVE_BZLIB_H
|
||||
|
||||
#include <bzlib.h>
|
||||
#endif
|
||||
|
||||
#include "explode.h"
|
||||
#include "others.h"
|
||||
@@ -242,7 +241,6 @@ static cl_error_t unz(
|
||||
break;
|
||||
}
|
||||
|
||||
#if HAVE_BZLIB_H
|
||||
#ifdef NOBZ2PREFIX
|
||||
#define BZ2_bzDecompress bzDecompress
|
||||
#define BZ2_bzDecompressEnd bzDecompressEnd
|
||||
@@ -284,7 +282,6 @@ static cl_error_t unz(
|
||||
if (res == BZ_STREAM_END) res = 0;
|
||||
break;
|
||||
}
|
||||
#endif /* HAVE_BZLIB_H */
|
||||
|
||||
case ALG_IMPLODE: {
|
||||
struct xplstate strm;
|
||||
@@ -322,9 +319,6 @@ static cl_error_t unz(
|
||||
case ALG_LZMA:
|
||||
/* easy but there's not a single sample in the zoo */
|
||||
|
||||
#if !HAVE_BZLIB_H
|
||||
case ALG_BZIP2:
|
||||
#endif
|
||||
case ALG_SHRUNK:
|
||||
case ALG_REDUCE1:
|
||||
case ALG_REDUCE2:
|
||||
|
||||
@@ -543,12 +543,6 @@ static unsigned skip_files(void)
|
||||
skipped += 2;
|
||||
}
|
||||
|
||||
/* skip .bz2 files if bzip is disabled */
|
||||
#if HAVE_BZLIB_H
|
||||
#else
|
||||
skipped += 2;
|
||||
#endif
|
||||
|
||||
#if HAVE_UNRAR
|
||||
#else
|
||||
skipped += 2;
|
||||
|
||||
Reference in New Issue
Block a user