1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-27 00:57:50 +00:00

- Update to 0.3.0

PR:		ports/78698
Submitted by:	Jeremy Chadwick <freebsd@jdc.parodius.com>
This commit is contained in:
Pav Lucistnik 2005-03-13 11:20:42 +00:00
parent 38bcab2540
commit a89d6e8e86
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=131088
8 changed files with 87 additions and 143 deletions

View File

@ -6,29 +6,28 @@
#
PORTNAME= spamass-milter
PORTVERSION= 0.2.0
PORTREVISION= 5
PORTVERSION= 0.3.0
CATEGORIES= mail
MASTER_SITES= ${MASTER_SITE_SAVANNAH}
MASTER_SITE_SUBDIR= spamass-milt
MAINTAINER= ports@FreeBSD.org
COMMENT= Sendmail Milter (mail filter) for SpamAssassin
COMMENT= Sendmail Milter (mail filter) plugin for SpamAssassin
BUILD_DEPENDS= spamc:${PORTSDIR}/mail/p5-Mail-SpamAssassin
RUN_DEPENDS= spamc:${PORTSDIR}/mail/p5-Mail-SpamAssassin
##
# Use the following quirks to choose which sendmail to use (ports or system):
#
# You can choose the sendmail to be used by specifying
# WITH_SENDMAIL_BASE=yes
# or
# WITH_SENDMAIL_PORT=yes
#
# WITH_SENDMAIL_BASE=yes
# or
# WITH_SENDMAIL_PORT=yes
# If unspecified, check for an up-to-date system version but give an
# installed port preference over it.
#
# if no preference was set, check for an up to date base version
# but give an installed port preference over it.
.include <bsd.port.pre.mk>
.if exists(${LOCALBASE}/lib/libldap.so)
@ -36,7 +35,7 @@ WITH_LDAP=yes
.endif
.if !defined(WITHOUT_LDAP) && defined(WITH_LDAP)
USE_OPENLDAP= yes
USE_OPENLDAP=yes
.endif
.if !defined(WITH_SENDMAIL_BASE) && \
@ -56,36 +55,45 @@ BUILD_DEPENDS+= ${LOCALBASE}/lib/libmilter.a:${PORTSDIR}/mail/sendmail
MILTERBASE?= ${LOCALBASE}
.endif
.if !defined(NOPORTDOCS)
PORTDOCS= AUTHORS ChangeLog NEWS README TODO
.endif
MILTERINC= ${MILTERBASE}/include
MILTERLIB= ${MILTERBASE}/lib
CPPFLAGS+= -I${MILTERINC}
LDFLAGS+= -L${MILTERLIB}
USE_REINPLACE= yes
USE_RC_SUBR= yes
GNU_CONFIGURE= yes
CONFIGURE_ENV+= CPPFLAGS="${CPPFLAGS}" LDFLAGS="${LDFLAGS}"
USE_REINPLACE= yes
USE_RC_SUBR= yes
RC_SCRIPTS_SUB= PREFIX=${PREFIX} RC_SUBR=${RC_SUBR}
PKGMESSAGE= ${WRKDIR}/pkg-message
MAN1= spamass-milter.1
post-patch:
@${SED} -e 's|/usr/local|${PREFIX}|g' \
${FILESDIR}/activation.txt > ${WRKDIR}/activation.txt
@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
${FILESDIR}/spamass-milter.sh > ${WRKDIR}/spamass-milter.sh
@${SED} -e's,%%PREFIX%%,${PREFIX},g' \
${FILESDIR}/activation.txt > ${WRKDIR}/activation.txt
.if !defined(WITHOUT_LDAP) && defined(WITH_LDAP)
@${REINPLACE_CMD} -e 's|-lmilter|-lmilter -lldap|g' ${WRKSRC}/configure
.endif
@${SED} -e's,%%DOCSDIR%%,${DOCSDIR},g' \
${MASTERDIR}/pkg-message > ${PKGMESSAGE}
post-install:
@${INSTALL_SCRIPT} ${WRKDIR}/spamass-milter.sh ${PREFIX}/etc/rc.d/spamass-milter.sh
${INSTALL_SCRIPT} ${WRKDIR}/spamass-milter.sh ${PREFIX}/etc/rc.d/spamass-milter.sh
.if !defined(NOPORTDOCS)
${MKDIR} ${DOCSDIR}
${INSTALL_DATA} ${WRKDIR}/activation.txt ${DOCSDIR}/activation.txt
.for f in ${PORTDOCS}
${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
.endfor
.endif
@${CAT} ${PKGMESSAGE}

View File

@ -1,2 +1,2 @@
MD5 (spamass-milter-0.2.0.tar.gz) = 70da3e4a6039f5e738ce21f69430e230
SIZE (spamass-milter-0.2.0.tar.gz) = 113894
MD5 (spamass-milter-0.3.0.tar.gz) = ced600331a0df7609fdbdf0e6d0eb943
SIZE (spamass-milter-0.3.0.tar.gz) = 140126

View File

@ -6,35 +6,29 @@ In order to activate spamass-milter, follow these steps:
2. If you didn't activate spamd (the SpamAssassin daemon), do so now:
/usr/local/etc/rc.d/spamd.sh start
%%PREFIX%%/etc/rc.d/sa-spamd.sh start
3. Activate spamass-milter:
/usr/local/etc/rc.d/spamass-milter.sh start
%%PREFIX%%/etc/rc.d/spamass-milter.sh start
4. Backup your sendmail.cf (in /etc/mail).
5. If you didn't create your own customized version of Sendmail .mc
file, create one from the default template (replace YOURNAME with a
suitable name; a good candidate is the output of `hostname -s'):
file, create one from the default template (hostname.mc):
cd /etc/mail
cp -p freebsd.mc YOURNAME.mc
echo "SENDMAIL_MC = /etc/mail/YOURNAME.mc" >> /etc/make.conf
make
The last line tells the system to use your customized version instead
of the default freebsd.mc when you run mergemaster(8) later on.
6. Add the spamass-milter hook to your Sendmail .mc file. The magic
6. Add the spamass-milter hook to your hostname.mc file. The magic
line to add is:
INPUT_MAIL_FILTER(`spamassassin', `S=local:/var/run/spamass-milter.sock, F=, T=C:15m;S:4m;R:4m;E:10m')
define(`confMILTER_MACROS_CONNECT',`b, j, _, {daemon_name}, {if_name}, {if_addr}')dnl
Everything should go on a single line, no line break/continuation is
allowed!
The best place to add this is right after the dnsbl-related comments.
(Hint: Every comment in an .mc file starts with `dnl'.)
allowed! The best place to add this is right after the dnsbl-related
comments. (Hint: Every comment in an .mc file starts with `dnl'.)
7. Rebuild the sendmail.cf from your .mc file:
@ -42,39 +36,31 @@ In order to activate spamass-milter, follow these steps:
make
make install
Or you can run mergemaster(8) instead if you want, although it's an
overkill.
8. Restart Sendmail:
kill -HUP `head -1 /var/run/sendmail.pid`
cd /etc/mail
make stop
make start
9. Test the whole piece:
/usr/sbin/sendmail root < /usr/local/share/doc/p5-Mail-SpamAssassin/sample-nonspam.txt
/usr/sbin/sendmail root < /usr/local/share/doc/p5-Mail-SpamAssassin/sample-spam.txt
echo "Testing spamass-milter..." | mail -s"Spam test" root
Each of these commands might take a long time to finish (up to about
10-20 seconds), so please be patient.
This might take a long time to finish (up to about 10-20 seconds),
since spamd has just started, so please be patient.
You should receive two messages, one from `Keith Dawson' and the
other from xl6Ety00V@fismat1.fcfm.buap.mx. The one from Keith Dawson
shouldn't be tagged as a spam, bearing this header line:
You (root) should receive a message from root@hostname, bearing this
header line:
X-Spam-Status: No, ...
On the other hand, the one from xl6Ety00V@fismat1.fcfm.buap.mx should
be tagged as a spam, bearing these two header lines:
X-Spam-Status: Yes, ...
X-Spam-Flag: YES
If things don't work as expected, promptly restore your sendmail.cf
from the backup copy then restart sendmail as shown on step 8; you
may lose incoming mail otherwise!
If things don't work as expected, promptly restore the stock FreeBSD
sendmail.cf (/etc/mail/freebsd.cf) as your default sendmail config,
or restore your own backup (if you keep one), as shown in step 8;
you may lose incoming mail otherwise!
Now all messages received by Sendmail are filtered through
SpamAssassin, and probable spam messages are tagged with the header
`X-Spam-Flag: YES'. Tell your users about this so they can set up
appropriate filters on their mail reader.
appropriate filters in their mail client.

View File

@ -1,64 +0,0 @@
--- spamass-milter.cpp.orig Thu Jun 26 16:10:44 2003
+++ spamass-milter.cpp Wed Oct 13 00:52:23 2004
@@ -102,6 +102,10 @@
#include <csignal>
#include <string>
#include <iostream>
+using std::string;
+using std::cout;
+using std::cerr;
+using std::endl;
#ifdef __cplusplus
extern "C" {
@@ -273,6 +277,7 @@
exit(errno);
break;
case 0: /* Child */
+ setsid();
break;
default: /* Parent */
exit(0);
@@ -351,6 +356,9 @@
string::size_type eoh = ( eoh1 < eoh2 ? eoh1 : eoh2 );
string::size_type bob = assassin->d().find_first_not_of("\r\n", eoh);
+ if (bob == string::npos)
+ bob = assassin->d().size();
+
update_or_insert(assassin, ctx, assassin->spam_flag(), &SpamAssassin::set_spam_flag, "X-Spam-Flag");
update_or_insert(assassin, ctx, assassin->spam_status(), &SpamAssassin::set_spam_status, "X-Spam-Status");
@@ -365,7 +373,7 @@
{
int score, rv;
const char *spam_status = assassin->spam_status().c_str();
- rv = sscanf(spam_status,"%*s hits=%d", &score);
+ rv = sscanf(spam_status,"%*s score=%d", &score);
if (rv != 1)
debug(D_ALWAYS, "Could not extract score from <%s>", spam_status);
else
@@ -539,6 +547,10 @@
}
}
+ /* if the header line ends in \r\n, don't return the \r */
+ if (header[field_end-1] == '\r')
+ field_end--;
+
// Maybe remove the whitespace picked up when a header wraps - this
// might actually be a requirement
return header.substr( field_start, field_end - field_start );
@@ -1341,7 +1353,11 @@
{
// assuming we have a recipient in the form: <username@somehost.somedomain>
// we return 'username'
- return _rcpt.substr(1,_rcpt.find('@')-1);
+ int at = _rcpt.find('@');
+ int plus = _rcpt.find('+');
+ if (plus > 0 && plus < at)
+ at = plus;
+ return _rcpt.substr(1,at-1);
}
int

View File

@ -24,27 +24,33 @@ rcvar=`set_rcvar`
command=%%PREFIX%%/sbin/spamass-milter
required_dirs=%%PREFIX%%/share/spamassassin
start_postcmd=start_postcmd
stop_postcmd=stop_postcmd
start_postcmd()
{
if test -f /var/run/sendmail.pid
then
sleep 1
kill -HUP `head -1 /var/run/sendmail.pid`
fi
}
stop_postcmd()
{
rm -f ${spamass_milter_socket}
if test -f /var/run/sendmail.pid
then
sleep 1
kill -HUP `head -1 /var/run/sendmail.pid`
fi
}
# set defaults
spamass_milter_enable=${spamass_milter_enable:-"NO"}
spamass_milter_socket=${spamass_milter_socket:-"/var/run/spamass-milter.sock"}
spamass_milter_flags=${spamass_milter_flags:-"-f -p ${spamass_milter_socket}"}
start_postcmd=start_postcmd
stop_postcmd=stop_postcmd
start_postcmd()
{
sleep 1
kill -HUP `head -1 /var/run/sendmail.pid`
}
stop_postcmd()
{
rm -f ${spamass_milter_socket}
sleep 1
kill -HUP `head -1 /var/run/sendmail.pid`
}
load_rc_config ${name}
run_rc_command "$1"

View File

@ -1,5 +1,5 @@
spamass-milter is a little plugin for the Sendmail Milter (Mail Filter)
library that pipes all incoming mail (including things received by
rmail/UUCP) through the SpamAssassin, a highly customizable SpamFilter.
spamass-milter is a plugin for the Sendmail Milter (Mail Filter) library
that pipes all incoming mail (including things received by rmail/UUCP)
through the SpamAssassin, a highly customizable spam filter.
WWW: http://savannah.gnu.org/projects/spamass-milt/

View File

@ -1,5 +1,14 @@
------------------------------------------------------------------------
spamass-milter has been installed, but you have to activate it manually
to use it. Refer to ${PREFIX}/share/doc/spamass-milter/activation.txt
for details.
spamass-milter has been installed, but it must be activated manually.
Pleae refer to...
%%DOCSDIR%%/activation.txt
...for details.
You may also want to tweak your spamd rc.subr(8) startup flags to
specify a username to switch credentials to when delivering mail, if
applicable.
------------------------------------------------------------------------

View File

@ -1,4 +1,3 @@
sbin/spamass-milter
etc/rc.d/spamass-milter.sh
%%PORTDOCS%%share/doc/spamass-milter/activation.txt
%%PORTDOCS%%@dirrm share/doc/spamass-milter
%%PORTDOCS%%%%DOCSDIR%%/activation.txt