From: Don Armstrong Date: Sat, 16 Dec 2017 00:22:19 +0000 (-0800) Subject: add in return-path and munge From for debbugs logs are odd X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=33b1c391c101fb56857d6ff932f45c4ab0f9e71e;p=debbugs.git add in return-path and munge From for debbugs logs are odd --- diff --git a/bin/debbugs-spam b/bin/debbugs-spam index d8abcc67..be1ab247 100755 --- a/bin/debbugs-spam +++ b/bin/debbugs-spam @@ -340,6 +340,17 @@ sub spam_score_bug { 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 = ''; @@ -358,7 +369,8 @@ sub spamc_bug { 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) {