Re: [Exim] Resent- headers

Página superior
Eliminar este mensaje
Responder a este mensaje
Autor: Phil Pennock
Fecha:  
A: Exim Users
Asunto: Re: [Exim] Resent- headers
On 2003-11-12 at 10:51 +0000, Philip Hazel wrote:
> Some changes were made in that area: this is from the 4.20 ChangeLog:


Saw that, and the comments in the source, and just about anything which
a case-insensitive grep for "resent-" over the exim-4.24 source
distribution turned up. :^)

I accept that the "-t" behaviour is unpleasantly ill-defined and
problematic. The issue here is where -t is not used, but a mail is
accepted by SMTP and delivered on by some transport (either smtp driven
or appendfile).

Sorry that I didn't reply yesterday; looking today, I see that Tony
Finch has basically said what I was going to say. :^)

> I have changed what Exim does with Resent- headers several times after
> complaints, grumbling the while about imprecise specifications. Exim
> doesn't try to identify different header sets; this seemed to me like a
> mug's game. This is a comment from the code:


The whole thing is bad. I dislike it. I'm happy with Received: trace
fields. But the headers _do_ exist, so the best that can be done is to
try to conform to the standards and "reasonable" behaviour -- ie, don't
construct headers in such a way that they end up being misleading.

Pine may be misusing the headers, but if Exim ignores all the X-Resent
and stops treating any 'Resent-' header as special if it's separated
from a "higher" (later prepended) 'Resent-' header by any other header
(such as the block of Received: headers which you'd expect to see
between multiple resends, unless some MTA isn't adding trace
information) then Exim will at least handle the
least-extra-wording-needed-for-comprehensibility interpretation of the
standard, whilst not potentially corrupting headers.

> So what exactly *is* Exim doing to your message? If you've posted that,
> I'm afraid I've forgotten the details. Please remind me.


The original mail was a customer complaint; I meant to put together a
sample using "safe" data but didn't do so before, sorry.

Hrm, sync error, so need to lock-step which netcat can't do ... okay,
here's a quick hack which shoves a well-formed message through; the
"incoming.mail.nl.demon.net" is the Exim 4.24 systems which take mail
for Demon NL customers, does rewrites, rejects, etc, before shoving onto
store.mail (Exim 4.24 again), which stick the mail into a directory in
mailstore format; this mail should be executable via "perl -x" (beware
locale mangling of time).

-----------------------------< cut here >-------------------------------
#!/usr/bin/perl -w
use strict;
use IO::Socket;
use POSIX qw/ strftime /;
use Sys::Hostname ();

my $hostname = Sys::Hostname::hostname();
my $date_condensed = strftime '%Y%m%d%H%M%S', gmtime($^T);
my $date = strftime '%a, %d %b %Y %H:%M:%S %Z', gmtime($^T);
my $sender        = 'pdp+sample-Exim-test@???';
my $recipient        = 'fred@???';
my $orig_sender        = 'phil.pennock@???';
my $orig_recipient    = 'bitbucket@???';
my $body = <<"EOMESSAGE";
Resent-Message-Id: <$date_condensed.resent.fred-test.new\@$hostname>
Resent-From: $sender
Received: from non-existant ([10.0.0.1]) by $hostname with ESMTP id 1234
From: <$orig_sender>
To: <$orig_recipient>
Subject: test mail
Message-Id: <$date_condensed.fred-test.orig\@$hostname>
Date: $date
Resent-From: faked\@nowhere.example.org


test message
EOMESSAGE

my @body = split /\n/, $body;
sub lockstep;
my $s = IO::Socket::INET->new( Proto => 'tcp',
    PeerAddr => 'incoming.mail.nl.demon.net', PeerPort => 'smtp(25)');
die "no socket: $!" unless defined $s;


lockstep sock => $s;
lockstep sock => $s, line => "EHLO $hostname";
lockstep sock => $s, line => "MAIL FROM:<$sender>";
lockstep sock => $s, line => "RCPT TO:<$recipient>";
lockstep sock => $s, line => "DATA";
foreach (@body) {
    s/^\./../;
    print ">>> $_\n";
    print {$s} "$_\r\n";
}
lockstep sock => $s, line => ".";
lockstep sock => $s, line => "QUIT";


exit 0;

sub lockstep
{
    local %_ = @_;
    die "oops" unless exists $_{sock};
    if (exists $_{line}) {
        print ">>> $_{line}\n";
        print {$_{sock}} "$_{line}\r\n";
    }
    $_{sock}->flush();
    my $digit;
    while (defined($_ = $_{sock}->getline())) {
        s/\s+\z//;
        print "<<< $_\n";
        unless (/^(\d)\d\d([ -])/) { die "malformed line: $_"; }
        $digit = $1;
        last if $2 eq ' ';
    }
    die "error response" unless $digit == 2 or $digit == 3;
    return 1;
}
__END__
-----------------------------< cut here >-------------------------------


This was accepted with message-id 1AKEyT-0006q0-2S, and the final .msg
file looks like this:

-----------------------------< cut here >-------------------------------
Received: from store-21.mail.nl.demon.net by mailstore for fred@???
    id 1AKEyT-000LIi-64-000LIk; Thu, 13 Nov 2003 10:45:17 +0000
Received: from incoming-21.mail.nl.demon.net ([194.159.73.161]:4345)
    by store-21.mail.nl.demon.net with esmtp (Exim 4.24)
    id 1AKEyT-000LIi-64
    for fred@???; Thu, 13 Nov 2003 10:45:17 +0000
Received: from samhain.noc.nl.demon.net ([194.159.72.214]:4286)
    by incoming-21.mail.nl.demon.net with esmtp (Exim 4.24)
    id 1AKEyT-0006q0-2S
    for fred@???; Thu, 13 Nov 2003 10:45:17 +0000
Resent-Message-Id: <20031113104516.resent.fred-test.new@???>
Resent-From: pdp+sample-Exim-test@???
Received: from non-existant ([10.0.0.1]) by samhain.noc.nl.demon.net with ESMTP id 1234
From: <phil.pennock@???>
To: <bitbucket@???>
Subject: test mail
Message-Id: <20031113104516.fred-test.orig@???>
Date: Thu, 13 Nov 2003 10:45:16 CET
Resent-From: faked@???
Resent-Date: Thu, 13 Nov 2003 10:45:17 +0000


test message
-----------------------------< cut here >-------------------------------

Exim added the final header, "Resent-Date", but is claiming that the
earlier ("faked@") resend was on that date, which is patently false.


I'm sorry for not managing to clearly express my concerns before -- this
remains a problem on my part, I'm working on improving my communication
skills. Hopefully, the cause of my concern is now clear?
--
2001: Blogging invented. Promises to change the way people bore strangers with
banal anecdotes about their pets. <http://www.thelemon.net/issues/timeline.php>