summaryrefslogtreecommitdiff
path: root/app-antivirus/clamav
diff options
context:
space:
mode:
Diffstat (limited to 'app-antivirus/clamav')
-rw-r--r--app-antivirus/clamav/Manifest3
-rw-r--r--app-antivirus/clamav/clamav-0.99.3-r1.ebuild159
-rw-r--r--app-antivirus/clamav/files/clamav-0.99.3-fix-fd-leaks-in-cli_scanscript.patch132
3 files changed, 294 insertions, 0 deletions
diff --git a/app-antivirus/clamav/Manifest b/app-antivirus/clamav/Manifest
index ad3b444ab928..5e5207943c1a 100644
--- a/app-antivirus/clamav/Manifest
+++ b/app-antivirus/clamav/Manifest
@@ -3,6 +3,7 @@ AUX clamav-0.99.2-bytecode_api.patch 1531 BLAKE2B 50a70cf6e6cf206ec5e427e3b724c2
AUX clamav-0.99.2-gcc-6.patch 4476 BLAKE2B 9ef285f83665cb9cd41f1fe94a64805fc6413c66909be2ae93efb9e342beda0fbd7db81691506c8aa1cbf9bde4e0e74efbdadc0ba2e459479ada35266638ad7e SHA512 b30ed8b888af3697294c1a2aa96a335b3b1035f4f76e3bcf6c243dca7bdc5921a9bb182fbfd5e0e7f1bb9dce93b2312927e28f78edae466d31200a2be50f3a85
AUX clamav-0.99.2-pcre2-compile-erroffset.patch 540 BLAKE2B 77ad84cedb05329024226fffed554fce3005a678471117c9a9db54221d6d7458e6318b5b150c70e7f64cf16ad47d2093e40a67de0e9af024eb9bf6ed73b6c9f3 SHA512 6f2dd207accbc409c7e7155e3c04cf50255d4b6683ada24a559c23375ec4fa333f93118a25c8275cd8d6be7f950200c3730fd8174cc4a0450fe2160f2b86b536
AUX clamav-0.99.2-tinfo.patch 656 BLAKE2B be926db8e63458f0ef9d6d5b6f26058c2100881997cd97b03cf2f893f0d0ef2b18ebc25e1f38f2a1df5aef3a7f647eb1cec66c0cc173175976048ca5ad57e782 SHA512 33e375e8f4e74f284e9d14adaa8ef095bdb67b2f62e4b7c5e9c38a3c5f955106173e402859fabf44ada40ae08cceb3fca79322f8854f47d850816064641f4451
+AUX clamav-0.99.3-fix-fd-leaks-in-cli_scanscript.patch 3554 BLAKE2B 36ce8580da5abc310caa29ae87478b811f2db9403cb79b01efb9394b3d19ced2be3dbf66a1ad2ea06c660156a03879ba3dbca4329569e349d7a70c12f034d237 SHA512 e0dfecff8adb1e30f4c7a20271fd8731ebbb20449a532d70977f7491d8539fc8ed74f851f6903f6265a2e660f9471341e68cc0651e5f94356179ff1f328ada0c
AUX clamav-milter.README.gentoo 1124 BLAKE2B 41713f9ddd22b39748e812a03d5746d48b44f0506bd6e46886fd64233aedad0a7c4b2f8f7a3b0b1d14f831521c423ed5909eb9d9bc419540684fba065c3b9927 SHA512 1c6160e48eddd28f83ec5f24757f788781cef55789d1934dfccc12c7c5e5635a226d26b0983cab7344c142f5a2f1db172640b1d0e6c840a6fa83abed9be1211a
AUX clamav-milter.service 284 BLAKE2B 7fbdce10ffa1d85aa671616f17ad45683177916269b434283582ecb53000f7a9a8978119e6a8170ddad8f7c0f14f09398fd7b893aad5d718083b002f6371ff21 SHA512 442148ac3c42ecbb893de5c6edde337b72a745d20f6c5ffa33131f9a0b2daadcffac39b686ada986a5ab500ea7b9153c448abc1b819e15fef488da1812bb0cee
AUX clamav-milter.service-r1 303 BLAKE2B 55253d9a660699411e352bc80837add840dc6740afed4fe64a86def84610cad836ea3ea620664f540f242b917aab560201cca9c33b9fbc9b1cef2c8b29bfce36 SHA512 5dc30e3c57d9bff6595155e8299336c579c713aed429ab770f10d7678dd74691a135aa2070a825ddb726fdabcb001c19caeb993c1cd9a6fcf95d1d47f7160540
@@ -15,6 +16,8 @@ AUX clamd_at.service 228 BLAKE2B 85181b02329a86495d0737308417dd873424da0bb1cd376
AUX freshclamd.service 191 BLAKE2B 5b517bf15d008454052bd0f7d5a10fb89284a5b64d1cd11570981ca07d70d4dbab6739175ef7434c5c16625fc4f342d21fe6c67970ebac9e64dc8c08732ab68e SHA512 aaf78e763d2aa9c17fc95edb1550547b6681a91fd239a86535e5193d36ff0e152c51c3a3957542f80d5b170805f296159958ac347886981ddd324bec4237da92
AUX tmpfiles.d/clamav.conf 33 BLAKE2B 447c5ad4ad79bc70fc386833fa763451d30bf30f1ae26434039a3926ca5aae9734e0152c83b5b9aa5bed87b17c1b685c4ea9f41c9cb6b3197b1e78e800b71fd9 SHA512 eabe5a94c2679b82ea3e29272eb448b47e60b271381d3e97f3970b1a9e086d61662aff2d29887950a911025294aa7cea8bfd9003d257963566b251bcaeb5f6b2
DIST clamav-0.99.2.tar.gz 16067497 BLAKE2B 4155e3125ccc45cc6828033f207b6b8d3514253dfb8156428ad4096c0901d5a8500f9dd253b8f40afdc49a6039b647627868f75d51829ab7bd247ada5f3b8383 SHA512 7744ba8a344b163cf98e9737cddfd25d2120b34ee9c4518380e028c9ec3cd50127b198b0dfa9fde30f5ce9aab0c0e6384712fbc11287e77d16ce052fd7b6ac44
+DIST clamav-0.99.3.tar.gz 16082645 BLAKE2B 3be06e563f17a07e4c7e95eb3efbb61e80858bcb3dffc584f13ec30dc2ef9c5257aec78605f1c03e183b4b7ed5b08343a25b579b2b12e54458694eff624aa01e SHA512 0d3c75d571ed4aa4937ef2b743a39a9a144f5adfd6f56f71046e5a8387b8ed7c3c4d9a4196aa85750f9ec4dc545720fdd659289d0cce086ab13a7cc505a0ab3e
EBUILD clamav-0.99.2-r1.ebuild 5125 BLAKE2B 330ee8e4625368933a519481a204839153e6a08cf1480f0622a2632d470f9b44cda9a4f68919f356c5a8b95b81b87912e1c64d3b6e3c66fa9e1b122b2863b06e SHA512 96b2ff17e272cef6a23bfa4357b7a84a509a6e6e105439e70cc8db99b75a61a5732f7257cf494a19d48998c4d84c2d19213d48bf6104cf372eb77c41c5506908
EBUILD clamav-0.99.2-r3.ebuild 5182 BLAKE2B d635013b30e5ec0ea2ec7a9329d1534595bbbb51b0bd79c3d1e0e545993223dfc384cc28bf907f478f8ae354b8b3543df1c2f8bafd4a89d01d3fa5c6bbdd4099 SHA512 754c23b5f2dd0d664f79ad07d0dbf1944a58418f36c9d2e01f8fbf88eb6f883bf825cd16a43ca3916417a3dc4e0de8dda49f345a002e74f2caaa1b1e1da3fd97
+EBUILD clamav-0.99.3-r1.ebuild 5242 BLAKE2B d5ae07aae6184ef54dfc5541fbbefbbba2c7c358e3a2629151358b14cfd70d4efc12e823477bb1465d55f835e795b4c1ef6732f3b3c852a9deb41851da3caa42 SHA512 2ee488313470d23234f32ec9ac60e16483a5246d27413b81cde5302edc55d60aabcfc5d00ea24e7d1b18a2a022d06e171129d66b32b8d907cda64c3cfe1f259f
MISC metadata.xml 740 BLAKE2B 2cc1cd27896d7a032b476bbbe6a1b176c95657de5267cc77f6fc1ce1758603d9cf0caa0f3a614bc4a366695a089833474c30afc607ba1dee2caaff1dfc9e6c48 SHA512 baff0fa3285a5bfd17b408dc88ad573df07ec4de5e2827d352465347c5ebceb466172c4f369dac5680c927cad3a887a60721358e43b26e8cd7eaf3cebcaba832
diff --git a/app-antivirus/clamav/clamav-0.99.3-r1.ebuild b/app-antivirus/clamav/clamav-0.99.3-r1.ebuild
new file mode 100644
index 000000000000..35df578ab6bd
--- /dev/null
+++ b/app-antivirus/clamav/clamav-0.99.3-r1.ebuild
@@ -0,0 +1,159 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit autotools eutils flag-o-matic user systemd
+
+DESCRIPTION="Clam Anti-Virus Scanner"
+HOMEPAGE="http://www.clamav.net/"
+SRC_URI="https://www.clamav.net/downloads/production/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc x86 ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~sparc-solaris ~x86-solaris"
+IUSE="bzip2 clamdtop iconv ipv6 libressl milter metadata-analysis-api selinux static-libs uclibc"
+
+CDEPEND="bzip2? ( app-arch/bzip2 )
+ clamdtop? ( sys-libs/ncurses:0 )
+ iconv? ( virtual/libiconv )
+ metadata-analysis-api? ( dev-libs/json-c:= )
+ milter? ( || ( mail-filter/libmilter mail-mta/sendmail ) )
+ dev-libs/libtommath
+ >=sys-libs/zlib-1.2.2:=
+ !libressl? ( dev-libs/openssl:0= )
+ libressl? ( dev-libs/libressl:0= )
+ sys-devel/libtool
+ || ( dev-libs/libpcre2 >dev-libs/libpcre-6 )
+ !!<app-antivirus/clamav-0.99"
+# hard block clamav < 0.99 due to linking problems Bug #567680
+# openssl is now *required* see this link as to why
+# http://blog.clamav.net/2014/02/introducing-openssl-as-dependency-to.html
+DEPEND="${CDEPEND}
+ virtual/pkgconfig"
+RDEPEND="${CDEPEND}
+ selinux? ( sec-policy/selinux-clamav )"
+
+DOCS=( AUTHORS BUGS ChangeLog FAQ INSTALL NEWS README UPGRADE )
+PATCHES=(
+ "${FILESDIR}"/${PN}-0.99.2-gcc-6.patch
+ "${FILESDIR}"/${PN}-0.99.2-tinfo.patch
+ "${FILESDIR}"/${PN}-0.99.2-bytecode_api.patch
+ "${FILESDIR}"/${PN}-0.99.2-pcre2-compile-erroffset.patch
+ "${FILESDIR}"/${PN}-0.99.3-fix-fd-leaks-in-cli_scanscript.patch
+)
+
+pkg_setup() {
+ enewgroup clamav
+ enewuser clamav -1 -1 /dev/null clamav
+}
+
+src_prepare() {
+ default
+
+ eautoconf
+}
+
+src_configure() {
+ use ppc64 && append-flags -mminimal-toc
+ use uclibc && export ac_cv_type_error_t=yes
+
+ econf \
+ $(use_enable bzip2) \
+ $(use_enable clamdtop) \
+ $(use_enable ipv6) \
+ $(use_enable milter) \
+ $(use_enable static-libs static) \
+ $(use_with iconv) \
+ $(use_with metadata-analysis-api libjson /usr) \
+ --cache-file="${S}"/config.cache \
+ --disable-experimental \
+ --disable-gcc-vcheck \
+ --disable-zlib-vcheck \
+ --enable-id-check \
+ --with-dbdir="${EPREFIX}"/var/lib/clamav \
+ --with-system-tommath \
+ --with-zlib="${EPREFIX}"/usr
+}
+
+src_install() {
+ default
+
+ rm -rf "${ED}"/var/lib/clamav
+ newinitd "${FILESDIR}"/clamd.initd-r6 clamd
+ newconfd "${FILESDIR}"/clamd.conf-r1 clamd
+
+ systemd_dotmpfilesd "${FILESDIR}/tmpfiles.d/clamav.conf"
+ systemd_newunit "${FILESDIR}/clamd_at.service" "clamd@.service"
+ systemd_dounit "${FILESDIR}/clamd.service"
+ systemd_dounit "${FILESDIR}/freshclamd.service"
+
+ keepdir /var/lib/clamav
+ fowners clamav:clamav /var/lib/clamav
+ keepdir /var/log/clamav
+ fowners clamav:clamav /var/log/clamav
+
+ dodir /etc/logrotate.d
+ insinto /etc/logrotate.d
+ newins "${FILESDIR}"/clamav.logrotate clamav
+
+ # Modify /etc/{clamd,freshclam}.conf to be usable out of the box
+ sed -i -e "s:^\(Example\):\# \1:" \
+ -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.pid:" \
+ -e "s:.*\(LocalSocket\) .*:\1 ${EPREFIX}/var/run/clamav/clamd.sock:" \
+ -e "s:.*\(User\) .*:\1 clamav:" \
+ -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamd.log:" \
+ -e "s:^\#\(LogTime\).*:\1 yes:" \
+ -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
+ "${ED}"/etc/clamd.conf.sample || die
+ sed -i -e "s:^\(Example\):\# \1:" \
+ -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/freshclam.pid:" \
+ -e "s:.*\(DatabaseOwner\) .*:\1 clamav:" \
+ -e "s:^\#\(UpdateLogFile\) .*:\1 ${EPREFIX}/var/log/clamav/freshclam.log:" \
+ -e "s:^\#\(NotifyClamd\).*:\1 ${EPREFIX}/etc/clamd.conf:" \
+ -e "s:^\#\(ScriptedUpdates\).*:\1 yes:" \
+ -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
+ "${ED}"/etc/freshclam.conf.sample || die
+
+ if use milter ; then
+ # MilterSocket one to include ' /' because there is a 2nd line for
+ # inet: which we want to leave
+ dodoc "${FILESDIR}"/clamav-milter.README.gentoo
+ sed -i -e "s:^\(Example\):\# \1:" \
+ -e "s:.*\(PidFile\) .*:\1 ${EPREFIX}/var/run/clamav/clamav-milter.pid:" \
+ -e "s+^\#\(ClamdSocket\) .*+\1 unix:${EPREFIX}/var/run/clamav/clamd.sock+" \
+ -e "s:.*\(User\) .*:\1 clamav:" \
+ -e "s+^\#\(MilterSocket\) /.*+\1 unix:${EPREFIX}/var/run/clamav/clamav-milter.sock+" \
+ -e "s:^\#\(AllowSupplementaryGroups\).*:\1 yes:" \
+ -e "s:^\#\(LogFile\) .*:\1 ${EPREFIX}/var/log/clamav/clamav-milter.log:" \
+ "${ED}"/etc/clamav-milter.conf.sample || die
+ cat >> "${ED}"/etc/conf.d/clamd <<-EOF
+ MILTER_NICELEVEL=19
+ START_MILTER=no
+ EOF
+
+ systemd_newunit "${FILESDIR}/clamav-milter.service-r1" clamav-milter.service
+ fi
+
+ for i in clamd freshclam clamav-milter
+ do
+ [[ -f "${D}"/etc/"${i}".conf.sample ]] && mv "${D}"/etc/"${i}".conf{.sample,}
+ done
+
+ prune_libtool_files --all
+}
+
+src_test() {
+ emake quick-check
+}
+
+pkg_postinst() {
+ if use milter ; then
+ elog "For simple instructions how to setup the clamav-milter read the"
+ elog "clamav-milter.README.gentoo in /usr/share/doc/${PF}"
+ fi
+ if test -z $(find "${ROOT}"var/lib/clamav -maxdepth 1 -name 'main.c*' -print -quit) ; then
+ ewarn "You must run freshclam manually to populate the virus database files"
+ ewarn "before starting clamav for the first time.\n"
+ fi
+}
diff --git a/app-antivirus/clamav/files/clamav-0.99.3-fix-fd-leaks-in-cli_scanscript.patch b/app-antivirus/clamav/files/clamav-0.99.3-fix-fd-leaks-in-cli_scanscript.patch
new file mode 100644
index 000000000000..a457a71758c6
--- /dev/null
+++ b/app-antivirus/clamav/files/clamav-0.99.3-fix-fd-leaks-in-cli_scanscript.patch
@@ -0,0 +1,132 @@
+Author: Manuel Mausz <manuel-clamav@mausz.at>
+
+http://lists.clamav.net/pipermail/clamav-users/2018-January/005687.html
+
+--- clamav-0.99.3/libclamav/scanners.c.orig 2018-01-26 14:35:23.299386703 +0100
++++ clamav-0.99.3/libclamav/scanners.c 2018-01-26 14:47:44.422451335 +0100
+@@ -1342,39 +1342,35 @@
+ return CL_CLEAN;
+ }
+
+- /* dump to disk only if explicitly asked to
+- * or if necessary to check relative offsets,
+- * otherwise we can process just in-memory */
+- if(ctx->engine->keeptmp || (troot && troot->ac_reloff_num > 0)) {
+- if((ret = cli_gentempfd(ctx->engine->tmpdir, &tmpname, &ofd))) {
+- cli_dbgmsg("cli_scanscript: Can't generate temporary file/descriptor\n");
+- return ret;
+- }
+- if (ctx->engine->keeptmp)
+- cli_dbgmsg("cli_scanscript: saving normalized file to %s\n", tmpname);
+- }
+-
+ if(!(normalized = cli_malloc(SCANBUFF + maxpatlen))) {
+ cli_dbgmsg("cli_scanscript: Unable to malloc %u bytes\n", SCANBUFF);
+- free(tmpname);
+ return CL_EMEM;
+ }
+-
+ text_normalize_init(&state, normalized, SCANBUFF + maxpatlen);
+- ret = CL_CLEAN;
+-
+
+ if ((ret = cli_ac_initdata(&tmdata, troot?troot->ac_partsigs:0, troot?troot->ac_lsigs:0, troot?troot->ac_reloff_num:0, CLI_DEFAULT_AC_TRACKLEN))) {
+- free(tmpname);
++ free(normalized);
+ return ret;
+ }
+
+ if ((ret = cli_ac_initdata(&gmdata, groot->ac_partsigs, groot->ac_lsigs, groot->ac_reloff_num, CLI_DEFAULT_AC_TRACKLEN))) {
+ cli_ac_freedata(&tmdata);
+- free(tmpname);
++ free(normalized);
+ return ret;
+ }
+
++ /* dump to disk only if explicitly asked to
++ * or if necessary to check relative offsets,
++ * otherwise we can process just in-memory */
++ if(ctx->engine->keeptmp || (troot && troot->ac_reloff_num > 0)) {
++ if((ret = cli_gentempfd(ctx->engine->tmpdir, &tmpname, &ofd))) {
++ cli_dbgmsg("cli_scanscript: Can't generate temporary file/descriptor\n");
++ goto done;
++ }
++ if (ctx->engine->keeptmp)
++ cli_dbgmsg("cli_scanscript: saving normalized file to %s\n", tmpname);
++ }
++
+ mdata[0] = &tmdata;
+ mdata[1] = &gmdata;
+
+@@ -1388,9 +1384,8 @@
+
+ if (write(ofd, state.out, state.out_pos) == -1) {
+ cli_errmsg("cli_scanscript: can't write to file %s\n",tmpname);
+- close(ofd);
+- free(tmpname);
+- return CL_EWRITE;
++ ret = CL_EWRITE;
++ goto done;
+ }
+ text_normalize_reset(&state);
+ }
+@@ -1409,11 +1404,6 @@
+ funmap(*ctx->fmap);
+ }
+ *ctx->fmap = map;
+-
+- /* If we aren't keeping temps, delete the normalized file after scan. */
+- if(!(ctx->engine->keeptmp))
+- if (cli_unlink(tmpname)) ret = CL_EUNLINK;
+-
+ } else {
+ /* Since the above is moderately costly all in all,
+ * do the old stuff if there's no relative offsets. */
+@@ -1421,11 +1411,8 @@
+ if (troot) {
+ cli_targetinfo(&info, 7, map);
+ ret = cli_ac_caloff(troot, &tmdata, &info);
+- if (ret) {
+- cli_ac_freedata(&tmdata);
+- free(tmpname);
+- return ret;
+- }
++ if (ret)
++ goto done;
+ }
+
+ while(1) {
+@@ -1466,13 +1453,6 @@
+
+ }
+
+- if(ctx->engine->keeptmp) {
+- free(tmpname);
+- if (ofd >= 0)
+- close(ofd);
+- }
+- free(normalized);
+-
+ if(ret != CL_VIRUS || SCAN_ALL) {
+ if ((ret = cli_exp_eval(ctx, troot, &tmdata, NULL, NULL)) == CL_VIRUS)
+ viruses_found++;
+@@ -1481,9 +1461,19 @@
+ viruses_found++;
+ }
+
++done:
++ free(normalized);
+ cli_ac_freedata(&tmdata);
+ cli_ac_freedata(&gmdata);
+
++ if (ofd != -1)
++ close(ofd);
++ if (tmpname != NULL) {
++ if (!ctx->engine->keeptmp)
++ if (cli_unlink(tmpname)) ret = CL_EUNLINK;
++ free(tmpname);
++ }
++
+ if (SCAN_ALL && viruses_found)
+ return CL_VIRUS;
+