diff -uNr amavis.orig/amavis/checkaccount.in amavis/amavis/checkaccount.in --- amavis.orig/amavis/checkaccount.in 2001-07-19 11:52:57.000000000 -0700 +++ amavis/amavis/checkaccount.in 2003-02-21 19:55:19.000000000 -0800 @@ -7,8 +7,12 @@ aliases=/etc/mail/aliases elif test -f "/etc/aliases"; then aliases=/etc/aliases +elif test -f "/etc/courier/aliases/system"; then + aliases=/etc/courier/aliases/system + newaliases=makealiases else aliases= + newaliases=newaliases fi if test "`echo \"@mailto@\" | grep \"@\" | wc -l`" -eq 1; then @@ -22,7 +26,7 @@ if test "`grep \"@mailto@\" $aliases | wc -l`" -lt 1; then if test -w "$aliases"; then echo "@mailto@: $whoami" >> $aliases - `newaliases` || echo "WARNING: could not run \"newaliases\"" + `$newaliases` || echo "WARNING: could not run \"$newaliases\"" else echo "WARNING: $aliases is not writable by \"$whoami\"" error="yes" diff -uNr amavis.orig/amavis/Makefile.am amavis/amavis/Makefile.am --- amavis.orig/amavis/Makefile.am 2001-08-28 05:10:01.000000000 -0700 +++ amavis/amavis/Makefile.am 2003-02-21 19:55:19.000000000 -0800 @@ -27,6 +27,9 @@ else \ umask 077 ; \ $(mkinstalldirs) $$subdir ; \ + if test $(MTA) = courier ; then \ + chmod 777 $$subdir; \ + fi; \ if test -n $(amavisuser) ; then \ chown $(amavisuser) $$subdir ; \ if test $(MTA) = qmail ; then \ @@ -39,6 +42,9 @@ if test ! -d $(DESTDIR)$(virusdir) ; then \ umask 077 ; \ $(mkinstalldirs) $(DESTDIR)$(virusdir) ; \ + if test $(MTA) = courier ; then \ + chmod 777 $(DESTDIR)$(virusdir); \ + fi; \ if test -n $(amavisuser) ; then \ chown $(amavisuser) $(DESTDIR)$(virusdir) ; \ fi; \ diff -uNr amavis.orig/amavis/mta/courier_args amavis/amavis/mta/courier_args --- amavis.orig/amavis/mta/courier_args 1969-12-31 16:00:00.000000000 -0800 +++ amavis/amavis/mta/courier_args 2003-02-21 19:55:19.000000000 -0800 @@ -0,0 +1,26 @@ +# command line parsing, courier version + +# we won't need any of this once amavis +# receives input from SMTP; but then, +# $SENDER and @RECIPS must be initialised +# from the SMTP dialogue + +# need two args in any case +if ($#ARGV < 1) { + do_log(0,"Missing arguments to courier"); + do_exit($REGERR, __LINE__); +} + +# optionally, we allow to use amavis with a -f flag +# to make invocation similar to sendmail +if ($ARGV[0] eq "-f") { + # in this case, we need at least three args + do_exit($REGERR, __LINE__) if ($#ARGV < 2); + + shift @ARGV; +} + +$SENDER = shift @ARGV; +@RECIPS = @ARGV; + +# End courier cmd line parsing diff -uNr amavis.orig/amavis/mta/courier_init amavis/amavis/mta/courier_init --- amavis.orig/amavis/mta/courier_init 1969-12-31 16:00:00.000000000 -0800 +++ amavis/amavis/mta/courier_init 2003-02-21 19:55:19.000000000 -0800 @@ -0,0 +1,12 @@ +# courier + +# error codes +$VIRUSERR = 0; +$REGERR = 75; # EX_TEMPFAIL from sendmail sysexits.h + +# don't run suid + +# set path explicitly +$ENV{PATH} = "/bin:/usr/bin:/usr/local/bin"; + +# End courier diff -uNr amavis.orig/amavis/mta/courier_send amavis/amavis/mta/courier_send --- amavis.orig/amavis/mta/courier_send 1969-12-31 16:00:00.000000000 -0800 +++ amavis/amavis/mta/courier_send 2003-02-21 19:55:19.000000000 -0800 @@ -0,0 +1,17 @@ + # sending mail, courier version + + # If amavis replaces the local delivery agent, LDA is procmail + # On a proxy type setup, LDA is sendmail + while (<$fh>) { + next if ($seen_xheader == 0 && m/^$X_HEADER_TAG:/o); + if ($seen_xheader == 0 && m/\A\r?\n\Z/) { + print STDOUT "$X_HEADER_TAG: $X_HEADER_LINE\n"; + $seen_xheader = 1; + } + print STDOUT $_; + } + + # Pass up the LDA's error code + do_exit(retcode($?), __LINE__); + +# End courier diff -uNr amavis.orig/configure.in amavis/configure.in --- amavis.orig/configure.in 2003-02-17 08:01:21.000000000 -0800 +++ amavis/configure.in 2003-02-21 19:55:20.000000000 -0800 @@ -269,6 +269,20 @@ fi fi +AC_ARG_ENABLE(courier, + [ --enable-courier use courier as MTA], + if test "x$enableval" = "xyes" ; then + MTA=courier + fi) + +dnl Need to find out whether sendmail_wrapper is really courier' sendmail +if test "x$MTA" = "xsendmail" ; then + strings ${sendmail_wrapper} | grep -i courier >/dev/null 2>&1 + if test $? -eq 0 ; then + MTA=courier + fi +fi + AC_ARG_ENABLE(exim, [ --enable-exim use exim as MTA], if test "x$enableval" = "xyes" ; then diff -uNr amavis.orig/README.courier amavis/README.courier --- amavis.orig/README.courier 1969-12-31 16:00:00.000000000 -0800 +++ amavis/README.courier 2003-02-21 21:02:32.000000000 -0800 @@ -0,0 +1,84 @@ +How To Use AMaViS With courier +****************************** + + By Lars Hecking + modified by Jim Gifford + + This configuration will work with the use of maildrop and the courier + mta. + + The libnet module from CPAN must be installed in addition to the other +perl modules. configure checks for it separately and *disables* smtp if +libnet is not found! + + You'll also need external unpackers, like arc etc. + + And yes, you need to have a virusscanner installed; and it must be +in the $PATH environment variable. + + Also, a problem one might run into is some weird configure output +about undefined macros. To fix this, one needs to install: + +http://cryp.to/autoconf-archive/Installed_Packages/acx_pthread.m4 +into the directory specified by 'aclocal --print-ac-dir' and then rerun +aclocal && automake && autoconf ! + + In this configuration, amavis runs under a non-privileged user id +(by default: amavis). Make sure it exists before proceeding. If a different +user is chosen, use the "--with-amavis-user=USER" configure option for amavis. + + So, if you use defaults + +./configure --enable-courier + +it should work. + + Configuring courier itself is very simple: + + note -- configuration files listed here may be different on your + system. You will need to locate the files before you + install. + + * change to /etc/courier/courierd: + + note -- you might need to change the path to maildrop. + this is dependent on how you install courier. + + DEFAULTDELIVERY=./Maildir + + changed to + + DEFAULTDELIVERY="| /usr/bin/maildrop" + + * add to /etc/courier/maildroprc: + + # Import Variables + # + import HOME + import SENDER + import RECIPIENT + + # Virus Scan + # + if ($SENDER ne "") + { + FROM=$SENDER + } + else + { + FROM="unknown" + } + + xfilter "/usr/sbin/amavis $FROM $RECIPIENT" + + if (/^Subject:.*VIRUS IN*/) + { + exception { + to "$DEFAULT/.Virus/" + } + } + + Notes: + + Make sure you create a user for amavis. +