Fix Return-Path bug (#425)

* Fix Return-Path bug

* Missing $

* Another $
This commit is contained in:
Shawn Iverson 2019-12-05 14:40:16 -05:00 committed by GitHub
parent b5b9a4c129
commit a99c83b4d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 4 deletions

View file

@ -4,6 +4,7 @@
- Add QUICKPEEK variable to msmilter-init
- Add libdb-dev missing debian dependency
- clamavmodule (Mail::ClamAV) deprecated with warning
- Fix ancient Return-Path bug (Affects Sendmail with SA disabled)
11/03/2019 Changes in v5.2.1-1
==================================

View file

@ -578,8 +578,10 @@ sub Checks {
# Sendmail appears to add a placeholder Return-Path header which it uses
# for expansion later, unfortunately this placeholder uses high-bit chars.
# So we remove the header and create one from the envelope for SA.
@SAheaders = grep !/^Return-Path\:/i, @SAheaders;
unshift(@SAheaders, 'Return-Path: <' . $message->{from} . ">\n");
# https://github.com/MailScanner/v5/issues/418
# Rebuild Return-Path header in all cases outside of SA.pm
# @SAheaders = grep !/^Return-Path\:/i, @SAheaders;
# unshift(@SAheaders, 'Return-Path: <' . $message->{from} . ">\n");
#push(@WholeMessage, $global::MS->{mta}->OriginalMsgHeaders($message, "\n"));
push(@WholeMessage, @SAheaders);

View file

@ -460,13 +460,27 @@ my($sed) = "/bin/sed";
@headerswithouth = @{$message->{headers}};
}
my $returnpathfound = 0;
foreach $header (@headerswithouth) {
$h = $header;
# Re-insert the header flags for Return-Path:
$h = $message->{returnpathflags} . $h if $h =~ /^Return-Path:/i;
$h =~ s/^\S/H$&/;
if ($h =~ /^Return-Path:/i) {
# https://github.com/MailScanner/v5/issues/418
# Rebuild Return-Path header in all cases
$returnpathfound = 1;
$h = $message->{returnpathflags} . 'Return-Path: <' . $message->{from} . ">\n";
$h =~ s/^\S/H$&/;
}
push @{$message->{metadata}}, $h;
}
# https://github.com/MailScanner/v5/issues/418
# Add Return-Path header if missing
if (!$returnpathfound) {
$h = $message->{returnpathflags} . 'Return-Path: <' . $message->{from} . ">\n";
$h =~ s/^\S/H$&/;
unshift @{$message->{metadata}}, $h;
}
}
sub AddHeader {