diff options
author | Pav Lucistnik <pav@FreeBSD.org> | 2004-05-30 11:33:25 +0000 |
---|---|---|
committer | Pav Lucistnik <pav@FreeBSD.org> | 2004-05-30 11:33:25 +0000 |
commit | 97d7d074ce6c989a149add9cef6bb6b9c7759dfd (patch) | |
tree | 2956e7245d6b731d7fad7e4d848fe35935feb25a /security/amavisd | |
parent | ea2c46a9b4c1f411e68dc6a1988cb7bef1eb7042 (diff) | |
download | ports-97d7d074ce6c989a149add9cef6bb6b9c7759dfd.tar.gz ports-97d7d074ce6c989a149add9cef6bb6b9c7759dfd.zip |
Notes
Diffstat (limited to 'security/amavisd')
-rw-r--r-- | security/amavisd/Makefile | 28 | ||||
-rw-r--r-- | security/amavisd/files/amavisd-milter.sh | 84 | ||||
-rw-r--r-- | security/amavisd/files/amavisd.sh | 61 | ||||
-rw-r--r-- | security/amavisd/files/patch-amavis-av-clamavd | 11 | ||||
-rw-r--r-- | security/amavisd/files/patch-configure | 15 | ||||
-rw-r--r-- | security/amavisd/pkg-plist | 5 | ||||
-rw-r--r-- | security/amavisd/pkg-plist.milter | 18 |
7 files changed, 144 insertions, 78 deletions
diff --git a/security/amavisd/Makefile b/security/amavisd/Makefile index fef244fa26e3..bb103655900f 100644 --- a/security/amavisd/Makefile +++ b/security/amavisd/Makefile @@ -7,6 +7,7 @@ PORTNAME= amavisd PORTVERSION= 0.1 +PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= security MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} @@ -36,9 +37,13 @@ RUN_DEPENDS= ${BUILD_DEPENDS} GNU_CONFIGURE= yes USE_PERL5= yes +USE_RC_SUBR= yes AMAVISGROUP?= vscan AMAVISUSER?= vscan +MILTER_SCRIPT= +MILTER= "@comment -- no milter script --" +SBIN_AMAVIS= amavis SMTPPORT?= 10025 STARTSCRIPT= amavisd.sh WARNADMIN?= yes @@ -52,7 +57,15 @@ CONFIGURE_ARGS+= --sysconfdir=${PREFIX}/etc \ --with-warnrecip=${WARNRECIP} \ --with-warnadmin=${WARNADMIN} -CONFIGURE_ENV+= CPPFLAGS="-I${LOCALBASE}/include" LDFLAGS="-L${LOCALBASE}/lib" +CONFIGURE_ENV+= CPPFLAGS="-I${LOCALBASE}/include" LDFLAGS="-L${LOCALBASE}/lib" \ + PTHREAD_LIBS=${PTHREAD_LIBS} PTHREAD_CFLAGS=${PTHREAD_CFLAGS} + +RC_SCRIPTS_SUB= AMAVISUSER=${AMAVISUSER} \ + PREFIX=${PREFIX} \ + PERL=${PERL} \ + RC_SUBR=${RC_SUBR} +PLIST_SUB= SBIN_AMAVIS=${SBIN_AMAVIS} \ + MILTER=${MILTER} .if !defined(WITHOUT_UVSCAN) BUILD_DEPENDS+= uvscan:${PORTSDIR}/security/vscan @@ -73,8 +86,9 @@ RUN_DEPENDS+= ${LOCALBASE}/libexec/postfix/smtpd:${PORTSDIR}/mail/postfix-curren .elif defined(WITH_MILTER) CONFIGURE_ARGS+= --enable-milter MTA?= milter -PLIST= ${PKGDIR}/pkg-plist.milter -STARTSCRIPT= amavisd-milter.sh +MILTER_SCRIPT= amavisd-milter +MILTER= +SBIN_AMAVIS= amavis-milter .else CONFIGURE_ARGS+= --enable-sendmail MTA?= sendmail @@ -88,14 +102,18 @@ pre-fetch: .endif post-patch: - @${SED} 's,%%AMAVISUSER%%,${AMAVISUSER},g' ${FILESDIR}/${STARTSCRIPT} > ${WRKSRC}/${STARTSCRIPT} +.for script in amavisd ${MILTER_SCRIPT} + @${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} ${FILESDIR}/${script}.sh > ${WRKSRC}/${script}.sh +.endfor @${PERL} -pi.orig -e 's|/etc/amavisd.conf|${PREFIX}/etc/amavisd.conf|g' ${WRKSRC}/configure ${WRKSRC}/amavis/amavisd.in ${WRKSRC}/amavis/Makefile.in pre-install: @${SETENV} ${SCRIPTS_ENV} PKG_PREFIX="${PREFIX}" ${SH} ${PKGINSTALL} ${AMAVISUSER} ${AMAVISGROUP} post-install: - ${INSTALL_SCRIPT} ${WRKSRC}/${STARTSCRIPT} ${PREFIX}/etc/rc.d +.for script in amavisd ${MILTER_SCRIPT} + ${INSTALL_SCRIPT} ${WRKSRC}/${script}.sh ${PREFIX}/etc/rc.d/${script}.sh +.endfor .if !defined(NOPORTDOCS) @${MKDIR} ${DOCSDIR} .for FILE in FAQ INSTALL README README.exim README.milter README.postfix README.qmail README.scanners README.sendmail doc/amavis.html doc/amavis.m4 doc/amavis.png doc/amavis.txt diff --git a/security/amavisd/files/amavisd-milter.sh b/security/amavisd/files/amavisd-milter.sh index eaefe61b9988..71f987fee2cf 100644 --- a/security/amavisd/files/amavisd-milter.sh +++ b/security/amavisd/files/amavisd-milter.sh @@ -1,31 +1,57 @@ #!/bin/sh +# +# $FreeBSD$ +# -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi - -case "$1" in -start) - ( [ -x ${PREFIX}/sbin/amavisd ] || [ -x ${PREFIX}/sbin/amavis-milter ] ) || exit 1 - AMAVISD=$(/bin/ps -xU %%AMAVISUSER%% | grep amavisd | awk '{ print $1 }') - AMAVIS_MILTER=$(/bin/ps -xU %%AMAVISUSER%% | grep amavis-milter | awk '{ print $1 }') - ( /bin/test "$AMAVISD" || /bin/test "$AMAVIS_MILTER" ) && \ - su - %%AMAVISUSER%% -c "/bin/kill $AMAVISD $AMAVIS_MILTER" > /dev/null - rm -rf /var/amavis/amavis*.sock - su - %%AMAVISUSER%% -c "${PREFIX}/sbin/amavis-milter -D -p /var/amavis/amavis-milter.sock" > /dev/null - su - %%AMAVISUSER%% -c ${PREFIX}/sbin/amavisd > /dev/null 2>&1 && echo -n ' amavisd-milter' - ;; -stop) - ( [ -x ${PREFIX}/sbin/amavisd ] || [ -x ${PREFIX}/sbin/amavis-milter ] ) || exit 1 - AMAVISD=$(/bin/ps -xU %%AMAVISUSER%% | grep amavisd | awk '{ print $1 }') - AMAVIS_MILTER=$(/bin/ps -xU %%AMAVISUSER%% | grep amavis-milter | awk '{ print $1 }') - ( /bin/test "$AMAVISD" || /bin/test "$AMAVIS_MILTER" ) && \ - su - %%AMAVISUSER%% -c "/bin/kill $AMAVISD $AMAVIS_MILTER" > /dev/null && echo -n ' amavisd-milter' - ;; -*) - echo "Usage: `basename $0` {start|stop}" >&2 - ;; -esac - -exit 0 +# PROVIDE: amavisd-milter +# BEFORE: amavisd mail +# KEYWORD: FreeBSD shutdown + +prefix=%%PREFIX%% + +# Define these amavisd_milter_* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +amavisd_milter_enable=no +amavisd_milter_flags="-D" +amavisd_milter_user=%%AMAVISUSER%% +#amavisd_milter_socket="inet:9999@127.0.0.1" +amavisd_milter_socket="local:/var/amavis/amavis-milter.sock" + +. %%RC_SUBR%% + +name="amavisd_milter" +rcvar=`set_rcvar` +start_precmd="amavisd_precmd" +stop_postcmd="remove_socket" +command=${prefix}/sbin/amavis-milter + +# Remove the AMaViSd Milter Socket +remove_socket() +{ + case ${amavisd_milter_socket} in + unix:*|local:*) + socket=`echo ${amavisd_milter_socket} | /usr/bin/cut -d: -f2` + if [ -S ${socket} ]; then + rm -f ${socket} + fi + ;; + /*) + if [ -S ${amavisd_milter_socket} ]; then + rm -f ${amavisd_milter_socket} + fi + ;; + esac +} + +amavisd_precmd() +{ + rc_flags="${rc_flags} -p ${amavisd_milter_socket}" + + remove_socket +} + +load_rc_config $name +run_rc_command "$1" diff --git a/security/amavisd/files/amavisd.sh b/security/amavisd/files/amavisd.sh index 1a9bbe947d38..2528df760105 100644 --- a/security/amavisd/files/amavisd.sh +++ b/security/amavisd/files/amavisd.sh @@ -1,28 +1,41 @@ #!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: amavisd +# BEFORE: mail +# KEYWORD: FreeBSD shutdown -if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/$(basename $0)\$"); then - echo "$0: Cannot determine the PREFIX" >&2 - exit 1 -fi +prefix=%%PREFIX%% -case "$1" in -start) - ( [ -x ${PREFIX}/sbin/amavisd ] || [ -x ${PREFIX}/sbin/amavis-milter ] ) || exit 1 - AMAVISD=$(/bin/ps -xU %%AMAVISUSER%% | grep amavisd | awk '{ print $1 }') - ( /bin/test "$AMAVISD" ) && \ - su - %%AMAVISUSER%% -c "/bin/kill $AMAVISD" > /dev/null - rm -rf /var/amavis/amavis*.sock - su - %%AMAVISUSER%% -c ${PREFIX}/sbin/amavisd > /dev/null 2>&1 && echo -n ' amavisd' - ;; -stop) - ( [ -x ${PREFIX}/sbin/amavisd ] || [ -x ${PREFIX}/sbin/amavis-milter ] ) || exit 1 - AMAVISD=$(/bin/ps -xU %%AMAVISUSER%% | grep amavisd | awk '{ print $1 }') - ( /bin/test "$AMAVISD") && \ - su - %%AMAVISUSER%% -c "/bin/kill $AMAVISD" > /dev/null && echo -n ' amavisd' - ;; -*) - echo "Usage: `basename $0` {start|stop}" >&2 - ;; -esac +# Define these amavisd_* variables in one of these files: +# /etc/rc.conf +# /etc/rc.conf.local +# +# DO NOT CHANGE THESE DEFAULT VALUES HERE +amavisd_enable=no +amavisd_flags="" +amavisd_user=%%AMAVISUSER%% -exit 0 +. %%RC_SUBR%% + +name="amavisd" +rcvar=`set_rcvar` +start_precmd="remove_socket" +stop_postcmd="remove_socket" +command=${prefix}/sbin/amavisd +command_arg="> /dev/null 2>&1" +command_interpreter="%%PERL%%" +pidfile="/var/amavis/amavisd.pid" + +# Remove the AMaViSd Socket +remove_socket() +{ + if [ -S /var/amavis/amavisd.sock ]; then + rm -f /var/amavis/amavisd.sock + fi +} + +load_rc_config $name +run_rc_command "$1" diff --git a/security/amavisd/files/patch-amavis-av-clamavd b/security/amavisd/files/patch-amavis-av-clamavd new file mode 100644 index 000000000000..1832e3aa9ace --- /dev/null +++ b/security/amavisd/files/patch-amavis-av-clamavd @@ -0,0 +1,11 @@ +--- amavis/av/clamavd.orig Tue Feb 25 11:42:54 2003 ++++ amavis/av/clamavd Sun May 30 13:26:34 2004 +@@ -5,7 +5,7 @@ + + if ($clamd) { + do_log(2,"Using clamd"); +- my $sock = IO::Socket::INET->new('127.0.0.1:3310'); ++ my $sock = IO::Socket::UNIX->new('/var/run/clamav/clamd'); + if (defined $sock) { + $sock->print("SCAN $TEMPDIR/parts\n"); + $sock->flush; diff --git a/security/amavisd/files/patch-configure b/security/amavisd/files/patch-configure new file mode 100644 index 000000000000..7edcfbbae50f --- /dev/null +++ b/security/amavisd/files/patch-configure @@ -0,0 +1,15 @@ +--- configure-orig Wed Feb 19 08:22:25 2003 ++++ configure Wed Sep 10 19:34:30 2003 +@@ -3083,11 +3083,11 @@ + #define HAVE_SM_SM_STRLCPY 1 + EOF + ++ LIBS="-lsm $LIBS" + else + echo "$ac_t""no" 1>&6 + fi + +- LIBS="-lsm $LIBS" + fi + + diff --git a/security/amavisd/pkg-plist b/security/amavisd/pkg-plist index 95e95ecd929f..8c6e4ab332f4 100644 --- a/security/amavisd/pkg-plist +++ b/security/amavisd/pkg-plist @@ -13,6 +13,7 @@ %%PORTDOCS%%%%DOCSDIR%%/amavis.txt %%PORTDOCS%%@dirrm %%DOCSDIR%% etc/amavisd.conf -etc/rc.d/amavisd.sh -sbin/amavis +sbin/%%SBIN_AMAVIS%% sbin/amavisd +%%MILTER%%etc/rc.d/amavisd-milter.sh +etc/rc.d/amavisd.sh diff --git a/security/amavisd/pkg-plist.milter b/security/amavisd/pkg-plist.milter deleted file mode 100644 index 43247c6abb13..000000000000 --- a/security/amavisd/pkg-plist.milter +++ /dev/null @@ -1,18 +0,0 @@ -%%PORTDOCS%%share/doc/amavisd/FAQ -%%PORTDOCS%%share/doc/amavisd/INSTALL -%%PORTDOCS%%share/doc/amavisd/README -%%PORTDOCS%%share/doc/amavisd/README.exim -%%PORTDOCS%%share/doc/amavisd/README.milter -%%PORTDOCS%%share/doc/amavisd/README.postfix -%%PORTDOCS%%share/doc/amavisd/README.qmail -%%PORTDOCS%%share/doc/amavisd/README.scanners -%%PORTDOCS%%share/doc/amavisd/README.sendmail -%%PORTDOCS%%share/doc/amavisd/amavis.html -%%PORTDOCS%%share/doc/amavisd/amavis.m4 -%%PORTDOCS%%share/doc/amavisd/amavis.png -%%PORTDOCS%%share/doc/amavisd/amavis.txt -%%PORTDOCS%%@dirrm share/doc/amavisd -etc/amavisd.conf -etc/rc.d/amavisd-milter.sh -sbin/amavis-milter -sbin/amavisd |