From eb968f96ffd613ec6b15756c35c31b166c74c135 Mon Sep 17 00:00:00 2001 From: jlam Date: Sun, 1 Aug 2004 04:35:33 +0000 Subject: Update mail/clamav to 0.75.1. Changes from verison 0.75 include: - Convert to use bsd.options.mk. - The virus database has been moved to ${VARBASE}/clamav. * freshclam/clamd: fix crash on PPC when LogFile was enabled together with LogSyslog * configure: improve gethostbyname_r check; cleanups * clamav-milter: Use GETHOSTBYNAME_R_6 Better load balancing if max_children = 0 Fixed warning message when building on FreeBSD4.9 Closed (small) memory leak Fix crash when the 1st remote service goes down Only use gethostbyname_r on LINUX for now Improved load balancing a bit * clamdscan: fix stdin scanning in local mode * clamav-milter: %v in the template file handling is now replaced only with the virus name, no "stream:" appears * libclamav/mbox.c: Fix crash when debugging on SPARC * libclamav/message.c: Fix occasional crash when scanning multipart within multipart e-mails --- doc/CHANGES | 3 +- mail/clamav/DEINSTALL | 11 ++++++ mail/clamav/MESSAGE | 13 +++++++ mail/clamav/Makefile | 65 +++++++++++++++++++++++++---------- mail/clamav/PLIST | 9 ++--- mail/clamav/PLIST.milter | 3 -- mail/clamav/distinfo | 10 +++--- mail/clamav/files/clamd.sh | 80 ++++++++++++++++++++++++++++++-------------- mail/clamav/patches/patch-aa | 26 +++++++++++--- mail/clamav/patches/patch-ab | 25 -------------- mail/clamav/patches/patch-af | 22 ++++++++++++ 11 files changed, 181 insertions(+), 86 deletions(-) create mode 100644 mail/clamav/DEINSTALL create mode 100644 mail/clamav/MESSAGE delete mode 100644 mail/clamav/PLIST.milter delete mode 100644 mail/clamav/patches/patch-ab create mode 100644 mail/clamav/patches/patch-af diff --git a/doc/CHANGES b/doc/CHANGES index f21287dbf52..ef86b7bd83c 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,4 +1,4 @@ -$NetBSD: CHANGES,v 1.6746 2004/07/31 22:32:16 markd Exp $ +$NetBSD: CHANGES,v 1.6747 2004/08/01 04:35:46 jlam Exp $ Changes to the packages collection and infrastructure in 2004: @@ -3668,3 +3668,4 @@ Changes to the packages collection and infrastructure in 2004: Updated nsd to 2.1.2 [itojun 2004-07-31] Updated scmxx to 0.7.2 [wiz 2004-07-31] Updated kphotools to 0.2.1nb1 [markd 2004-07-31] + Updated clamav to 0.75.1 [jlam 2004-08-01] diff --git a/mail/clamav/DEINSTALL b/mail/clamav/DEINSTALL new file mode 100644 index 00000000000..b52cb398855 --- /dev/null +++ b/mail/clamav/DEINSTALL @@ -0,0 +1,11 @@ +# $NetBSD: DEINSTALL,v 1.1 2004/08/01 04:35:33 jlam Exp $ + +VIRUSDBDIR="@VIRUSDBDIR@" + +case ${STAGE} in +DEINSTALL) + # Unconditionally remove the virus databases when deinstalling. + ${RM} -f ${VIRUSDBDIR}/daily.cvd + ${RM} -f ${VIRUSDBDIR}/main.cvd + ;; +esac diff --git a/mail/clamav/MESSAGE b/mail/clamav/MESSAGE new file mode 100644 index 00000000000..5b77dde6887 --- /dev/null +++ b/mail/clamav/MESSAGE @@ -0,0 +1,13 @@ +=========================================================================== +$NetBSD: MESSAGE,v 1.1 2004/08/01 04:35:33 jlam Exp $ + +You should update the virus databases to the latest ones available +before using ClamAV. This can be done by running the following command +as `${ROOT_USER}' or `${CLAMAV_USER}': + + ${PREFIX}/bin/freshclam + +It is recommended that the virus database be updated hourly by adding the +appropriate cron job. + +=========================================================================== diff --git a/mail/clamav/Makefile b/mail/clamav/Makefile index 4d8442bfe05..83e8b73eb9a 100644 --- a/mail/clamav/Makefile +++ b/mail/clamav/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.20 2004/07/27 11:49:11 simonb Exp $ +# $NetBSD: Makefile,v 1.21 2004/08/01 04:35:33 jlam Exp $ DISTNAME= clamav-${CLAMAV_VERSION} PKGNAME= clamav-${CLAMAV_VERSION:S/-/./} @@ -11,49 +11,78 @@ COMMENT= Anti-virus toolkit PKG_INSTALLATION_TYPES= overwrite pkgviews -CLAMAV_VERSION= 0.75 +CLAMAV_VERSION= 0.75.1 USE_BUILDLINK3= yes -GNU_CONFIGURE= yes -USE_PKGINSTALL= yes USE_LIBTOOL= yes -# disable the configure check for user and group: + +GNU_CONFIGURE= yes CONFIGURE_ARGS+= --disable-clamav CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFDIR} +CONFIGURE_ARGS+= --with-dbdir=${VIRUSDBDIR} CONFIGURE_ARGS+= --with-uid=${CLAMAV_USER} CONFIGURE_ARGS+= --with-group=${CLAMAV_GROUP} CONFIGURE_ARGS+= --with-tcpwrappers -BUILD_DEFS+= CLAMAV_USER CLAMAV_GROUP USE_MILTER +.include "../../mk/bsd.prefs.mk" + +BUILD_DEFS+= CLAMAV_USER CLAMAV_GROUP +FILES_SUBST+= CLAMAV_USER=${CLAMAV_USER} +MESSAGE_SUBST+= CLAMAV_USER=${CLAMAV_USER} + +USE_PKGINSTALL= yes +DEINSTALL_EXTRA_TMPL= ${.CURDIR}/DEINSTALL RCD_SCRIPTS= clamd PKG_GROUPS+= ${CLAMAV_GROUP} PKG_USERS+= ${CLAMAV_USER}:${CLAMAV_GROUP}::Clamav\\ User +VIRUSDBDIR= ${VARBASE}/clamav EGDIR= ${PREFIX}/share/examples/clamav -CONF_FILES= ${EGDIR}/clamav.conf ${PKG_SYSCONFDIR}/clamav.conf -CONF_FILES+= ${EGDIR}/freshclam.conf ${PKG_SYSCONFDIR}/freshclam.conf -PLIST_SRC= ${PKGDIR}/PLIST +FILES_SUBST+= VIRUSDBDIR=${VIRUSDBDIR} -.include "../../mk/bsd.prefs.mk" -.if defined(USE_MILTER) && !empty(USE_MILTER:M[yY][eE][sS]) -.include "../../mail/libmilter/buildlink3.mk" +OWN_DIRS_PERMS= ${VIRUSDBDIR} ${CLAMAV_USER} ${CLAMAV_GROUP} 0775 +CONF_FILES= # empty +CONF_FILES_PERMS= # empty +.for _file_ in clamav.conf freshclam.conf +CONF_FILES+= ${EGDIR}/${_file_} ${PKG_SYSCONFDIR}/${_file_} +.endfor +.for _file_ in daily.cvd main.cvd +CONF_FILES_PERMS+= ${EGDIR}/${_file_} ${VIRUSDBDIR}/${_file_} \ + ${CLAMAV_USER} ${CLAMAV_GROUP} 0664 +.endfor +.undef _file_ + +INSTALL_MAKE_FLAGS= ${MAKE_FLAGS} CFGINST=${EGDIR} DBINST=${EGDIR} + +# Global and legacy options +.if defined(USE_MILTER) +. if !defined(PKG_OPTIONS.milter) +. if defined(USE_MILTER) && !empty(USE_MILTER:M[yY][eE][sS]) +PKG_OPTIONS.milter+= milter +. endif +. endif +.endif + +PKG_OPTIONS_VAR= PKG_OPTIONS.clamav +PKG_SUPPORTED_OPTIONS= milter +.include "../../mk/bsd.options.mk" + +.if !empty(PKG_OPTIONS:Mmilter) +. include "../../mail/libmilter/buildlink3.mk" CONFIGURE_ARGS+= --enable-milter -PLIST_SRC+= ${PKGDIR}/PLIST.milter +PLIST_SUBST+= MILTER= .else CONFIGURE_ARGS+= --disable-milter # XXX --disable-milter doesn't work as expected, so we need this CONFIGURE_ENV+= ac_cv_header_libmilter_mfapi_h=no +PLIST_SUBST+= MILTER="@comment " .endif -# for freshclam to work it must own the share/clamav dir -post-install: - ${CHOWN} -R ${CLAMAV_USER}:${CLAMAV_GROUP} ${PREFIX}/share/clamav - .include "../../archivers/bzip2/buildlink3.mk" .include "../../devel/zlib/buildlink3.mk" .include "../../devel/gmp/buildlink3.mk" .include "../../security/tcp_wrappers/buildlink3.mk" - .include "../../mk/pthread.buildlink3.mk" + .include "../../mk/bsd.pkg.mk" diff --git a/mail/clamav/PLIST b/mail/clamav/PLIST index 8153dc290e8..c5d6b93ce94 100644 --- a/mail/clamav/PLIST +++ b/mail/clamav/PLIST @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST,v 1.11 2004/06/21 16:16:24 martti Exp $ +@comment $NetBSD: PLIST,v 1.12 2004/08/01 04:35:33 jlam Exp $ bin/clamav-config bin/clamdscan bin/clamscan @@ -17,11 +17,12 @@ man/man1/freshclam.1 man/man1/sigtool.1 man/man5/clamav.conf.5 man/man5/freshclam.conf.5 +${MILTER}man/man8/clamav-milter.8 man/man8/clamd.8 +${MILTER}sbin/clamav-milter sbin/clamd -share/clamav/daily.cvd -share/clamav/main.cvd share/examples/clamav/clamav.conf +share/examples/clamav/daily.cvd share/examples/clamav/freshclam.conf +share/examples/clamav/main.cvd @dirrm share/examples/clamav -@dirrm share/clamav diff --git a/mail/clamav/PLIST.milter b/mail/clamav/PLIST.milter deleted file mode 100644 index 36c76af59a4..00000000000 --- a/mail/clamav/PLIST.milter +++ /dev/null @@ -1,3 +0,0 @@ -@comment $NetBSD: PLIST.milter,v 1.3 2004/04/25 21:37:59 recht Exp $ -man/man8/clamav-milter.8 -sbin/clamav-milter diff --git a/mail/clamav/distinfo b/mail/clamav/distinfo index 79a5b2be48b..97423d2a809 100644 --- a/mail/clamav/distinfo +++ b/mail/clamav/distinfo @@ -1,7 +1,7 @@ -$NetBSD: distinfo,v 1.15 2004/07/27 11:49:11 simonb Exp $ +$NetBSD: distinfo,v 1.16 2004/08/01 04:35:33 jlam Exp $ -SHA1 (clamav-0.75.tar.gz) = 63e2236d487d5811938d35f677f8c5ff986b94ab -Size (clamav-0.75.tar.gz) = 2764536 bytes -SHA1 (patch-aa) = f82827375cca03499889b92563ccc338a4fa66fc -SHA1 (patch-ab) = f2a2a03f2be04a56b43e6ddd56e9ef7d231f8955 +SHA1 (clamav-0.75.1.tar.gz) = 7b9fa5fd6b8322e49c8e863c80ae0abf9e85cd3a +Size (clamav-0.75.1.tar.gz) = 2777319 bytes +SHA1 (patch-aa) = 803e0497c8cda448434b11673a195bbaee7e0285 SHA1 (patch-ad) = 6699745bb75230de378c54bc82862dfe53732e9d +SHA1 (patch-af) = 605728b133ddb95827285d06bfeec9400222f874 diff --git a/mail/clamav/files/clamd.sh b/mail/clamav/files/clamd.sh index be92df8a181..c4c2fa265d8 100644 --- a/mail/clamav/files/clamd.sh +++ b/mail/clamav/files/clamd.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: clamd.sh,v 1.2 2004/03/30 00:32:29 xtraeme Exp $ +# $NetBSD: clamd.sh,v 1.3 2004/08/01 04:35:33 jlam Exp $ # # clamd does anti-virus checking. # @@ -12,42 +12,70 @@ # KEYWORD: shutdown ## -PATH=/sbin:/bin:/usr/sbin:/usr/bin:@PREFIX@/sbin:@PREFIX@/bin -export PATH - -if [ -f /etc/rc.subr ] -then +if [ -f /etc/rc.subr ]; then . /etc/rc.subr fi name="clamd" rcvar=$name -required_files="@PKG_SYSCONFDIR@/clamav.conf" command="@PREFIX@/sbin/${name}" -pidfile=$(@AWK@ '/^#/ {next}; /PidFile/ {print $2}' ${required_files}) -socket=$(@AWK@ '/^#/ {next}; /LocalSocket/ {print $2}' ${required_files}) -clamd_user=$(@AWK@ '/^#/ {next}; /User/ {print $2}' ${required_files}) - +scan_command="@PREFIX@/bin/clamdscan" +required_files="@PKG_SYSCONFDIR@/clamav.conf" start_precmd="clamd_precmd" -stop_postcmd="clamd_postcmd" +stop_cmd="clamd_stopcmd" + +if [ -f "${required_files}" ]; then + pidfile_=`@AWK@ '/^#/ {next}; /^PidFile[ ]/ {r = $2}; + END {print r}' ${required_files}` + if [ -n "${pidfile_}" ]; then + pidfile=${pidfile_} + fi + logfile=`@AWK@ 'BEGIN {r = "/tmp/clamd.log"}; + /^#/ {next}; /^LogFile[ ]/ {r = $2}; + END {print r}' ${required_files}` + socket=`@AWK@ 'BEGIN {r = "/tmp/clamd"}; + /^#/ {next}; /^LocalSocket[ ]/ {r = $2}; + END {print r}' ${required_files}` + clamd_user=`@AWK@ 'BEGIN {r = "@CLAMAV_USER@"}; + /^#/ {next}; /^User[ ]/ {r = $2}; + END {print r}' ${required_files}` +fi clamd_precmd() { - @RM@ -f ${socket} - @TOUCH@ ${pidfile} - @CHOWN@ ${clamd_user} ${pidfile} + @RM@ -f ${socket} + if [ -n "${logfile}" ]; then + @TOUCH@ ${logfile} + @CHOWN@ ${clamd_user} ${logfile} + fi + if [ -n "${pidfile}" ]; then + @TOUCH@ ${pidfile} + @CHOWN@ ${clamd_user} ${pidfile} + fi } -clamd_postcmd() +clamd_stopcmd() { - if [ -f "${pidfile}" ]; then - @RM@ -f ${pidfile} - fi - - if [ -e "${socket}" ]; then - @RM@ -f ${socket} - fi + # Workaround bug when clamd is built against pth by send TERM to + # clamd, then forcing it to start a worker thread that exits. + # This forces the main thread to awaken and realize that it's + # supposed to shutdown. + # + @ECHO@ "Stopping ${name}." + doit="@SU@ -m ${clamd_user} -c \"kill -TERM $rc_pid\"" + if ! eval $doit && [ -z "$rc_force" ]; then + return 1 + fi + ${scan_command} --quiet ${scan_command} 2>/dev/null + wait_for_pids $rc_pid } - -load_rc_config $name -run_rc_command "$1" + +if [ -f /etc/rc.subr -a -f /etc/rc.conf \ + -a -d /etc/rc.d -a -f /etc/rc.d/DAEMON ]; then + load_rc_config $name + run_rc_command "$1" +else + @ECHO@ -n " ${name}" + eval ${start_precmd} + ${command} ${clamd_flags} ${command_args} +fi diff --git a/mail/clamav/patches/patch-aa b/mail/clamav/patches/patch-aa index d137f8d4816..382ac0aa85d 100644 --- a/mail/clamav/patches/patch-aa +++ b/mail/clamav/patches/patch-aa @@ -1,8 +1,26 @@ -$NetBSD: patch-aa,v 1.10 2004/06/21 16:16:25 martti Exp $ +$NetBSD: patch-aa,v 1.11 2004/08/01 04:35:33 jlam Exp $ ---- configure.orig 2004-06-14 15:53:37.000000000 +0000 -+++ configure 2004-06-15 20:34:21.000000000 +0000 -@@ -10129,6 +10129,7 @@ +--- configure.orig Thu Jul 29 17:50:13 2004 ++++ configure +@@ -10811,7 +10811,7 @@ _ACEOF + + + +-if test ! -r "$cfg_dir/clamav.conf"; then ++if true; then + INSTALL_CLAMAV_CONF_TRUE= + INSTALL_CLAMAV_CONF_FALSE='#' + else +@@ -10821,7 +10821,7 @@ fi + + + +-if test ! -r "$cfg_dir/freshclam.conf"; then ++if true; then + INSTALL_FRESHCLAM_CONF_TRUE= + INSTALL_FRESHCLAM_CONF_FALSE='#' + else +@@ -11047,6 +11047,7 @@ netbsd*) LIBCLAMAV_LIBS="$LIBCLAMAV_LIBS -lpthread" CLAMD_LIBS="-lpthread" CLAMAV_MILTER_LIBS="$CLAMAV_MILTER_LIBS -lpthread" diff --git a/mail/clamav/patches/patch-ab b/mail/clamav/patches/patch-ab deleted file mode 100644 index 4fd8f8e5291..00000000000 --- a/mail/clamav/patches/patch-ab +++ /dev/null @@ -1,25 +0,0 @@ -$NetBSD: patch-ab,v 1.6 2004/07/21 02:48:58 xtraeme Exp $ - ---- etc/Makefile.in.orig 2004-07-21 04:38:49.000000000 +0200 -+++ etc/Makefile.in 2004-07-21 04:39:56.000000000 +0200 -@@ -176,7 +176,7 @@ - target_os = @target_os@ - target_vendor = @target_vendor@ - EXTRA_DIST = clamav.conf freshclam.conf --CFGINST = @CFGDIR@ -+CFGINST = $(datadir)/examples/clamav - all: all-am - - .SUFFIXES: -@@ -339,8 +339,9 @@ - - install: - $(mkinstalldirs) $(DESTDIR)$(CFGINST) --@INSTALL_CLAMAV_CONF_TRUE@ @$(INSTALL_DATA) $(srcdir)/clamav.conf $(DESTDIR)$(CFGINST) --@INSTALL_FRESHCLAM_CONF_TRUE@ @$(INSTALL_DATA) $(srcdir)/freshclam.conf $(DESTDIR)$(CFGINST) -+ @$(INSTALL_DATA) clamav.conf $(DESTDIR)$(CFGINST) -+ @$(INSTALL_DATA) freshclam.conf $(DESTDIR)$(CFGINST) -+ - # 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. - .NOEXPORT: diff --git a/mail/clamav/patches/patch-af b/mail/clamav/patches/patch-af new file mode 100644 index 00000000000..4bf16e87e06 --- /dev/null +++ b/mail/clamav/patches/patch-af @@ -0,0 +1,22 @@ +$NetBSD: patch-af,v 1.1 2004/08/01 04:35:33 jlam Exp $ + +--- database/Makefile.in.orig Thu Jul 29 17:50:06 2004 ++++ database/Makefile.in +@@ -344,17 +344,6 @@ install: + @test -f $(DESTDIR)$(DBINST)/mirrors.txt && rm -f $(DESTDIR)$(DBINST)/mirrors.txt || true + @test -f $(DESTDIR)$(DBINST)/viruses.db && rm -f $(DESTDIR)$(DBINST)/viruses.db || true + @test -f $(DESTDIR)$(DBINST)/viruses.db2 && rm -f $(DESTDIR)$(DBINST)/viruses.db2 || true +- @if test `id|sed -e 's/^.[^(]*(\([^)]*\)).*/\1/'` = "root" && test -n "${CLAMAVUSER}" && test -n "${CLAMAVGROUP}"; then \ +- chmod 775 $(DESTDIR)$(DBINST); \ +- chown ${CLAMAVUSER} $(DESTDIR)$(DBINST); \ +- chgrp ${CLAMAVGROUP} $(DESTDIR)$(DBINST); \ +- chmod 664 $(DESTDIR)$(DBINST)/main.cvd; \ +- chown ${CLAMAVUSER} $(DESTDIR)$(DBINST)/main.cvd; \ +- chgrp ${CLAMAVGROUP} $(DESTDIR)$(DBINST)/main.cvd; \ +- chmod 664 $(DESTDIR)$(DBINST)/daily.cvd; \ +- chown ${CLAMAVUSER} $(DESTDIR)$(DBINST)/daily.cvd; \ +- chgrp ${CLAMAVGROUP} $(DESTDIR)$(DBINST)/daily.cvd; \ +- fi + # 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. + .NOEXPORT: -- cgit v1.2.3