-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Attached is a patch that runs messages through "dccproc -t many" when "spamassassin -r" is run.
To simplify that, it means that a message is reported to the DCC server as a SPAM at the same time the message is reported to Razor. (By doing this, a message is instantly given a status of MANY, instead of having to get enough "bulkiness" to gain this status.) As usual, it works for me! Your mileage may vary. :-) - -- Richie Laager Wikstrom Telecom Internet -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE80KwWbfU6uV4fG84RAsUzAKDS6drhpjA5+TBlM9l9hN6maYnLcwCg2j6G J3nE/Al1y15fisfPE7hzAVc= =rQzA -----END PGP SIGNATURE-----
Index: spamassassin.raw =================================================================== RCS file: /cvsroot/spamassassin/spamassassin/spamassassin.raw,v retrieving revision 1.39 diff -u -r1.39 spamassassin.raw --- spamassassin.raw 2 May 2002 01:49:28 -0000 1.39 +++ spamassassin.raw 2 May 2002 02:58:17 -0000 @@ -330,7 +330,8 @@ Report this message as verified spam. This will submit the mail message read from STDIN to various spam-blocker databases, such as Vipul's Razor ( -http://razor.sourceforge.net/ ). +http://razor.sourceforge.net/ ) and the Distributed Checksum Clearinghouse ( +http://www.rhyolite.com/anti-spam/dcc/ ). If the message contains SpamAssassin markup, this will be stripped out automatically before submission. Index: lib/Mail/SpamAssassin/Reporter.pm =================================================================== RCS file: /cvsroot/spamassassin/spamassassin/lib/Mail/SpamAssassin/Reporter.pm,v retrieving revision 1.22 diff -u -r1.22 Reporter.pm --- lib/Mail/SpamAssassin/Reporter.pm 6 Mar 2002 11:23:35 -0000 1.22 +++ lib/Mail/SpamAssassin/Reporter.pm 2 May 2002 02:58:17 -0000 @@ -45,6 +45,15 @@ dbg ("SpamAssassin: spam reported to Razor."); } } + if (!$self->{main}->{local_tests_only} + && !$self->{options}->{dont_report_to_dcc} + && !$self->{main}->{stop_at_threshold} + && $self->is_dcc_available()) + { + if ($self->dcc_report($text)) { + dbg ("SpamAssassin: spam reported to DCC."); + } + } } ########################################################################### @@ -136,6 +145,66 @@ } } +sub is_dcc_available { + my ($self) = @_; + + if ($self->{main}->{local_tests_only}) { + dbg ("local tests only, ignoring DCC"); + return 0; + } + + if (!open(DCCHDL, "dccproc -V 2>&1 |")) { + close DCCHDL; + dbg ("DCC is not available"); + return 0; + } + else { + close DCCHDL; + dbg ("DCC is available"); + return 1; + } +} + +sub dcc_report { + my ($self, $fulltext) = @_; + my $timeout = 10; + my $response = undef; + + eval { + use IPC::Open2; + my ($dccin, $dccout, $pid); + + local $SIG{ALRM} = sub { die "alarm\n" }; + local $SIG{PIPE} = sub { die "brokenpipe\n" }; + + alarm 10; + + $pid = open2($dccout, $dccin, 'dccproc -t many '.$self->{conf}->{dcc_options}.' >/dev/null 2>&1'); + + print $dccin $fulltext; + + close ($dccin); + + waitpid ($pid, 0); + + alarm(0); + }; + + if ($@) { + $response = undef; + if ($@ =~ /alarm/) { + dbg ("DCC report timed out after 10 secs."); + return 0; + } elsif ($@ =~ /brokenpipe/) { + dbg ("DCC report failed - Broken pipe."); + return 0; + } else { + warn ("DCC report skipped: $! $@"); + return 0; + } + } + return 1; +} ########################################################################### sub dbg { Mail::SpamAssassin::dbg (@_); }