-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Wednesday 01 May 2002 22:01 pm, Richie Laager wrote: > As usual, it works for me! Your mileage may vary. :-)
I just realized that there were two extra lines in that patch. They are the ones that include $response = undef. These were left over from the code that I modified to create this patch. For clarity, the corrected patch is attached. My apologies for this mistake. Richie P.S. These lines are harmless. However, if the patch makes it into CVS, these lines should not be included. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE80LCMbfU6uV4fG84RAvOFAKDkSLwD5zDhSVqVeHibzYcWZtgO2ACgo+sT +fduDKG/7arpa4+3WPabDQc= =nRci -----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 03:15:35 -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 03:15:35 -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,64 @@ } } +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; + + 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 ($@) { + 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 (@_); }