Distcheck fixes.

0.96
Török Edvin 16 years ago
parent 5b5e4e6ef0
commit d0934caf99
  1. 5
      clambc/bcrun.c
  2. 1
      libclamav/Makefile.am
  3. 63
      libclamav/Makefile.in
  4. 10
      libclamav/bytecode.c
  5. 1
      libclamav/bytecode.h
  6. 3
      libclamav/bytecode_api.c
  7. 4
      libclamav/bytecode_nojit.c
  8. 3
      libclamav/c++/Makefile.am
  9. 3
      libclamav/c++/Makefile.in
  10. 4
      libclamav/c++/bytecode2llvm.cpp
  11. 1
      libclamav/libclamav.map
  12. 2
      libclamav/pe.c

@ -130,10 +130,11 @@ int main(int argc, char *argv[])
exit(1); exit(1);
} }
if(optget(opts, "version")->enabled) { if(optget(opts, "version")->enabled) {
char* argvx[] = {argv[0], "--version",NULL}; char versions[] = "--version";
char* argvx[] = {argv[0], versions,NULL};
printf("Clam AntiVirus Bytecode Testing Tool %s\n", get_version()); printf("Clam AntiVirus Bytecode Testing Tool %s\n", get_version());
cl_init(CL_INIT_DEFAULT); cl_init(CL_INIT_DEFAULT);
cli_bytecode_debug(2, argvx); cli_bytecode_printversion();
optfree(opts); optfree(opts);
exit(0); exit(0);
} }

@ -181,6 +181,7 @@ libclamav_la_SOURCES = \
pe_icons.h \ pe_icons.h \
disasm.c \ disasm.c \
disasm.h \ disasm.h \
disasm-common.h \
disasmpriv.h \ disasmpriv.h \
upx.c \ upx.c \
upx.h \ upx.h \

@ -119,28 +119,29 @@ am__libclamav_la_SOURCES_DIST = clamav.h matcher-ac.c matcher-ac.h \
mbox.h message.c message.h table.c table.h text.c text.h \ mbox.h message.c message.h table.c table.h text.c text.h \
ole2_extract.c ole2_extract.h vba_extract.c vba_extract.h \ ole2_extract.c ole2_extract.h vba_extract.c vba_extract.h \
cltypes.h msexpand.c msexpand.h pe.c pe.h pe_icons.c \ cltypes.h msexpand.c msexpand.h pe.c pe.h pe_icons.c \
pe_icons.h disasm.c disasm.h disasmpriv.h upx.c upx.h \ pe_icons.h disasm.c disasm.h disasm-common.h disasmpriv.h \
htmlnorm.c htmlnorm.h chmunpack.c chmunpack.h rebuildpe.c \ upx.c upx.h htmlnorm.c htmlnorm.h chmunpack.c chmunpack.h \
rebuildpe.h petite.c petite.h wwunpack.c wwunpack.h unsp.c \ rebuildpe.c rebuildpe.h petite.c petite.h wwunpack.c \
unsp.h aspack.c aspack.h packlibs.c packlibs.h fsg.c fsg.h \ wwunpack.h unsp.c unsp.h aspack.c aspack.h packlibs.c \
mew.c mew.h upack.c upack.h line.c line.h untar.c untar.h \ packlibs.h fsg.c fsg.h mew.c mew.h upack.c upack.h line.c \
unzip.c unzip.h inflate64.c inflate64.h inffixed64.h \ line.h untar.c untar.h unzip.c unzip.h inflate64.c inflate64.h \
inflate64_priv.h special.c special.h binhex.c binhex.h \ inffixed64.h inflate64_priv.h special.c special.h binhex.c \
is_tar.c is_tar.h tnef.c tnef.h autoit.c autoit.h unarj.c \ binhex.h is_tar.c is_tar.h tnef.c tnef.h autoit.c autoit.h \
unarj.h nsis/bzlib.c nsis/bzlib_private.h nsis/nsis_bzlib.h \ unarj.c unarj.h nsis/bzlib.c nsis/bzlib_private.h \
nsis/nulsft.c nsis/nulsft.h nsis/infblock.c nsis/nsis_zconf.h \ nsis/nsis_bzlib.h nsis/nulsft.c nsis/nulsft.h nsis/infblock.c \
nsis/nsis_zlib.h nsis/nsis_zutil.h pdf.c pdf.h spin.c spin.h \ nsis/nsis_zconf.h nsis/nsis_zlib.h nsis/nsis_zutil.h pdf.c \
yc.c yc.h elf.c elf.h execs.h sis.c sis.h uuencode.c \ pdf.h spin.c spin.h yc.c yc.h elf.c elf.h execs.h sis.c sis.h \
uuencode.h phishcheck.c phishcheck.h phish_domaincheck_db.c \ uuencode.c uuencode.h phishcheck.c phishcheck.h \
phish_domaincheck_db.h phish_whitelist.c phish_whitelist.h \ phish_domaincheck_db.c phish_domaincheck_db.h \
iana_cctld.h iana_tld.h regex_list.c regex_list.h \ phish_whitelist.c phish_whitelist.h iana_cctld.h iana_tld.h \
regex_suffix.c regex_suffix.h mspack.c mspack.h cab.c cab.h \ regex_list.c regex_list.h regex_suffix.c regex_suffix.h \
entconv.c entconv.h entitylist.h encoding_aliases.h hashtab.c \ mspack.c mspack.h cab.c cab.h entconv.c entconv.h entitylist.h \
hashtab.h dconf.c dconf.h 7z/LzmaDec.c 7z/LzmaDec.h 7z/Types.h \ encoding_aliases.h hashtab.c hashtab.h dconf.c dconf.h \
lzma_iface.c lzma_iface.h 7z.c 7z.h 7z/7zFile.c 7z/7zFile.h \ 7z/LzmaDec.c 7z/LzmaDec.h 7z/Types.h lzma_iface.c lzma_iface.h \
7z/7zStream.c 7z/CpuArch.h 7z/7zCrc.c 7z/7zCrc.h 7z/7zBuf.c \ 7z.c 7z.h 7z/7zFile.c 7z/7zFile.h 7z/7zStream.c 7z/CpuArch.h \
7z/7zBuf.h 7z/Bcj2.c 7z/Bcj2.h 7z/Bra.c 7z/Bra.h 7z/Bra86.c \ 7z/7zCrc.c 7z/7zCrc.h 7z/7zBuf.c 7z/7zBuf.h 7z/Bcj2.c \
7z/BraIA64.c 7z/Archive/7z/7zIn.c 7z/Archive/7z/7zIn.h \ 7z/Bcj2.h 7z/Bra.c 7z/Bra.h 7z/Bra86.c 7z/BraIA64.c \
7z/Archive/7z/7zIn.c 7z/Archive/7z/7zIn.h \
7z/Archive/7z/7zDecode.c 7z/Archive/7z/7zDecode.h \ 7z/Archive/7z/7zDecode.c 7z/Archive/7z/7zDecode.h \
7z/Archive/7z/7zItem.c 7z/Archive/7z/7zItem.h \ 7z/Archive/7z/7zItem.c 7z/Archive/7z/7zItem.h \
7z/Archive/7z/7zHeader.c 7z/Archive/7z/7zHeader.h \ 7z/Archive/7z/7zHeader.c 7z/Archive/7z/7zHeader.h \
@ -614,15 +615,15 @@ libclamav_la_SOURCES = clamav.h matcher-ac.c matcher-ac.h matcher-bm.c \
rtf.c rtf.h blob.c blob.h mbox.c mbox.h message.c message.h \ rtf.c rtf.h blob.c blob.h mbox.c mbox.h message.c message.h \
table.c table.h text.c text.h ole2_extract.c ole2_extract.h \ table.c table.h text.c text.h ole2_extract.c ole2_extract.h \
vba_extract.c vba_extract.h cltypes.h msexpand.c msexpand.h \ vba_extract.c vba_extract.h cltypes.h msexpand.c msexpand.h \
pe.c pe.h pe_icons.c pe_icons.h disasm.c disasm.h disasmpriv.h \ pe.c pe.h pe_icons.c pe_icons.h disasm.c disasm.h \
upx.c upx.h htmlnorm.c htmlnorm.h chmunpack.c chmunpack.h \ disasm-common.h disasmpriv.h upx.c upx.h htmlnorm.c htmlnorm.h \
rebuildpe.c rebuildpe.h petite.c petite.h wwunpack.c \ chmunpack.c chmunpack.h rebuildpe.c rebuildpe.h petite.c \
wwunpack.h unsp.c unsp.h aspack.c aspack.h packlibs.c \ petite.h wwunpack.c wwunpack.h unsp.c unsp.h aspack.c aspack.h \
packlibs.h fsg.c fsg.h mew.c mew.h upack.c upack.h line.c \ packlibs.c packlibs.h fsg.c fsg.h mew.c mew.h upack.c upack.h \
line.h untar.c untar.h unzip.c unzip.h inflate64.c inflate64.h \ line.c line.h untar.c untar.h unzip.c unzip.h inflate64.c \
inffixed64.h inflate64_priv.h special.c special.h binhex.c \ inflate64.h inffixed64.h inflate64_priv.h special.c special.h \
binhex.h is_tar.c is_tar.h tnef.c tnef.h autoit.c autoit.h \ binhex.c binhex.h is_tar.c is_tar.h tnef.c tnef.h autoit.c \
unarj.c unarj.h nsis/bzlib.c nsis/bzlib_private.h \ autoit.h unarj.c unarj.h nsis/bzlib.c nsis/bzlib_private.h \
nsis/nsis_bzlib.h nsis/nulsft.c nsis/nulsft.h nsis/infblock.c \ nsis/nsis_bzlib.h nsis/nulsft.c nsis/nulsft.h nsis/infblock.c \
nsis/nsis_zconf.h nsis/nsis_zlib.h nsis/nsis_zutil.h pdf.c \ nsis/nsis_zconf.h nsis/nsis_zlib.h nsis/nsis_zutil.h pdf.c \
pdf.h spin.c spin.h yc.c yc.h elf.c elf.h execs.h sis.c sis.h \ pdf.h spin.c spin.h yc.c yc.h elf.c elf.h execs.h sis.c sis.h \

@ -30,6 +30,7 @@
#include "bytecode.h" #include "bytecode.h"
#include "bytecode_priv.h" #include "bytecode_priv.h"
#include "readdb.h" #include "readdb.h"
#include "scanners.h"
#include <string.h> #include <string.h>
/* TODO: we should make sure lsigcnt is never NULL, and has at least as many /* TODO: we should make sure lsigcnt is never NULL, and has at least as many
@ -82,7 +83,7 @@ int cli_bytecode_context_getresult_file(struct cli_bc_ctx *ctx, char **tempfilen
} }
/* resets bytecode state, so you can run another bytecode with same ctx */ /* resets bytecode state, so you can run another bytecode with same ctx */
int cli_bytecode_context_reset(struct cli_bc_ctx *ctx) static int cli_bytecode_context_reset(struct cli_bc_ctx *ctx)
{ {
free(ctx->opsizes); free(ctx->opsizes);
free(ctx->values); free(ctx->values);
@ -94,7 +95,8 @@ int cli_bytecode_context_reset(struct cli_bc_ctx *ctx)
if (ctx->outfd != -1) { if (ctx->outfd != -1) {
cli_dbgmsg("Bytecode: nobody cared about FD %d, %s\n", ctx->outfd, cli_dbgmsg("Bytecode: nobody cared about FD %d, %s\n", ctx->outfd,
ctx->tempfile); ctx->tempfile);
ftruncate(ctx->outfd, 0); if (ftruncate(ctx->outfd, 0) == -1)
cli_dbgmsg("ftruncate failed\n");
close(ctx->outfd); close(ctx->outfd);
cli_unlink(ctx->tempfile); cli_unlink(ctx->tempfile);
free(ctx->tempfile); free(ctx->tempfile);
@ -1579,7 +1581,6 @@ int cli_bytecode_done(struct cli_all_bc *allbc)
int cli_bytecode_context_setfile(struct cli_bc_ctx *ctx, fmap_t *map) int cli_bytecode_context_setfile(struct cli_bc_ctx *ctx, fmap_t *map)
{ {
struct stat buf;
ctx->fmap = map; ctx->fmap = map;
ctx->file_size = map->len + map->offset; ctx->file_size = map->len + map->offset;
return 0; return 0;
@ -1654,7 +1655,8 @@ int cli_bytecode_runhook(const struct cl_engine *engine, struct cli_bc_ctx *ctx,
cli_dbgmsg("***** Scanning unpacked file ******\n"); cli_dbgmsg("***** Scanning unpacked file ******\n");
ret = cli_magic_scandesc(fd, cctx); ret = cli_magic_scandesc(fd, cctx);
if (!cctx || !cctx->engine->keeptmp) if (!cctx || !cctx->engine->keeptmp)
ftruncate(fd, 0); if (ftruncate(fd, 0) == -1)
cli_dbgmsg("ftruncate failed\n");
close(fd); close(fd);
if (!cctx || !cctx->engine->keeptmp) { if (!cctx || !cctx->engine->keeptmp) {
if (cli_unlink(tempfile)) if (cli_unlink(tempfile))

@ -110,6 +110,7 @@ extern "C" {
int bytecode_init(void); int bytecode_init(void);
/* Bytecode internal debug API */ /* Bytecode internal debug API */
void cli_bytecode_debug(int argc, char **argv); void cli_bytecode_debug(int argc, char **argv);
void cli_bytecode_printversion();
void cli_bytecode_debug_printsrc(const struct cli_bc_ctx *ctx); void cli_bytecode_debug_printsrc(const struct cli_bc_ctx *ctx);
typedef void (*bc_dbg_callback_trace)(struct cli_bc_ctx*, unsigned event); typedef void (*bc_dbg_callback_trace)(struct cli_bc_ctx*, unsigned event);

@ -97,6 +97,7 @@ uint32_t cli_bcapi_setvirusname(struct cli_bc_ctx* ctx, const uint8_t *name, uin
uint32_t cli_bcapi_disasm_x86(struct cli_bc_ctx *ctx, struct DISASM_RESULT *res, uint32_t len) uint32_t cli_bcapi_disasm_x86(struct cli_bc_ctx *ctx, struct DISASM_RESULT *res, uint32_t len)
{ {
//TODO: call disasm_x86_wrap, which outputs a MARIO struct //TODO: call disasm_x86_wrap, which outputs a MARIO struct
return -1;
} }
/* TODO: field in ctx, id of last bytecode that called magicscandesc, reset /* TODO: field in ctx, id of last bytecode that called magicscandesc, reset
@ -129,7 +130,7 @@ int32_t cli_bcapi_write(struct cli_bc_ctx *ctx, uint8_t*data, int32_t len)
res = cli_writen(ctx->outfd, data, len); res = cli_writen(ctx->outfd, data, len);
if (res > 0) ctx->written += res; if (res > 0) ctx->written += res;
if (res == -1) if (res == -1)
cli_dbgmsg("Bytecode API: write failed: %s\n", errno); cli_dbgmsg("Bytecode API: write failed: %d\n", errno);
return res; return res;
} }

@ -20,6 +20,7 @@
* MA 02110-1301, USA. * MA 02110-1301, USA.
*/ */
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "cltypes.h" #include "cltypes.h"
#include "bytecode.h" #include "bytecode.h"
@ -69,4 +70,7 @@ int bytecode_init(void)
void cli_bytecode_debug_printsrc(const struct cli_bc_ctx *ctx) { void cli_bytecode_debug_printsrc(const struct cli_bc_ctx *ctx) {
// Empty // Empty
} }
void cli_bytecode_printversion() {
printf("LLVM not compiled in\n");
}
int have_clamjit=0; int have_clamjit=0;

@ -830,7 +830,8 @@ distclean-local:
rm -f llvm/mklib llvm/tools/Makefile llvm/tools/llvmc/llvm-config.in llvm/utils/Makefile rm -f llvm/mklib llvm/tools/Makefile llvm/tools/llvmc/llvm-config.in llvm/utils/Makefile
rm -f llvm/Makefile.common llvm/Makefile.config llvm/config.log llvm/unittests/Makefile rm -f llvm/Makefile.common llvm/Makefile.config llvm/config.log llvm/unittests/Makefile
rm -f llvm/llvm.spec llvm/include/llvm/Config/AsmPrinters.def llvm/include/llvm/Config/config.h rm -f llvm/llvm.spec llvm/include/llvm/Config/AsmPrinters.def llvm/include/llvm/Config/config.h
rm -f llvm/include/llvm/Support/DataTypes.h llvm/include/llvm/Config/Targets.def rm -f llvm/include/llvm/Config/Disassemblers.def
rm -f llvm/include/llvm/System/DataTypes.h llvm/include/llvm/Config/Targets.def
rm -f llvm/tools/llvmc/plugins/Base/Base.td llvm/tools/llvm-config/llvm-config.in rm -f llvm/tools/llvmc/plugins/Base/Base.td llvm/tools/llvm-config/llvm-config.in
rm -f llvm/include/llvm/Config/AsmParsers.def rm -f llvm/include/llvm/Config/AsmParsers.def

@ -6659,7 +6659,8 @@ distclean-local:
rm -f llvm/mklib llvm/tools/Makefile llvm/tools/llvmc/llvm-config.in llvm/utils/Makefile rm -f llvm/mklib llvm/tools/Makefile llvm/tools/llvmc/llvm-config.in llvm/utils/Makefile
rm -f llvm/Makefile.common llvm/Makefile.config llvm/config.log llvm/unittests/Makefile rm -f llvm/Makefile.common llvm/Makefile.config llvm/config.log llvm/unittests/Makefile
rm -f llvm/llvm.spec llvm/include/llvm/Config/AsmPrinters.def llvm/include/llvm/Config/config.h rm -f llvm/llvm.spec llvm/include/llvm/Config/AsmPrinters.def llvm/include/llvm/Config/config.h
rm -f llvm/include/llvm/Support/DataTypes.h llvm/include/llvm/Config/Targets.def rm -f llvm/include/llvm/Config/Disassemblers.def
rm -f llvm/include/llvm/System/DataTypes.h llvm/include/llvm/Config/Targets.def
rm -f llvm/tools/llvmc/plugins/Base/Base.td llvm/tools/llvm-config/llvm-config.in rm -f llvm/tools/llvmc/plugins/Base/Base.td llvm/tools/llvm-config/llvm-config.in
rm -f llvm/include/llvm/Config/AsmParsers.def rm -f llvm/include/llvm/Config/AsmParsers.def

@ -1290,3 +1290,7 @@ void cli_bytecode_debug_printsrc(const struct cli_bc_ctx *ctx)
} }
int have_clamjit=1; int have_clamjit=1;
void cli_bytecode_printversion()
{
cl::PrintVersionMessage();
}

@ -168,6 +168,7 @@ CLAMAV_PRIVATE {
funmap; funmap;
cli_bytecode_context_set_trace; cli_bytecode_context_set_trace;
cli_bytecode_debug_printsrc; cli_bytecode_debug_printsrc;
cli_bytecode_printversion;
local: local:
*; *;
}; };

@ -2214,7 +2214,7 @@ int cli_scanpe(cli_ctx *ctx, unsigned int *icongrps1, unsigned int *icongrps2)
pedata.exe_info.section = exe_sections; pedata.exe_info.section = exe_sections;
pedata.exe_info.nsections = nsections; pedata.exe_info.nsections = nsections;
pedata.exe_info.ep = ep; pedata.exe_info.ep = ep;
pedata.exe_info.offset = offset; pedata.exe_info.offset = 0;
pedata.file_hdr = &file_hdr; pedata.file_hdr = &file_hdr;
pedata.opt32 = &pe_opt.opt32; pedata.opt32 = &pe_opt.opt32;
pedata.opt64 = &pe_opt.opt64; pedata.opt64 = &pe_opt.opt64;

Loading…
Cancel
Save