return @records;
}
+sub add_return_path {
+ my ($message) = @_;
+ ## debbugs is kind of odd, and puts "Received:" first, them "From
+ ## ", and doesn't have a Return-Path. Fix that up so spamassassin
+ ## is happy.
+ $message =~
+ s{^(Received: at \S+\ by \S+;[^\n]+\n)(From (\S+) [^\n]+\n)}
+ {${1}Return-Path: $3\n$2};
+ return $message;
+}
+
sub spamc_bug {
my ($record,$spamc,$spamc_opts) = @_;
my $first_line = '';
if (not $childpid) {
die "Unable to fork spamc";
}
- print {$spamc_in} $record->{text};
+ print STDERR add_return_path($record->{text}) if $DEBUG > 1;
+ print {$spamc_in} add_return_path($record->{text});
close($spamc_in) or die "Unable to close spamc_in: $!";
waitpid($childpid,0);
if ($? >> 8) {