Guys,
I put together a patch that provides support for spambayes. I ran it for a
few days, and it worked okay. But then, the system started thrashing badly,
with lots of hung processes and disk i/o, so I had to remove it.
I haven't had time to debug the thing, ... Was wondering if anyone here
could help. The patch appears below. It's a unified diff. You can either
"cut and paste" from below, or email me for a gzip file that contains the
patch.
Please keep in mind this patch is for qmail-scanner-1.16.
I'd really appreciate some help getting this to work.
Michael Martinez
CSREES/ISTM/USDA
diff -u -P qmail-scanner-1.16/configure qmail-scanner-1.16-mm/configure
--- qmail-scanner-1.16/configure Mon Feb 10 16:03:37 2003
+++ qmail-scanner-1.16-mm/configure Fri Mar 7 13:06:23 2003
@@ -1,4 +1,4 @@
-#!/bin/sh
+
#
#Pipe into bash if it's present
@@ -34,7 +34,7 @@
VERSION=`grep '^# Version: ' qmail-scanner-queue.template`
VERSION=`echo $VERSION|awk '{print $NF}'`
-SUPPORTED_SCANNERS="sweep,sophie,vscan,trophie,uvscan,csav,antivir,kavscann
er,AvpLinux,kavdaemon,AvpDaemonClient,fsav,fprot,inocucmd,ravlin,clamscan,ve
rbose_spamassassin,fast_spamassassin"
+SUPPORTED_SCANNERS="sweep,sophie,vscan,trophie,uvscan,csav,antivir,kavscann
er,AvpLinux,kavdaemon,AvpDaemonClient,fsav,fprot,inocucmd,ravlin,clamscan,ve
rbose_spamassassin,fast_spamassassin,spambayes"
SILENT_VIRUSES="klez,bugbear,hybris,yaha,braid,nimda,tanatos,sobig,winevar"
@@ -297,7 +297,7 @@
exit
fi
-PATH="$PATH:$QMAILDIR/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr
/local/sbin:/etc/iscan:/usr/local/uvscan:/usr/lib/AntiVir:/usr/lib/uvscan:/u
sr/local/av:/opt/AV:/opt/AVP:/usr/local/f-prot:/usr/local/rav8/bin" export
PATH
+PATH="$PATH:$QMAILDIR/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr
/local/sbin:/etc/iscan:/usr/local/uvscan:/usr/lib/AntiVir:/usr/lib/uvscan:/u
sr/local/av:/opt/AV:/opt/AVP:/usr/local/f-prot:/usr/local/rav8/bin:/usr/loca
l/spambayes" export PATH
if [ "$MIME_UNPACKER" != "" ]; then
if [ "`echo $MIME_UNPACKER |egrep -v '^(reformime|ripmime)$'`" != ""
]; then
@@ -606,14 +606,14 @@
if [ "`echo $FIND_SCANNERS|grep ' antivir '`" != "" ]; then
if test -x $dir/antivir
then
- if [ "`$dir/antivir -allfiles -s -tmp. -z -v $TMP_DIR 2>&1|grep -i
test`" != "" ]; then
+ if [ "`$dir/antivir --allfiles -s --temp=. -z -v $TMP_DIR 2>&1|grep
-i test`" != "" ]; then
HBEDV="${HBEDV:-$dir/antivir}"
- HBEDV_OPTIONS="-allfiles -s -tmp. -z -v"
+ HBEDV_OPTIONS="--allfiles -s --temp=. -z -v"
INSTALLED_SCANNERS="$INSTALLED_SCANNERS
antivir"
- elif [ "`$dir/antivir -allfiles -s -tmp. -v $TMP_DIR 2>&1|grep -i
test`" != "" ]; then
+ elif [ "`$dir/antivir --allfiles -s -temp=. -v $TMP_DIR 2>&1|grep -i
test`" != "" ]; then
HBEDV="${HBEDV:-$dir/antivir}"
- HBEDV_OPTIONS="-allfiles -s -tmp. -v"
+ HBEDV_OPTIONS="--allfiles -s --temp=. -v"
INSTALLED_SCANNERS="$INSTALLED_SCANNERS
antivir"
fi
@@ -796,6 +796,17 @@
fi
fi
fi
+
+ if [ "`echo $FIND_SCANNERS|grep ' spambayes '`" != "" ]; then
+ if test -x $dir/hammiefilter.py && test -f $dir/.hammiedb
+ then
+ SPAMBAYES_BINARY="${SPAMBAYES_BINARY:-$dir/hammiefilter.py}"
+ SPAMBAYES_OPTIONS="-d $dir/.hammiedb"
+ INSTALLED_SCANNERS="$INSTALLED_SCANNERS
+spambayes"
+ fi
+ fi
+
if test -x $dir/find
then
FIND="${FIND:-$dir/find}"
@@ -1182,6 +1193,13 @@
fi
fi
+if [ "$SPAMBAYES_BINARY" != "" ]; then
+
+ echo "spambayes=$SPAMBAYES_BINARY $SPAMBAYES_OPTIONS"
+ SCANNER_ARRAY="$SCANNER_ARRAY,\"spambayes\""
+fi
+
+
USERNAME=${USERNAME:-$LOGNAME}
SCANNER_ARRAY=`echo $SCANNER_ARRAY|sed 's/^,//g'`
@@ -1360,6 +1378,8 @@
s?SPAMC_BINARY?$SPAMC_BINARY?g;
s?SPAMC_OPTIONS?$SPAMC_OPTIONS?g;
s?SPAMC_SUBJECT?$SPAMC_SUBJECT?g;
+s?SPAMBAYES_OPTIONS?$SPAMBAYES_OPTIONS?g;
+s?SPAMBAYES_BINARY?$SPAMBAYES_BINARY?g;
s?USERNAME?$USERNAME?g;
s?FQDN?$FQDN?g;
s?MAILDOMAIN?$MAILDOMAIN?g;
Common subdirectories: qmail-scanner-1.16/contrib and
qmail-scanner-1.16-mm/contrib
Common subdirectories: qmail-scanner-1.16/locale and
qmail-scanner-1.16-mm/locale
diff -u -P qmail-scanner-1.16/qmail-scanner-queue.template
qmail-scanner-1.16-mm/qmail-scanner-queue.template
--- qmail-scanner-1.16/qmail-scanner-queue.template Sun Feb 2 21:07:23
2003
+++ qmail-scanner-1.16-mm/qmail-scanner-queue.template Fri Mar 7 13:29:24
2003
@@ -193,6 +193,8 @@
my $spamc_subject='SPAMC_SUBJECT';
my $spamassassin_binary='SPAMASSASSIN_BINARY';
my ($sa_comment,$tag_score);
+my $spambayes_binary='SPAMBAYES_BINARY';
+my $spambayes_options='SPAMBAYES_OPTIONS';
$ENV{'PATH'}='/bin:/usr/bin';
diff -u -P qmail-scanner-1.16/sub-spambayes.pl
qmail-scanner-1.16-mm/sub-spambayes.pl
--- qmail-scanner-1.16/sub-spambayes.pl Wed Dec 31 19:00:00 1969
+++ qmail-scanner-1.16-mm/sub-spambayes.pl Fri Mar 7 13:30:13 2003
@@ -0,0 +1,50 @@
+sub spambayes {
+
+ #Only run SB if mail is from a "remote" SMTP client
+
+ return if (defined($ENV{'RELAYCLIENT'}));
+ #SpamBayes client scanner
+
+ my ($spambayes_found,$spambayes_status);
+ my ($start_spambayes_time)=[gettimeofday];
+ my ($DD,$spambayes_status,$stop_spambayes_time,$spambayes_time);
+ my ($sb_status)=0;
+ my ($sb_score)=0.00;
+
+ &debug("SB: run $spambayes_binary $spambayes_options <
$scandir/$wmaildir/new/$file_id");
+
+ open(SB,"$spambayes_binary $spambayes_options <
$scandir/$wmaildir/new/$file_id|")||&tempfail("cannot run $spambayes_binary
< $scandir/$wmaildir/new/$file_id - $!");
+
+
open(SOUT,">$scandir/$wmaildir/new/$file_id.spambayes")||&tempfail("cannot
open for write $scandir/$wmaildir/new/$file_id.spambayes - $!");
+
+ while (<SB>) {
+ #X-Spambayes-Classification: ham; 0.00
+
+ if (/^X-Spambayes-Classification: (ham|unsure|spam)/) {
+ $sb_status=1 if ($1 eq "spam");
+ $sb_score=$2;
+ }
+ print SOUT;
+ }
+
+ close(SB);
+ $spambayes_status=($? >> 8);
+ close(SOUT);
+
+ $sb_score='0' if (!$sb_score);
+
+ if (-s "$scandir/$wmaildir/new/$file_id.spambayes" && $spambayes_status
== 0) {
+ &debug("SB: overwriting $scandir/$wmaildir/new/$file_id with
$scandir/$wmaildir/new/$file_id.spambayes");
+ rename
("$scandir/$wmaildir/new/$file_id.spambayes","$scandir/$wmaildir/new/$file_i
d");
+ } else {
+ unlink("$scandir/$wmaildir/new/$file_id.spambayes");
+ }
+
+ $stop_spambayes_time=[gettimeofday];
+
+ $spambayes_time = tv_interval ($start_spambayes_time,
$stop_spambayes_time);
+
+ &debug("spambayes: finished scan of dir \"$scandir/$file_id\" in
$spambayes_time secs");
+}
+
+
-------------------------------------------------------
This SF.net email is sponsored by:Crypto Challenge is now open!
Get cracking and register here for some mind boggling fun and
the chance of winning an Apple iPod:
http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
_______________________________________________
Qmail-scanner-general mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/qmail-scanner-general