Broken Return-Path: header (better solution!)
Evert Jan van Ramselaar
evertjan at VANRAMSELAAR.NL
Thu May 9 15:47:38 IST 2002
Hmmm...
In the warning message it still shows up as:
Full headers are:
Return-Path: <?g>
--
Evert Jan van Ramselaar <evertjan at vanramselaar.nl>
Van Ramselaar Info Tech <http://www.vanramselaar.nl>
> -----Original Message-----
> From: MailScanner mailing list [mailto:MAILSCANNER at JISCMAIL.AC.UK]On
> Behalf Of Julian Field
> Sent: Thursday, May 09, 2002 4:26 PM
> To: MAILSCANNER at JISCMAIL.AC.UK
> Subject: Re: Broken Return-Path: header (better solution!)
>
>
> At 14:41 09/05/2002, you wrote:
> >At 12:39 09/05/2002, you wrote:
> >>I don't know what it was supposed to do, but when I apply this patch, it
> >>just deletes the Return-Path header from the warning message
> AND from the
> >>infected message.
> >
> >That should only happen if you are using MailScanner on the server that
> >does the final message delivery into the user's mailbox.
> >
> >Is the Return-Path header any use anyway? I don't see why as it
> is trivial
> >to fake.
> >
> >I'll try to write you a better version of the solution.
>
> Patch required to both sendmail.pl and mta-specific.pl. These
> patches are a
> bit big, so I have attached a new sendmail.pl and mta-specific.pl to this
> message.
>
> Note ***THESE ARE FOR THE LATEST VERSION 3.13-2 ONLY***
> If you want to add this functionality to earlier releases, you
> will have to
> insert the following patches by hand.
>
> If these work okay, they'll get rolled into the next minor release.
>
> -----------------------------------------------------------
> *** /usr/local/mailscanner/mailscanner/bin/sendmail.pl Tue May
> 7 05:03:31
> 2002
> --- sendmail.pl Thu May 9 15:12:28 2002
> ***************
> *** 569,578 ****
> --- 569,579 ----
> Lock::unlockclose($DfOut);
> #undef $DfOut;
>
> # Construct all the new headers
> $newheaders =
> MTA::ConstructHeaders($entities->{$id}->stringify_header);
> + $newheaders = MTA::FixReturnPath($newheaders);
> $newheaders = AddCleanHeader($newheaders) if $Clean eq 'clean';
> $newheaders = AddInfectedHeader($newheaders) if $Clean eq 'dirty';
> $newheaders = AddUnscannedHeader($newheaders) if $Clean eq
> 'unscanned';
> if (defined($IsSpam->{$id})) {
> $newheaders = MTA::AddHeader($newheaders, $Config::SpamHeader,
> -----------------------------------------------------------
> and
> -----------------------------------------------------------
> *** /usr/local/mailscanner/mailscanner/bin/mta-specific.pl Thu May 9
> 12:24:34 2002
> --- mta-specific.pl Thu May 9 15:18:35 2002
> ***************
> *** 137,146 ****
> --- 137,150 ----
> # Given filehandle open for reading, merge envelope data (excepting
> # headers) from filehandle with headers from string, and return new
> # envelope data in string, ready to be written back to new
> # envelope queue file.
> #
> + # FixReturnPath:
> + # In sendmail the Return-Path: header needs some flags at the start
> + # of the line. Exim requires no change.
> + #
> # KickMessage:
> # Given id, tell MTA to make a delivery attempt.
> #
>
> my($cat) = "/bin/cat";
> ***************
> *** 467,476 ****
> --- 471,485 ----
>
> $envelope .= $headers;
> return $envelope;
> }
>
> + sub FixReturnPath {
> + my($headers) = @_;
> + return $headers;
> + }
> +
> sub KickMessage {
> my(@ids) = @_;
> my($idlist);
>
> # Need to check this with Nick to discover how to attempt delivery
> of multiple messages
> ***************
> *** 519,529 ****
>
> sub ReadQf {
> my($RQf) = @_;
> my($InHeader, @results, $msginfo, $from, @to, $subject);
> my($ip);
> ! my($Line);
>
> $InHeader = 0;
> while(<$RQf>) {
> last if /^\./; # Bat book section 23.9.19
> $Line = $_;
> --- 528,538 ----
>
> sub ReadQf {
> my($RQf) = @_;
> my($InHeader, @results, $msginfo, $from, @to, $subject);
> my($ip);
> ! my($Line, $Flags);
>
> $InHeader = 0;
> while(<$RQf>) {
> last if /^\./; # Bat book section 23.9.19
> $Line = $_;
> ***************
> *** 550,562 ****
> }
> $InHeader = 1 if $Line =~ /^H/;
> ($InHeader=0),next unless $Line =~ /^[H\t ]/;
> $Line =~ s/^H//;
> # JKF 18/04/2001 Delete ?flags? for 0 or more flags for
> sendmail 8.11
> ! $Line =~ s/^\?[^?]*\?//;
> ! # JKF 06/05/2002 Fix broken Return-Path: header bug
> ! next if $Line =~ /^Return-Path:/i;
> push @results, $Line;
> if ($Line =~ /^Subject:\s+(\S.*)$/i) {
> $subject = $1;
> #print "Subject is \"$subject\"\n";
> }
> --- 559,572 ----
> }
> $InHeader = 1 if $Line =~ /^H/;
> ($InHeader=0),next unless $Line =~ /^[H\t ]/;
> $Line =~ s/^H//;
> # JKF 18/04/2001 Delete ?flags? for 0 or more flags for
> sendmail 8.11
> ! $Line =~ s/^(\?[^?]*\?)//;
> ! $Flags = $1;
> ! # JKF 09/05/2002 Fix broken Return-Path: header bug
> ! $MTA::ReturnPathFlags = $Flags if $Line =~ /^Return-Path:/i;
> push @results, $Line;
> if ($Line =~ /^Subject:\s+(\S.*)$/i) {
> $subject = $1;
> #print "Subject is \"$subject\"\n";
> }
> ***************
> *** 707,716 ****
> --- 717,732 ----
> }
>
> $envelope .= $headers;
> $envelope .= ".\n";
> return $envelope;
> + }
> +
> + sub FixReturnPath {
> + my($headers) = @_;
> + $headers =~ s/^H(Return-Path:)/H$MTA::ReturnPathFlags$1/mi;
> + return $headers;
> }
>
> sub KickMessage {
> my(@ids) = @_;
> my($idlist);
> -----------------------------------------------------------
>
More information about the MailScanner
mailing list