Mailing List Archive

[PATCH] spool_mbox cleanup
Hi list,

I did some cleanup work on spool_mbox.c, the code is currently running
fine here.

One thing I took from the old code is this:

temp_string = expand_string(
US"From ${if def:return_path{$return_path}{MAILER-DAEMON}}
${tod_bsdinbox}\n"
"${if def:sender_address{X-Envelope-From: <${sender_address}>\n}}"
"${if def:received_for{X-Envelope-To: <${received_for}>\n}}");

If I'm not wrong, received_for can't be set while the mime/content ACLs
are running, but I wasn't sure.

Nico
Re: [PATCH] spool_mbox cleanup [ In reply to ]
On Wed, 9 Aug 2006, Nico Erfurth wrote:

> If I'm not wrong, received_for can't be set while the mime/content ACLs are
> running, but I wasn't sure.

You are correct. The only time it might be set is when Exim expands
received_header_text.

--
Philip Hazel University of Cambridge Computing Service
Get the Exim 4 book: http://www.uit.co.uk/exim-book

--
## List details at http://www.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
Re: [PATCH] spool_mbox cleanup [ In reply to ]
Philip Hazel wrote:
> On Wed, 9 Aug 2006, Nico Erfurth wrote:
>
>> If I'm not wrong, received_for can't be set while the mime/content ACLs are
>> running, but I wasn't sure.
>
> You are correct. The only time it might be set is when Exim expands
> received_header_text.

Ok, first tests, and some code digging confirmed that yesterday, but
you never know ... *G*

Nico

--
## List details at http://www.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
Re: [PATCH] spool_mbox cleanup [ In reply to ]
Quoting Nico Erfurth:

> "${if def:received_for{X-Envelope-To: <${received_for}>\n}}");
>
> If I'm not wrong, received_for can't be set while the mime/content ACLs
> are running, but I wasn't sure.

I don't know that, but according to the spec, it is only set if there is
exactly one recipient, which is bad. I sent a small patch to this list a
while ago, replacing it with $recipients. Nobody seemed to care about
it, though.




--
## List details at http://www.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
Re: [PATCH] spool_mbox cleanup [ In reply to ]
On Wed, 9 Aug 2006, Jakob Hirsch wrote:

> Quoting Nico Erfurth:
>
> > "${if def:received_for{X-Envelope-To: <${received_for}>\n}}");
> >
> > If I'm not wrong, received_for can't be set while the mime/content ACLs
> > are running, but I wasn't sure.
>
> I don't know that, but according to the spec, it is only set if there is
> exactly one recipient, which is bad. I sent a small patch to this list a
> while ago, replacing it with $recipients. Nobody seemed to care about
> it, though.

The whole point of $received_for is that it is included in the default
definition of Received:. Therefore, it cannot be set if there is more
than one recipient, because otherwise you may reveal bcc: recipients to
the other recipients, who are not supposed to know about them.

The *only* reason for the existence of $received_for is so that it can
be used in the value of received_header_text.

There is already a variable called $recipients, but it is set only in
situations (documented) where it is OK for all the recipients to be
know. Expansion of received_header_text is not one of those situations.



--
Philip Hazel University of Cambridge Computing Service
Get the Exim 4 book: http://www.uit.co.uk/exim-book

--
## List details at http://www.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
Re: [PATCH] spool_mbox cleanup [ In reply to ]
Quoting Philip Hazel:

> The *only* reason for the existence of $received_for is so that it can
> be used in the value of received_header_text.
>
> There is already a variable called $recipients, but it is set only in
> situations (documented) where it is OK for all the recipients to be
> know. Expansion of received_header_text is not one of those situations.

ok, but spool_mbox has nothing to with received headers, so I wonder why
Tom used received_for there, when $recipients is available and doing the
right thing.

--
## List details at http://www.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
Re: [PATCH] spool_mbox cleanup [ In reply to ]
Jakob Hirsch wrote:

> ok, but spool_mbox has nothing to with received headers, so I wonder why
> Tom used received_for there, when $recipients is available and doing the
> right thing.

SA can pull some information from Received: headers. Exim only adds its
own Received: header after all ACL processing, where it was too late for
SMTP-inline SA to pick it up. I "solved" the problem by adding a fake
"preliminary" Received: header to the mbox spool file. I don't remember
where I got the expansion template from, but I didn't invent it myself :)



--
## List details at http://www.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
Re: [PATCH] spool_mbox cleanup [ In reply to ]
Nico Erfurth wrote:

> Hmm, spool_mbox didn't add a Received: header, only the two mentioned
> X-Envelope-From: and X-Envelope-To:. But AFAICT and accordingly to
> anyone else, it isn't possible to add the X-Envelope-From as you tried
> to do it, as the needed information isn't there at this moment, unless
> we add the recipient-list. :)

Aaah sorry. I mixed this up with the Received: header mod I did in
receive.c :) Should read OP before posting. Cancel last message.

/tom

--
## List details at http://www.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
Re: [PATCH] spool_mbox cleanup [ In reply to ]
Quoting Tom Kistner:

>> ok, but spool_mbox has nothing to with received headers, so I wonder why
>> Tom used received_for there, when $recipients is available and doing the
>> right thing.
> SA can pull some information from Received: headers. Exim only adds its

There's some information in
http://wiki.apache.org/spamassassin/EnvelopeSenderInReceived (even
though it's mainly about envelope sender). This will not work if there
is more than one recipient, but SA also uses various headers, e.g.
X-Envelope-To, so this one should contain the full recipient list, I
think. Otherwise it's useless, because it contains the same information
as the Received header.



--
## List details at http://www.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
Re: [PATCH] spool_mbox cleanup [ In reply to ]
Tom Kistner wrote:

>> ok, but spool_mbox has nothing to with received headers, so I wonder why
>> Tom used received_for there, when $recipients is available and doing the
>> right thing.
>
> SA can pull some information from Received: headers. Exim only adds its
> own Received: header after all ACL processing, where it was too late for
> SMTP-inline SA to pick it up. I "solved" the problem by adding a fake
> "preliminary" Received: header to the mbox spool file. I don't remember
> where I got the expansion template from, but I didn't invent it myself :)

Hmm, spool_mbox didn't add a Received: header, only the two mentioned
X-Envelope-From: and X-Envelope-To:. But AFAICT and accordingly to
anyone else, it isn't possible to add the X-Envelope-From as you tried
to do it, as the needed information isn't there at this moment, unless
we add the recipient-list. :)

Nico


--
## List details at http://www.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
Re: [PATCH] spool_mbox cleanup [ In reply to ]
Quoting Nico Erfurth:

> X-Envelope-From: and X-Envelope-To:. But AFAICT and accordingly to
> anyone else, it isn't possible to add the X-Envelope-From as you tried
> to do it, as the needed information isn't there at this moment, unless
> we add the recipient-list. :)

Uh, now I'm confused (or is it you? :).
Envelope sender is there, so X-Envelope-From works.
Envelope recipients are also known, so X-Envelope-To could also work.
But $received_for (which is used currently) is not set, so the current
code does not work. If $recipients would be used instead (like I'm do
for more than 6 months now), it would work (just verified that in 4.63
with no_mbox_unspool).
Something I didn't get right?


--
## List details at http://www.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##
Re: [PATCH] spool_mbox cleanup [ In reply to ]
Jakob Hirsch wrote:
> Quoting Nico Erfurth:
>
>> X-Envelope-From: and X-Envelope-To:. But AFAICT and accordingly to
>> anyone else, it isn't possible to add the X-Envelope-From as you tried
>> to do it, as the needed information isn't there at this moment, unless
>> we add the recipient-list. :)
>
> Uh, now I'm confused (or is it you? :).

It's me :) Please forgive a old man ;)

Nico

--
## List details at http://www.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##