[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-6156-g094ec9b
Török Edvin
edwin at clamav.net
Sun Apr 4 00:52:43 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit d6ada03c8181b2462928b8655aedfd409c5268c0
Author: Török Edvin <edwin at clamav.net>
Date: Fri Jun 26 20:23:52 2009 +0300
Add bytecode test tool.
diff --git a/clambc/Makefile.am b/clambc/Makefile.am
new file mode 100644
index 0000000..7e5059a
--- /dev/null
+++ b/clambc/Makefile.am
@@ -0,0 +1,7 @@
+bin_PROGRAMS = clambc
+clambc_SOURCES = \
+ bcrun.c
+
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav
+LIBS = $(top_builddir)/libclamav/libclamav.la @THREAD_LIBS@
+CLEANFILES=*.gcda *.gcno
diff --git a/libclamav/lzma/Makefile.in b/clambc/Makefile.in
similarity index 79%
copy from libclamav/lzma/Makefile.in
copy to clambc/Makefile.in
index 426cc8c..18d8109 100644
--- a/libclamav/lzma/Makefile.in
+++ b/clambc/Makefile.in
@@ -14,25 +14,6 @@
@SET_MAKE@
-#
-# Copyright (C) 2007 Sourcefire Inc.
-# Author: aCaB <acab at clamav.net>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
-# MA 02110-1301, USA.
-#
-
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
@@ -52,7 +33,8 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-subdir = libclamav/lzma
+bin_PROGRAMS = clambc$(EXEEXT)
+subdir = clambc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/acinclude.m4 \
@@ -69,10 +51,12 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/clamav-config.h
CONFIG_CLEAN_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-liblzma_la_LIBADD =
-am_liblzma_la_OBJECTS = LzmaStateDecode.lo
-liblzma_la_OBJECTS = $(am_liblzma_la_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+PROGRAMS = $(bin_PROGRAMS)
+am_clambc_OBJECTS = bcrun.$(OBJEXT)
+clambc_OBJECTS = $(am_clambc_OBJECTS)
+clambc_LDADD = $(LDADD)
DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
am__depfiles_maybe = depfiles
@@ -85,8 +69,8 @@ CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
-SOURCES = $(liblzma_la_SOURCES)
-DIST_SOURCES = $(liblzma_la_SOURCES)
+SOURCES = $(clambc_SOURCES)
+DIST_SOURCES = $(clambc_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -149,7 +133,7 @@ LIBCLAMAV_LIBS = @LIBCLAMAV_LIBS@
LIBCLAMAV_VERSION = @LIBCLAMAV_VERSION@
LIBLTDL = @LIBLTDL@
LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
+LIBS = $(top_builddir)/libclamav/libclamav.la @THREAD_LIBS@
LIBTOOL = @LIBTOOL@
LIPO = @LIPO@
LN_S = @LN_S@
@@ -245,13 +229,11 @@ target_vendor = @target_vendor@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-AM_CFLAGS = -fPIC -DPIC
-noinst_LTLIBRARIES = liblzma.la
-liblzma_la_SOURCES = LzmaStateDecode.c \
- LzmaStateDecode.h \
- LzmaTypes.h
+clambc_SOURCES = \
+ bcrun.c
-EXTRA_DIST = lzma.txt
+AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/shared -I$(top_srcdir)/libclamav
+CLEANFILES = *.gcda *.gcno
all: all-am
.SUFFIXES:
@@ -265,9 +247,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign libclamav/lzma/Makefile'; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign clambc/Makefile'; \
cd $(top_srcdir) && \
- $(AUTOMAKE) --foreign libclamav/lzma/Makefile
+ $(AUTOMAKE) --foreign clambc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -285,17 +267,53 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ if test -f $$p \
+ || test -f $$p1 \
+ ; then \
+ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
+ else :; fi; \
+ done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
+ rm -f "$(DESTDIR)$(bindir)/$$f"; \
+ done
-clean-noinstLTLIBRARIES:
- -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
- @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
- dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
- echo "rm -f \"$${dir}/so_locations\""; \
- rm -f "$${dir}/so_locations"; \
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
done
-liblzma.la: $(liblzma_la_OBJECTS) $(liblzma_la_DEPENDENCIES)
- $(LINK) $(liblzma_la_OBJECTS) $(liblzma_la_LIBADD) $(LIBS)
+
+installcheck-binPROGRAMS: $(bin_PROGRAMS)
+ bad=0; pid=$$$$; list="$(bin_PROGRAMS)"; for p in $$list; do \
+ case ' $(AM_INSTALLCHECK_STD_OPTIONS_EXEMPT) ' in \
+ *" $$p "* | *" $(srcdir)/$$p "*) continue;; \
+ esac; \
+ f=`echo "$$p" | \
+ sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+ for opt in --help --version; do \
+ if "$(DESTDIR)$(bindir)/$$f" $$opt >c$${pid}_.out \
+ 2>c$${pid}_.err </dev/null \
+ && test -n "`cat c$${pid}_.out`" \
+ && test -z "`cat c$${pid}_.err`"; then :; \
+ else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \
+ done; \
+ done; rm -f c$${pid}_.???; exit $$bad
+clambc$(EXEEXT): $(clambc_OBJECTS) $(clambc_DEPENDENCIES)
+ @rm -f clambc$(EXEEXT)
+ $(LINK) $(clambc_OBJECTS) $(clambc_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -303,7 +321,7 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
- at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/LzmaStateDecode.Plo at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/bcrun.Po at am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -407,8 +425,11 @@ distdir: $(DISTFILES)
done
check-am: all-am
check: check-am
-all-am: Makefile $(LTLIBRARIES)
+all-am: Makefile $(PROGRAMS)
installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
install: install-am
install-exec: install-exec-am
install-data: install-data-am
@@ -426,6 +447,7 @@ install-strip:
mostlyclean-generic:
clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
@@ -435,8 +457,7 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
- mostlyclean-am
+clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
@@ -458,7 +479,7 @@ install-data-am:
install-dvi: install-dvi-am
-install-exec-am:
+install-exec-am: install-binPROGRAMS
install-html: install-html-am
@@ -470,7 +491,7 @@ install-pdf: install-pdf-am
install-ps: install-ps-am
-installcheck-am:
+installcheck-am: installcheck-binPROGRAMS
maintainer-clean: maintainer-clean-am
-rm -rf ./$(DEPDIR)
@@ -490,22 +511,23 @@ ps: ps-am
ps-am:
-uninstall-am:
+uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-noinstLTLIBRARIES ctags distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool ctags distclean distclean-compile \
+ distclean-generic distclean-libtool distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am
+ install-strip installcheck installcheck-am \
+ installcheck-binPROGRAMS installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/clambc/bcrun.c b/clambc/bcrun.c
new file mode 100644
index 0000000..582c3fa
--- /dev/null
+++ b/clambc/bcrun.c
@@ -0,0 +1,76 @@
+/*
+ * ClamAV bytecode handler tool.
+ *
+ * Copyright (C) 2009 Sourcefire, Inc.
+ *
+ * Authors: Török Edvin
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+#if HAVE_CONFIG_H
+#include "clamav-config.h"
+#endif
+#include "bytecode.h"
+#include "clamav.h"
+
+#include <stdlib.h>
+
+int main(int argc, char *argv[])
+{
+ FILE *f;
+ struct cli_bc *bc;
+ struct cli_bc_ctx *ctx;
+ int rc;
+ /* TODO: use optparser */
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <filename>\n", argv[0]);
+ exit(1);
+ }
+
+ f = fopen(argv[1], "r");
+ if (!f) {
+ fprintf(stderr, "Unable to load %s\n", argv[1]);
+ exit(2);
+ }
+
+ bc = malloc(sizeof(*bc));
+ if (!bc) {
+ fprintf(stderr, "Out of memory\n");
+ exit(3);
+ }
+
+ cl_debug();
+ rc = cli_bytecode_load(bc, f, NULL);
+ if (rc != CL_SUCCESS) {
+ fprintf(stderr,"Unable to load bytecode: %s\n", cl_strerror(rc));
+ exit(4);
+ }
+ fclose(f);
+
+ printf("Bytecode loaded\n");
+ ctx = cli_bytecode_alloc_context();
+ if (!ctx) {
+ fprintf(stderr,"Out of memory\n");
+ exit(3);
+ }
+
+ printf("Running bytecode\n");
+ cli_bytecode_run(bc, ctx);
+ printf("Bytecode run finished\n");
+ cli_bytecode_destroy_context(ctx);
+ cli_bytecode_destroy(bc);
+ free(bc);
+ return 0;
+}
--
Debian repository for ClamAV
More information about the Pkg-clamav-commits
mailing list