ChangeLog

# ChangeLog for mail-filter/qmail-scanner
# Copyright 2002-2008 Gentoo Foundation; Distributed under the GPL v2
# $Header: /var/cvsroot/gentoo-x86/mail-filter/qmail-scanner/ChangeLog,v 1.41 2008/02/13 06:03:51 tupone Exp $

*qmail-scanner-2.02-r1 (13 Feb 2008)

13 Feb 2008; -qmail-scanner-2.02.ebuild,
+qmail-scanner-2.02-r1.ebuild:
Better automatize clamav integration

22 Jan 2008; Tupone Alfredo qmail-scanner-2.02.ebuild:
Fixing instructions for clamav integration
dodoc instructions collapsed, and further doc added

*qmail-scanner-2.02 (22 Jan 2008)

22 Jan 2008; Tupone Alfredo
+files/qmail-scanner-2.02.logrotate, +qmail-scanner-2.02.ebuild:
Version bump to 2.02 Bug #203446 by toto
Using Mime unpacker from maildrop as ripmime seems to touch length of
attachments

*qmail-scanner-2.01-r1 (03 Jan 2008)

03 Jan 2008; Tupone Alfredo
+files/qmail-scanner-2.01.logrotate, +qmail-scanner-2.01-r1.ebuild:
Directory misconfiguration fix, various upstream changes, and updating of st
patches:
bug #178680 by Stanislav Kogan
bug #151801 by Michail Baikov
bug #135636 by Peter Gantner (a.k.a. nephros)
Adding instruction to make clamav working with qmail-scanner:
bug #73001 by David Röhr

02 Jul 2007; Piotr Jaroszyński
qmail-scanner-1.25-r1.ebuild, qmail-scanner-2.01.ebuild:
(QA) RESTRICT clean up.

18 Mar 2007; Marius Mauch
qmail-scanner-1.25-r1.ebuild, qmail-scanner-2.01.ebuild:
Replacing einfo with elog

22 Feb 2007; Piotr Jaroszyński ChangeLog:
Transition to Manifest2.

20 Jul 2006; Michael Sterrett
qmail-scanner-1.25-r1.ebuild, qmail-scanner-2.01.ebuild:
usersandbox => sandbox since usersandbox isn't a valid RESTRICT

04 Jun 2006; Lim Swee Tat qmail-scanner-2.01.ebuild:
Bumped wrongly to stable instead of stable. Apologies intended.

*qmail-scanner-2.01 (29 May 2006)

29 May 2006; Lim Swee Tat +qmail-scanner-2.01.ebuild:
Version bump to 2.01

20 Feb 2006; Michael Hanselmann
-qmail-scanner-1.16-r2.ebuild, -qmail-scanner-1.23-r2.ebuild,
-qmail-scanner-1.23-r3.ebuild, -qmail-scanner-1.24.ebuild,
-qmail-scanner-1.25.ebuild, qmail-scanner-1.25-r1.ebuild:
Stable on ppc, removed old versions, changed to virtual/qmail.

20 Feb 2006; Michael Hanselmann
qmail-scanner-1.25-r1.ebuild:
Stable on ppc.

13 Feb 2006; Michael Cummings
qmail-scanner-1.16-r2.ebuild, qmail-scanner-1.23-r2.ebuild,
qmail-scanner-1.23-r3.ebuild, qmail-scanner-1.24.ebuild,
qmail-scanner-1.25.ebuild, qmail-scanner-1.25-r1.ebuild:
Virtuals for perl-core

23 Aug 2005; Andrej Kacian
qmail-scanner-1.23-r2.ebuild, qmail-scanner-1.23-r3.ebuild,
qmail-scanner-1.24.ebuild, qmail-scanner-1.25.ebuild,
qmail-scanner-1.25-r1.ebuild:
Use -1 for shell argument to enewuser. Bug #103421.

12 Jul 2005; Simon Stelling
qmail-scanner-1.25-r1.ebuild:
stable on amd64

05 Jun 2005; Jory A. Pratt
qmail-scanner-1.25-r1.ebuild:
added addpredict /opt/bdc/plugins.htm

30 May 2005; Sven Wegener
qmail-scanner-1.23-r2.ebuild, qmail-scanner-1.23-r3.ebuild,
qmail-scanner-1.24.ebuild, qmail-scanner-1.25.ebuild,
qmail-scanner-1.25-r1.ebuild:
Moved from gcc.eclass to toolchain-funcs.eclass, bug #92745.

25 May 2005; Michael Cummings
qmail-scanner-1.25-r1.ebuild:
dev-perl/Time-HiRes => perl-core/Time-HiRes migration

25 May 2005; Michael Cummings
qmail-scanner-1.25.ebuild:
dev-perl/Time-HiRes => perl-core/Time-HiRes migration

25 May 2005; Michael Cummings
qmail-scanner-1.24.ebuild:
dev-perl/Time-HiRes => perl-core/Time-HiRes migration

25 May 2005; Michael Cummings
qmail-scanner-1.23-r3.ebuild:
dev-perl/Time-HiRes => perl-core/Time-HiRes migration

25 May 2005; Michael Cummings
qmail-scanner-1.23-r2.ebuild:
dev-perl/Time-HiRes => perl-core/Time-HiRes migration

25 May 2005; Michael Cummings
qmail-scanner-1.16-r2.ebuild:
dev-perl/Time-HiRes => perl-core/Time-HiRes migration

24 May 2005; Michael Cummings
qmail-scanner-1.16-r2.ebuild, qmail-scanner-1.23-r2.ebuild,
qmail-scanner-1.23-r3.ebuild, qmail-scanner-1.24.ebuild,
qmail-scanner-1.25-r1.ebuild, qmail-scanner-1.25.ebuild:
dev-perl/DB_File => perl-core/DB_File

23 May 2005; qmail-scanner-1.25-r1.ebuild:
restricting userpriv usersandbox bug #93447

*qmail-scanner-1.25-r1 (10 Apr 2005)

10 Apr 2005; Lim Swee Tat
+qmail-scanner-1.25-r1.ebuild:
Version bump for the qmail scanner spam assassin patch

05 Apr 2005; Lim Swee Tat qmail-scanner-1.25.ebuild:
Fixed bug #85365

22 Mar 2005; qmail-scanner-1.25.ebuild:
added ~amd64

*qmail-scanner-1.25 (18 Feb 2005)

18 Feb 2005; Lim Swee Tat +qmail-scanner-1.25.ebuild:
Version bumpped

*qmail-scanner-1.24 (21 Nov 2004)

21 Nov 2004; Lim Swee Tat +qmail-scanner-1.24.ebuild:
Version bump. There are some interesting new options in the new st patch,
but not used here.

03 Oct 2004; Jason Wever qmail-scanner-1.23-r3.ebuild:
Stable on sparc.

09 Sep 2004; Robin Johnson,,604-339-5621,604-298-8414
qmail-scanner-1.23-r3.ebuild:
Stabilize -r3 as perl without suidperl is now stable on x86.

*qmail-scanner-1.23-r3 (31 Aug 2004)

31 Aug 2004; Lim Swee Tat +qmail-scanner-1.23-r3.ebuild:
Using latest q-s code of 20040819.

*qmail-scanner-1.23-r2 (18 Aug 2004)

18 Aug 2004; Lim Swee Tat +qmail-scanner-1.23-r2.ebuild:
Version bumped the q-s patch. Using new system for using that patch.

17 Aug 2004; Aron Griffis
qmail-scanner-1.22-r1.ebuild, qmail-scanner-1.23-r1.ebuild:
Fix USE-flag usage in DEPEND. Should be spamassassin? instead of plain
spamassassin

*qmail-scanner-1.23-r1 (16 Aug 2004)

16 Aug 2004; Lim Swee Tat +qmail-scanner-1.23-r1.ebuild:
Added the qmail-scanner spamassassin patch

*qmail-scanner-1.23 (14 Aug 2004)

14 Aug 2004; Robin H. Johnson +qmail-scanner-1.23:
Add new version, add more virii. Bug 60201. Spamassassin support NOT yet
available.

09 Aug 2004; Robin H. Johnson
qmail-scanner-1.22-r1.ebuild:
Ignore setuid test, IMPORTANT to work under perl-5.8.4-r1.

29 Jul 2004; Lim Swee Tat qmail-scanner-1.16-r2.ebuild,
qmail-scanner-1.22-r1.ebuild:
Fixed bug #57599, by installing the contrib files via dodoc.

*qmail-scanner-1.22-r1 (17 Jul 2004)

17 Jul 2004; Lim Swee Tat +qmail-scanner-1.22-r1.ebuild:
- Transfered over to the mail-filter category - Added qmail-scanner-1.22 -
Using the qmail-scanner-st patch that allows for more options at qmail-scanner
- TODO: Add dspam to qmail-scanner

17 Jul 2004; Lim Swee Tat +metadata.xml,
+files/qmail-scanner-queue.pl.patch, +files/qmailscanner.cronjob,
+files/qmailscanner.logrotate, +qmail-scanner-1.16-r1.ebuild,
+qmail-scanner-1.16-r2.ebuild:
Moved from net-mail/qmail-scanner to mail-filter/qmail-scanner.

03 Jun 2004; Seemant Kulleen
qmail-scanner-1.16-r1.ebuild, qmail-scanner-1.16.ebuild:
Change DEPENDency from net-mail/maildrop to mail-filter/maildrop

24 Apr 2004; Robin H. Johnson
qmail-scanner-1.16-r2.ebuild, qmail-scanner-1.20.ebuild:
bug #48628, accept various other qmail's as well

*qmail-scanner-1.20 (28 Jan 2004)

28 Jan 2004; Robin H. Johnson
qmail-scanner-1.20.ebuild, files/qmail-scanner-queue.pl.patch,
files/qmailscanner.cronjob, files/qmailscanner.logrotate:
Version bump, bugs #38065, #39670. This software seems very touchy at the
moment, it doesn't fail gracefully and so qmail can loose mail if anything is
wrong!

26 Dec 2003; Jason Wever qmail-scanner-1.16.ebuild:
Masked on sparc as f-prot does not work on sparc.

*qmail-scanner-1.16-r2 (28 Nov 2003)

28 Nov 2003; Robin H. Johnson
qmail-scanner-1.16-r2.ebuild:
cleanup ebuild, fix bug #33211, and update postinst docs

*qmail-scanner-1.16-r1 (19 Apr 2003)

19 Apr 2003; Preston A. Elder qmail-scanner-1.16-r1.ebuild,
Made dependant on virtual/virus not f-prot specifically.

*qmail-scanner-1.16 (15 Feb 2003)

15 Feb 2003; Nick Hadaway qmail-scanner-1.16.ebuild,
files/digest-qmail-scanner-1.16 :
Version bump. Adds keepdir stuff to /var directories.

*qmail-scanner-1.15 (21 Jan 2003)

21 Jan 2003; Nick Hadaway qmail-scanner-1.15.ebulid,
files/digest-qmail-scanner-1.15 :
Version bump. This one should be compatible with perl-5.8

06 Dec 2002; Rodney Rees : changed sparc ~sparc keywords

*qmail-scanner-1.14 (07 Oct 2002)

17 Oct 2002; Nick Hadaway
qmail-scanner-1.14.ebuild, files/digest-qmail-scanner-1.14 :
Version bump. Fixes some bugs with alert reporting and for usage with
SpamAssassin.

*qmail-scanner-1.13 (15 Aug 2002)

15 Aug 2002; Nick Hadaway
qmail-scanner-1.13.ebuild, files/digest-qmail-scanner-1.13 :
Version bump.

*qmail-scanner-1.12-r1 (12 Jun 2002)

12 Jun 2002; Grant Goodyear
qmail-scanner-1.12-r1.ebuild, files/digest-qmail-scanner-1.12-r1 :
Unmasked because upstream fixed some bugs.

Manifest

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

AUX qmail-scanner-2.01.logrotate 135 RMD160 2958597e646453f198ec6a4a3533e9b9398c9fe7 SHA1 f31c44239f9d56af3d4be6b422b3a4a834351748 SHA256 d61514a06570b55089915c134beefe5222eaa1199cba7afbe91681b7d67248f5
AUX qmail-scanner-2.02.logrotate 135 RMD160 2958597e646453f198ec6a4a3533e9b9398c9fe7 SHA1 f31c44239f9d56af3d4be6b422b3a4a834351748 SHA256 d61514a06570b55089915c134beefe5222eaa1199cba7afbe91681b7d67248f5
AUX qmail-scanner-queue.pl.patch 240 RMD160 6d644003bb6386ad2e21e775352fe01bf8cc81c1 SHA1 98be0f8c45f7917ea809a68c19627217b8c4c3d7 SHA256 77f09de11c2d448c17dd0b377cae3cedd756e404b1e611e2bf69e74d7e05be8e
AUX qmailscanner.cronjob 50 RMD160 afec02a08f7824fbea506b14372af9ea62270b8a SHA1 773b938347d27a042537cd925543fdde732231a2 SHA256 09354f2ef42b6423a5947d004a4d3bf76355aafaf11a0db12052bf088115dee1
AUX qmailscanner.logrotate 147 RMD160 d4eccf7f1169a448c0ce8115f426214927935385 SHA1 d3f763ed9dd1ba8a9c41837e5110950c14b40591 SHA256 eae732e0be2ace1ddcd4cc17a9c6a54012684c76dd30faa5349d394f3befc62f
DIST q-s-1.25st-20050406.patch.gz 124325 RMD160 162f325c0d77deaca4f49f06bf4cb6b6e0b548f5 SHA1 fb1b516b4ace278a1834a264690a1e1927ded530 SHA256 a758b902150f432cc0fa0cc76448bf975e75395ab6b614ca1d8f3be64ab6535a
DIST q-s-2.01st-20060423.patch.gz 99463 RMD160 e395948089886cdd79c40e6a9c59a1048b0dbe49 SHA1 e5b4d3483484fd36efa847beede68e6a7389449f SHA256 b6f507dc0f199aff798f6189c1af6f337d859c7d1eb1af5e44539d45864f367c
DIST q-s-2.01st-20070204.patch.gz 90410 RMD160 da89d1233d63e0a4bd462721df295e973e398def SHA1 2aa3ef010ccc0f7fd5f99cf6b1d477334a34d87a SHA256 d8d2db13a17de228acb9e0b403ac7930a5488ee64a7d72d37e3feddf7b243cac
DIST q-s-2.02st-20080119.patch.gz 101067 RMD160 820dea7bba37de3002ebe7d8087ffa035c88aaec SHA1 9929369479dbbb610118c233e210fb73ce1c4eac SHA256 265eea06510f2af88bca413cd7f25b9449d2a41bcec63500887ab775492d33b3
DIST qmail-scanner-1.25.tgz 221156 RMD160 404feea1291ff4f40d7041f112ed86352735a88f SHA1 d8bf1b968eaec64309404f3253e513e1ae6d5cac SHA256 6fa5743a0d180bc4d1a626c4bf56c06a29ec3c0d7cb2ce834add8faceefb9c01
DIST qmail-scanner-2.01.tgz 226699 RMD160 77ed1ca024b99b30cd6973faf6595c71f85eaf5b SHA1 7ac4de517c9fc66b1ea058e1d15d7ab52ca12ad0 SHA256 4bf69d3581c23b552deffafcfca49f325c5fe6c5ee6012055f201b8535243472
DIST qmail-scanner-2.02.tgz 236440 RMD160 49a8b3465546071e6ff07a6faa8059f11e185a45 SHA1 1173fb993d46eed50089d71fa3824eace89a07c3 SHA256 50b7d0d7b6caabc0e58fd62f7f4483b89fc528a7f78cfd795f40c0f0825fae03
EBUILD qmail-scanner-1.25-r1.ebuild 4943 RMD160 ecc34b4f580318694c2fe392c35a398c2f6fe87a SHA1 5cb9f503bc381c1db3e59e3e3c96d77f01b0925b SHA256 4a723d46700d58c291026a76536b52316defef7c92ec499aea1d416f49ef0efb
EBUILD qmail-scanner-2.01-r1.ebuild 5524 RMD160 3d98c524b9acfcdbddfc54107fe926fd1b5563ff SHA1 0cb62baead635a4c7f63656dbc1d73892ef91a52 SHA256 6b83b5e0fd3b38c554ae7281f84f86143f1bff5b7430e8a708fdb9fb3a5d5f15
EBUILD qmail-scanner-2.01.ebuild 4973 RMD160 19d44f0d8f18806c1f29991a66527afcb845ee01 SHA1 39fec8460e663e1f9d722196af0efcf46f691df3 SHA256 a3dd91f71b5a7c7522ca69c566b25f300431aa916df41b1616058806af9cc6f4
EBUILD qmail-scanner-2.02-r1.ebuild 5630 RMD160 95aaaec19422adc2ceab2bb9d67afba2db0dd56f SHA1 3e8504b5eb20ec3907272e5054c4c75f2a4dd1ab SHA256 299282c157b135332642d4cab687392060dcfb88ba22bf299462c659dde0fb5c
MISC ChangeLog 9905 RMD160 400bd174ad3139ed82bb831b2a6c285d879b74c0 SHA1 aaf4e1164cf2262bfd585ac5b2c8c4994cfec40c SHA256 afbf790c7090408154d85f31329bd14fa08ae0c6e0cbd4d9612511e9a5094e28
MISC metadata.xml 158 RMD160 1bd73d3a80f2670284225f39ce0a4a1c01954966 SHA1 d4831c624efba996486f0fd640d04e06d9e6d1fa SHA256 940554be041a57d02888d9f414efb7768e9f72565c642327ecb4f9f64ca6d8d4
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.7 (GNU/Linux)

iD8DBQFHsohT8qKy9+b2Hl0RAtWSAJ461hc7Ugq9DB8i/wFo7cnES5HRrgCgnxeQ
HW7JW6Q2oP9kKWFUKmHZPvA=
=HjUk
-----END PGP SIGNATURE-----

files

metadata.xml




qmail

qmail-scanner-1.25-r1.ebuild

# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/mail-filter/qmail-scanner/qmail-scanner-1.25-r1.ebuild,v 1.14 2007/07/02 15:01:42 peper Exp $

inherit fixheadtails toolchain-funcs eutils

Q_S_DATE=20050406
DESCRIPTION="E-Mail virus scanner for qmail."
HOMEPAGE="http://qmail-scanner.sourceforge.net/"
SRC_URI="mirror://sourceforge/qmail-scanner/${P}.tgz
http://toribio.apollinare.org/qmail-scanner/download/q-s-${PV}st-${Q_S_DATE}.patch.gz"

IUSE="spamassassin"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="amd64 ppc sparc x86"
RESTRICT="userpriv"

DEPEND=">=dev-lang/perl-5.6.1-r1
>=virtual/perl-Time-HiRes-01.20-r2
>=net-mail/tnef-1.1.1
>=virtual/perl-DB_File-1.803-r2
>=net-mail/ripmime-1.3.0.4
virtual/qmail
>=app-arch/unzip-5.42-r1
virtual/antivirus
spamassassin? ( >=mail-filter/spamassassin-2.64 )"

pkg_setup() {
enewgroup qscand 210
enewuser qscand 210 -1 /var/spool/qmailscan qscand
}

pkg_preinst() {
local oldname="/var/qmail/bin/qmail-scanner-queue.pl"
if [ -f ${oldname} ]; then
newname=${oldname}.`date +%Y%m%d%H%M%S`
elog "Backing up old qmail-scanner as $newname in case of modifications."
cp ${oldname} ${newname}
chmod 600 ${newname}
fi
}

src_unpack() {
unpack ${A}
cd ${S}
epatch ${DISTDIR}/q-s-${PV}st-${Q_S_DATE}.patch.gz
ht_fix_file autoupdaters/* configure

EXTRA_VIRII="bagle,beagle,mydoom,sco,maldal,mimail,novarg,shimg,bugler,cissi,cissy,dloade,netsky,qizy"
elog "Adding items to the SILENT_VIRUSES list (${EXTRA_VIRII})"
sed -e "/^SILENT_VIRUSES/s/\"$/,${EXTRA_VIRII}\"/g" -i configure
}

src_compile () {
local myconf

addpredict /var/log/kav/kavscan.log
addpredict /opt/bdc/plugins.htm

use spamassassin && myconf="--virus-to-delete yes --sa-quarantine 2.1 --sa-delete 4.2 --sa-reject no --sa-subject SPAM: --sa-delta 0.5 --sa-alt yes"

PATH=${PATH}:/opt/f-prot:/opt/vlnx ./configure \
--domain localhost \
--batch \
--log-details yes \
--mime-unpacker "ripmime" \
--skip-setuid-test \
${myconf} \
|| die "./configure failed!"

# build for qmail-scanner-queue wrapper, so we don't need suidperl
cd contrib
$(tc-getCC) ${CFLAGS} -o qmail-scanner-queue qmail-scanner-queue.c || die
}

src_install () {
# Create Directory Structure
diropts -m 755 -o qscand -g qscand
dodir /var/spool/qmailscan
keepdir /var/spool/qmailscan
diropts -m 750 -o qscand -g qscand
for i in quarantine working archive; do
for j in tmp new cur; do
dodir /var/spool/qmailscan/${i}/${j}
keepdir /var/spool/qmailscan/${i}/${j}
done
done
dodir /var/spool/qmailscan/tmp
keepdir /var/spool/qmailscan/tmp

# Install standard quarantine attachments file
insinto /var/spool/qmailscan
insopts -m 644 -o qscand -g qscand
doins quarantine-attachments.txt

# create quarantine.log and viruses.log
touch quarantine.log
insinto /var/spool/qmailscan
insopts -m 644 -o qscand -g qscand
doins quarantine.log
dosym quarantine.log ${DESTDIR}/var/spool/qmailscan/viruses.log

# Install qmail-scanner wrapper
insinto /var/qmail/bin
insopts -m 4755 -o qscand -g qscand
doins contrib/qmail-scanner-queue

# Install qmail-scanner script
insinto /var/qmail/bin
insopts -m 0755 -o qscand -g qscand
doins qmail-scanner-queue.pl

insinto /etc/logrotate.d/
insopts -m 644 -o root -g root
newins ${FILESDIR}/qmailscanner.logrotate qmail-scanner

exeinto /etc/cron.daily/
newexe ${FILESDIR}/qmailscanner.cronjob qmail-scanner

# Install documentation
dodoc README CHANGES COPYING
dohtml README.html FAQ.php TODO.php configure-options.php manual-install.php perlscanner.php

docinto contrib
cd ${S}/contrib
dodoc spamc-nice.eml
dodoc test-trophie.pl
dodoc logrotate.qmailscanner
dodoc sub-avpdaemon.pl
dodoc logging_first_80_chars.eml
dodoc spamc-nasty.eml
dodoc avpdeamon.init
dodoc test_installation.sh
dodoc test-sophie.pl
dodoc reformime-test.eml
dodoc sub-sender-cache.pl
dodoc rbl_scanner.txt
dodoc test-clamd.pl
dodoc qs2mrtg.pl
dodoc mrtg-qmail-scanner.cfg
}

pkg_postinst () {
einfo "Fixing ownerships"
chown -R qscand:qscand /var/spool/qmailscan/tmp /var/spool/qmailscan/working /var/spool/qmailscan/quarantine* /var/spool/qmailscan/archive /var/spool/qmailscan/qmail*
touch /var/qmail/bin/qmail-scanner-queue.pl

# Setup perlscanner + Version Info
chmod -s ${ROOT}/var/qmail/bin/qmail-scanner-queue.pl
${ROOT}/var/qmail/bin/qmail-scanner-queue -z
${ROOT}/var/qmail/bin/qmail-scanner-queue -g

elog "To activate qmail-scanner, please edit your"
elog "/var/qmail/control/conf-common file and set:"
elog "export QMAILQUEUE=/var/qmail/bin/qmail-scanner-queue"
elog "Or place it in your tcprules file."
ewarn "Please note that it was a call to qmail-scanner-queue.pl before,"
ewarn "but this is now changed to use a wrapper to improve security!"
ewarn "Once you have changed to the wrapper, you can remove the setuid "
ewarn "bit on qmail-scanner-queue.pl"
}

qmail-scanner-2.01-r1.ebuild

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/mail-filter/qmail-scanner/qmail-scanner-2.01-r1.ebuild,v 1.1 2008/01/04 22:45:16 tupone Exp $

inherit fixheadtails toolchain-funcs eutils

Q_S_DATE=20070204
DESCRIPTION="E-Mail virus scanner for qmail."
HOMEPAGE="http://qmail-scanner.sourceforge.net/"
SRC_URI="mirror://sourceforge/qmail-scanner/${P}.tgz
http://toribio.apollinare.org/qmail-scanner/download/q-s-${PV}st-${Q_S_DATE}.patch.gz"

IUSE="spamassassin"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
RESTRICT="userpriv"

DEPEND=">=dev-lang/perl-5.6.1-r1
>=virtual/perl-Time-HiRes-01.20-r2
>=net-mail/tnef-1.1.1
>=virtual/perl-DB_File-1.803-r2
net-mail/ripmime
virtual/qmail
>=app-arch/unzip-5.42-r1
virtual/antivirus
spamassassin? ( >=mail-filter/spamassassin-2.64 )"

pkg_setup() {
enewgroup qscand 210
enewuser qscand 210 -1 /var/spool/qscan qscand
}

pkg_preinst() {
local oldname="/var/qmail/bin/qmail-scanner-queue.pl"
if [ -f ${oldname} ]; then
newname=${oldname}.`date +%Y%m%d%H%M%S`
elog "Backing up old qmail-scanner as $newname in case of modifications."
cp ${oldname} ${newname}
chmod 600 ${newname}
fi
}

src_unpack() {
unpack ${A}
cd "${S}"
rm index.php && cp README.html index.php
epatch ${DISTDIR}/q-s-${PV}st-${Q_S_DATE}.patch.gz
ht_fix_file autoupdaters/* configure
sed -i \
-e "s:/var/spool/qscand:/var/spool/qscan:g" \
README-st-patch.html \
README-st-patch.txt || die "Fixing doc with sed failed"

EXTRA_VIRII="bagle,beagle,mydoom,sco,maldal,mimail,novarg,shimg,bugler,cissi,cissy,dloade,netsky,qizy"
elog "Adding items to the SILENT_VIRUSES list (${EXTRA_VIRII})"
sed -e "/^SILENT_VIRUSES/s/\"$/,${EXTRA_VIRII}\"/g" -i configure
}

src_compile () {
local myconf

addpredict /var/log/kav/kavscan.log
addpredict /opt/bdc/plugins.htm

use spamassassin && myconf="--virus-to-delete yes --sa-quarantine 2.1 --sa-delete 4.2 --sa-reject no --sa-subject SPAM: --sa-delta 0.5 --sa-alt yes"

PATH=${PATH}:/opt/f-prot:/opt/vlnx ./configure \
--domain localhost \
--batch \
--log-details yes \
--mime-unpacker "ripmime" \
--skip-setuid-test \
${myconf} \
|| die "./configure failed!"

# build for qmail-scanner-queue wrapper, so we don't need suidperl
cd contrib
$(tc-getCC) ${CFLAGS} -o qmail-scanner-queue qmail-scanner-queue.c || die
}

src_install () {
# Create Directory Structure
diropts -m 755 -o qscand -g qscand
dodir /var/spool/qscan
keepdir /var/spool/qscan
diropts -m 750 -o qscand -g qscand
dodir /var/spool/qscan/quarantine
for i in quarantine/{viruses,policy,spam} working archives; do
for j in tmp new cur; do
dodir /var/spool/qscan/${i}/${j}
keepdir /var/spool/qscan/${i}/${j}
done
done
dodir /var/spool/qscan/tmp
keepdir /var/spool/qscan/tmp

# Install standard quarantine events file
insinto /var/spool/qscan
insopts -m 644 -o qscand -g qscand
doins quarantine-events.txt

# create quarantine.log and viruses.log
touch quarantine.log
insinto /var/spool/qscan
insopts -m 644 -o qscand -g qscand
doins quarantine.log
dosym quarantine.log ${DESTDIR}/var/spool/qscan/viruses.log

# Install qmail-scanner wrapper
insinto /var/qmail/bin
insopts -m 4755 -o qscand -g qscand
doins contrib/qmail-scanner-queue

# Install qmail-scanner script
insinto /var/qmail/bin
insopts -m 0755 -o qscand -g qscand
doins qmail-scanner-queue.pl

insinto /etc/logrotate.d/
insopts -m 644 -o root -g root
newins "${FILESDIR}"/${P}.logrotate qmail-scanner

exeinto /etc/cron.daily/
newexe "${FILESDIR}"/qmailscanner.cronjob qmail-scanner

# Install documentation
dodoc README CHANGES
dohtml README.html FAQ.php TODO.php configure-options.php manual-install.php perlscanner.php

docinto contrib
cd "${S}"/contrib
dodoc spamc-nice.eml
dodoc test-trophie.pl
dodoc logrotate.qmailscanner
dodoc sub-avpdaemon.pl
dodoc logging_first_80_chars.eml
dodoc spamc-nasty.eml
dodoc avpdeamon.init
dodoc test_installation.sh
dodoc test-sophie.pl
dodoc reformime-test.eml
dodoc sub-sender-cache.pl
dodoc rbl_scanner.txt
dodoc test-clamd.pl
dodoc qs2mrtg.pl
dodoc mrtg-qmail-scanner.cfg
}

pkg_postinst () {
einfo "Fixing ownerships"
chown -R qscand:qscand /var/spool/qscan
touch /var/qmail/bin/qmail-scanner-queue.pl

# Setup perlscanner + Version Info
chmod -s "${ROOT}"/var/qmail/bin/qmail-scanner-queue.pl
"${ROOT}"/var/qmail/bin/qmail-scanner-queue -z
"${ROOT}"/var/qmail/bin/qmail-scanner-queue -g

elog "To activate qmail-scanner, please edit your"
elog "/var/qmail/control/conf-common file and set:"
elog "export QMAILQUEUE=/var/qmail/bin/qmail-scanner-queue"
elog "Or place it in your tcprules file."
ewarn "Please note that it was a call to qmail-scanner-queue.pl before,"
ewarn "but this is now changed to use a wrapper to improve security!"
ewarn "Once you have changed to the wrapper, you can remove the setuid "
ewarn "bit on qmail-scanner-queue.pl"

ewarn "If this is an upgrade from <=2.0.1 the home directory of the qscand"
ewarn "user is changed. Please update it manually to /var/spool/qscan"
ewarn "or remove the user and emerge again this package"

ewarn "For an integration with clamav, clamav user should have access"
ewarn "to files in the qscand group."
ewarn "To allow that, add clamav user to the qscand group and"
ewarn "comment-out in /etc/clamd.conf AllowSupplementaryGroups putting yes."
ewarn "After that, restart clamd with"
ewarn "/etc/init.d/clamd restart"
}

qmail-scanner-2.01.ebuild

# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/mail-filter/qmail-scanner/qmail-scanner-2.01.ebuild,v 1.6 2007/07/02 15:01:42 peper Exp $

inherit fixheadtails toolchain-funcs eutils

Q_S_DATE=20060423
DESCRIPTION="E-Mail virus scanner for qmail."
HOMEPAGE="http://qmail-scanner.sourceforge.net/"
SRC_URI="mirror://sourceforge/qmail-scanner/${P}.tgz
http://toribio.apollinare.org/qmail-scanner/download/q-s-${PV}st-${Q_S_DATE}.patch.gz"

IUSE="spamassassin"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
RESTRICT="userpriv"

DEPEND=">=dev-lang/perl-5.6.1-r1
>=virtual/perl-Time-HiRes-01.20-r2
>=net-mail/tnef-1.1.1
>=virtual/perl-DB_File-1.803-r2
>=net-mail/ripmime-1.3.0.4
virtual/qmail
>=app-arch/unzip-5.42-r1
virtual/antivirus
spamassassin? ( >=mail-filter/spamassassin-2.64 )"

pkg_setup() {
enewgroup qscand 210
enewuser qscand 210 -1 /var/spool/qmailscan qscand
}

pkg_preinst() {
local oldname="/var/qmail/bin/qmail-scanner-queue.pl"
if [ -f ${oldname} ]; then
newname=${oldname}.`date +%Y%m%d%H%M%S`
elog "Backing up old qmail-scanner as $newname in case of modifications."
cp ${oldname} ${newname}
chmod 600 ${newname}
fi
}

src_unpack() {
unpack ${A}
cd ${S}
rm index.php && cp README.html index.php
epatch ${DISTDIR}/q-s-${PV}st-${Q_S_DATE}.patch.gz
ht_fix_file autoupdaters/* configure

EXTRA_VIRII="bagle,beagle,mydoom,sco,maldal,mimail,novarg,shimg,bugler,cissi,cissy,dloade,netsky,qizy"
elog "Adding items to the SILENT_VIRUSES list (${EXTRA_VIRII})"
sed -e "/^SILENT_VIRUSES/s/\"$/,${EXTRA_VIRII}\"/g" -i configure
}

src_compile () {
local myconf

addpredict /var/log/kav/kavscan.log
addpredict /opt/bdc/plugins.htm

use spamassassin && myconf="--virus-to-delete yes --sa-quarantine 2.1 --sa-delete 4.2 --sa-reject no --sa-subject SPAM: --sa-delta 0.5 --sa-alt yes"

PATH=${PATH}:/opt/f-prot:/opt/vlnx ./configure \
--domain localhost \
--batch \
--log-details yes \
--mime-unpacker "ripmime" \
--skip-setuid-test \
${myconf} \
|| die "./configure failed!"

# build for qmail-scanner-queue wrapper, so we don't need suidperl
cd contrib
$(tc-getCC) ${CFLAGS} -o qmail-scanner-queue qmail-scanner-queue.c || die
}

src_install () {
# Create Directory Structure
diropts -m 755 -o qscand -g qscand
dodir /var/spool/qmailscan
keepdir /var/spool/qmailscan
diropts -m 750 -o qscand -g qscand
for i in quarantine working archive; do
for j in tmp new cur; do
dodir /var/spool/qmailscan/${i}/${j}
keepdir /var/spool/qmailscan/${i}/${j}
done
done
dodir /var/spool/qmailscan/tmp
keepdir /var/spool/qmailscan/tmp

# Install standard quarantine attachments file
insinto /var/spool/qmailscan
insopts -m 644 -o qscand -g qscand
doins quarantine-attachments.txt

# create quarantine.log and viruses.log
touch quarantine.log
insinto /var/spool/qmailscan
insopts -m 644 -o qscand -g qscand
doins quarantine.log
dosym quarantine.log ${DESTDIR}/var/spool/qmailscan/viruses.log

# Install qmail-scanner wrapper
insinto /var/qmail/bin
insopts -m 4755 -o qscand -g qscand
doins contrib/qmail-scanner-queue

# Install qmail-scanner script
insinto /var/qmail/bin
insopts -m 0755 -o qscand -g qscand
doins qmail-scanner-queue.pl

insinto /etc/logrotate.d/
insopts -m 644 -o root -g root
newins ${FILESDIR}/qmailscanner.logrotate qmail-scanner

exeinto /etc/cron.daily/
newexe ${FILESDIR}/qmailscanner.cronjob qmail-scanner

# Install documentation
dodoc README CHANGES COPYING
dohtml README.html FAQ.php TODO.php configure-options.php manual-install.php perlscanner.php

docinto contrib
cd ${S}/contrib
dodoc spamc-nice.eml
dodoc test-trophie.pl
dodoc logrotate.qmailscanner
dodoc sub-avpdaemon.pl
dodoc logging_first_80_chars.eml
dodoc spamc-nasty.eml
dodoc avpdeamon.init
dodoc test_installation.sh
dodoc test-sophie.pl
dodoc reformime-test.eml
dodoc sub-sender-cache.pl
dodoc rbl_scanner.txt
dodoc test-clamd.pl
dodoc qs2mrtg.pl
dodoc mrtg-qmail-scanner.cfg
}

pkg_postinst () {
einfo "Fixing ownerships"
chown -R qscand:qscand /var/spool/qmailscan/tmp /var/spool/qmailscan/working /var/spool/qmailscan/quarantine* /var/spool/qmailscan/archive /var/spool/qmailscan/qmail*
touch /var/qmail/bin/qmail-scanner-queue.pl

# Setup perlscanner + Version Info
chmod -s ${ROOT}/var/qmail/bin/qmail-scanner-queue.pl
${ROOT}/var/qmail/bin/qmail-scanner-queue -z
${ROOT}/var/qmail/bin/qmail-scanner-queue -g

elog "To activate qmail-scanner, please edit your"
elog "/var/qmail/control/conf-common file and set:"
elog "export QMAILQUEUE=/var/qmail/bin/qmail-scanner-queue"
elog "Or place it in your tcprules file."
ewarn "Please note that it was a call to qmail-scanner-queue.pl before,"
ewarn "but this is now changed to use a wrapper to improve security!"
ewarn "Once you have changed to the wrapper, you can remove the setuid "
ewarn "bit on qmail-scanner-queue.pl"
}

qmail-scanner-2.02-r1.ebuild

# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/mail-filter/qmail-scanner/qmail-scanner-2.02-r1.ebuild,v 1.1 2008/02/13 06:03:51 tupone Exp $

inherit fixheadtails toolchain-funcs eutils

Q_S_DATE=20080119
DESCRIPTION="E-Mail virus scanner for qmail."
HOMEPAGE="http://qmail-scanner.sourceforge.net/"
SRC_URI="mirror://sourceforge/qmail-scanner/${P}.tgz
http://toribio.apollinare.org/qmail-scanner/download/q-s-${PV}st-${Q_S_DATE}.patch.gz"

IUSE="clamav spamassassin"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
RESTRICT="userpriv"

DEPEND=">=dev-lang/perl-5.6.1-r1
>=virtual/perl-Time-HiRes-01.20-r2
>=net-mail/tnef-1.1.1
>=virtual/perl-DB_File-1.803-r2
mail-filter/maildrop
virtual/qmail
>=app-arch/unzip-5.42-r1
sys-process/daemontools
virtual/antivirus
clamav? ( app-antivirus/clamav )
spamassassin? ( >=mail-filter/spamassassin-2.64 )"

pkg_setup() {
enewgroup qscand 210
enewuser qscand 210 -1 /var/spool/qscan qscand
use clamav && usermod -a -G qscand,nofiles clamav
}

pkg_preinst() {
local oldname="/var/qmail/bin/qmail-scanner-queue.pl"
if [ -f ${oldname} ]; then
newname=${oldname}.`date +%Y%m%d%H%M%S`
elog "Backing up old qmail-scanner as $newname in case of modifications."
cp ${oldname} ${newname}
chmod 600 ${newname}
fi
}

src_unpack() {
unpack ${A}
cd "${S}"
epatch ${DISTDIR}/q-s-${PV}st-${Q_S_DATE}.patch.gz
ht_fix_file autoupdaters/* configure
sed -i \
-e "s:/var/spool/qscand:/var/spool/qscan:g" \
README-st-patch.html \
README-st-patch.txt || die "Fixing doc with sed failed"

EXTRA_VIRII="bagle,beagle,mydoom,sco,maldal,mimail,novarg,shimg,bugler,cissi,cissy,dloade,netsky,qizy"
elog "Adding items to the SILENT_VIRUSES list (${EXTRA_VIRII})"
sed -e "/^SILENT_VIRUSES/s/\"$/,${EXTRA_VIRII}\"/g" -i configure
}

src_compile () {
local myconf

addpredict /var/log/kav/kavscan.log
addpredict /opt/bdc/plugins.htm

use spamassassin && myconf="--virus-to-delete yes --sa-quarantine 2.1 --sa-delete 4.2 --sa-reject no --sa-subject SPAM: --sa-delta 0.5 --sa-alt yes"

PATH=${PATH}:/opt/f-prot:/opt/vlnx ./configure \
--domain localhost \
--batch \
--log-details yes \
--skip-setuid-test \
${myconf} \
|| die "./configure failed!"

# build for qmail-scanner-queue wrapper, so we don't need suidperl
cd contrib
$(tc-getCC) ${CFLAGS} -o qmail-scanner-queue qmail-scanner-queue.c || die
}

src_install () {
# Create Directory Structure
diropts -m 755 -o qscand -g qscand
dodir /var/spool/qscan
keepdir /var/spool/qscan
diropts -m 750 -o qscand -g qscand
dodir /var/spool/qscan/quarantine
for i in quarantine/{viruses,policy,spam} working archives; do
for j in tmp new cur; do
dodir /var/spool/qscan/${i}/${j}
keepdir /var/spool/qscan/${i}/${j}
done
done
dodir /var/spool/qscan/tmp
keepdir /var/spool/qscan/tmp

# Install standard quarantine events file
insinto /var/spool/qscan
insopts -m 644 -o qscand -g qscand
doins quarantine-events.txt

# create quarantine.log and viruses.log
touch quarantine.log
insinto /var/spool/qscan
insopts -m 644 -o qscand -g qscand
doins quarantine.log
dosym quarantine.log ${DESTDIR}/var/spool/qscan/viruses.log

# Install qmail-scanner wrapper
insinto /var/qmail/bin
insopts -m 4755 -o qscand -g qscand
doins contrib/qmail-scanner-queue

# Install qmail-scanner script
insinto /var/qmail/bin
insopts -m 0755 -o qscand -g qscand
doins qmail-scanner-queue.pl

insinto /etc/logrotate.d/
insopts -m 644 -o root -g root
newins "${FILESDIR}"/${P}.logrotate qmail-scanner

exeinto /etc/cron.daily/
newexe "${FILESDIR}"/qmailscanner.cronjob qmail-scanner

# Install documentation
dodoc README CHANGES
dohtml README.html FAQ.php TODO.php configure-options.php manual-install.php perlscanner.php

docinto contrib
cd "${S}"/contrib
dodoc spamc-nice.eml \
test-trophie.pl \
logrotate.qmail-scanner \
sub-avpdaemon.pl \
logging_first_80_chars.eml \
spamc-nasty.eml \
avpdeamon.init \
test_installation.sh \
test-sophie.pl \
reformime-test.eml \
sub-sender-cache.pl \
rbl_scanner.txt \
test-clamd.pl \
qs2mrtg.pl \
mrtg-qmail-scanner.cfg \
check_AV_daemons \
patch_for_nod32_single_user.eml \
qmail-delay \
qs-scanner-report.sh \
qs_config.sh \
qscan-spam-to-users.pl \
test-avgd.pl \
test_password.zip \
vpopmail-issues.eml
}

pkg_postinst () {
einfo "Fixing ownerships"
chown -R qscand:qscand /var/spool/qscan
touch /var/qmail/bin/qmail-scanner-queue.pl

# Setup perlscanner + Version Info
chmod -s "${ROOT}"/var/qmail/bin/qmail-scanner-queue.pl
"${ROOT}"/var/qmail/bin/qmail-scanner-queue -z
"${ROOT}"/var/qmail/bin/qmail-scanner-queue -g

elog "To activate qmail-scanner, please edit your"
elog "/var/qmail/control/conf-common file and set:"
elog "export QMAILQUEUE=/var/qmail/bin/qmail-scanner-queue"
elog "Or place it in your tcprules file."
ewarn "Please note that it was a call to qmail-scanner-queue.pl before,"
ewarn "but this is now changed to use a wrapper to improve security!"
ewarn "Once you have changed to the wrapper, you can remove the setuid "
ewarn "bit on qmail-scanner-queue.pl"

ewarn "If this is an upgrade from <=2.0.1 the home directory of the qscand"
ewarn "user is changed. Please update it manually to /var/spool/qscan"
ewarn "or remove the user and emerge again this package"

if use clamav; then
ewarn "To allow clamav integration comment-out in /etc/clamd.conf:"
ewarn "AllowSupplementaryGroups putting yes."
ewarn "After that, restart clamd with"
ewarn "/etc/init.d/clamd restart"
fi
}