cleanup Adds From: Using Comment Syntax for GECOS Name.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

cleanup Adds From: Using Comment Syntax for GECOS Name.

Ralph Corderoy
Hi,

Using mail(1) here, it submits to sendmail(1) without including a From:
header.  cleanup(8) add that in cleanup_message.c's
cleanup_header_done_callback().

    quote_822_local(state->temp1, *state->sender ?
                    state->sender : MAIL_ADDR_MAIL_DAEMON);
    vstring_sprintf(state->temp2, "%sFrom: %s",
                    state->resent, vstring_str(state->temp1));
    if (*state->sender && state->fullname && *state->fullname) {
        vstring_sprintf(state->temp1, "(%s)", state->fullname);
        token = tok822_parse(vstring_str(state->temp1));
        vstring_strcat(state->temp2, " ");

Unfortunately, it adds it as a `comment', not a `display-name' in RFC
2822 parlance.

    https://www.ietf.org/rfc/rfc2822.txt
    3.4. Address Specification

    name-addr     =  [display-name] angle-addr
    display-name  =  phrase
    angle-addr    =  [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr
    CFWS          =  *([FWS] comment) (([FWS] comment) / FWS)
    comment       =  "(" *([FWS] ccontent) [FWS] ")"

    ...  Since the meaning of the information in a comment is
    unspecified, implementations SHOULD use the full name-addr form of
    the mailbox, instead of the legacy form, to specify the display name
    associated with a mailbox.

I end up with the first of these instead of the second.

    From: [hidden email] (Foo Bar)
    From: Foo Bar <[hidden email]>

This matters because the RFC points out that the comment should not be
interpreted, but because these headers are still being generated today,
deliberate RFC violations are being coded to match, e.g. Go's recently
altered its standard library's net/mail to pluck the name from a comment
in some cases.

Please consider having Postfix obey the RFC when generating From:, and
other relevant headers.

--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy
Reply | Threaded
Open this post in threaded view
|

Re: cleanup Adds From: Using Comment Syntax for GECOS Name.

Wietse Venema
Ralph Corderoy:
> Please consider having Postfix obey the RFC when generating From:, and
> other relevant headers.

Please submit mail with correct headers.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: cleanup Adds From: Using Comment Syntax for GECOS Name.

Ralph Corderoy
Hi Wietse,

> > Please consider having Postfix obey the RFC when generating From:,
> > and other relevant headers.
>
> Please submit mail with correct headers.

Please alter cleanup(8) to not make incorrect repairs thereby forcing
those MUAs you consider errant to fix their ways and supply those
correct headers!

Your email had

    From: [hidden email] (Wietse Venema)

I assume that was a deliberate pun?  :-)

--
Cheers, Ralph.
https://plus.google.com/+RalphCorderoy
Reply | Threaded
Open this post in threaded view
|

Re: cleanup Adds From: Using Comment Syntax for GECOS Name.

Wietse Venema
Ralph Corderoy:

> Hi Wietse,
>
> > > Please consider having Postfix obey the RFC when generating From:,
> > > and other relevant headers.
> >
> > Please submit mail with correct headers.
>
> Please alter cleanup(8) to not make incorrect repairs thereby forcing
> those MUAs you consider errant to fix their ways and supply those
> correct headers!

You're talking about a Sendmail compatibility feature from 20 years
ago. According to a contemporary Sendmail manual, the From: header
format was commonly defined as either "$?x$x <$g>$|$g$." or "g$?x
($x)$.", corresponding to the following two formats:

    Eric Allman <[hidden email]>
    [hidden email] (Eric Allman)

(that's a quote from sendmail 8.9.0 from 1998).

Your complaint illustrates that there are still programs that create
email without a From: header.

I suppose I will eventually change the code, but email header syntax
is delicate stuff.

> Your email had
>
>     From: [hidden email] (Wietse Venema)
>
> I assume that was a deliberate pun?  :-)

That must be part of an obsolete fake mail detection scheme. The
idea was that if I never send mail as ``From: name <address>'',
then all mail that contains that specific form is a fake.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: cleanup Adds From: Using Comment Syntax for GECOS Name.

Wietse Venema
Quick update: I've done a brain-dead simple, but correct, implementation
that always quotes the name (just like qmail, BTW). If needed, it
can be made smarter later.

There 's some draft documentation below.

        Wietse

header_from_format (default: standard)
       The format of the Postfix-generated From: header. By  default,  Postfix
       generates  this header only for clients that match the local_header_re-
       write_clients setting.

       This setting affects the appearance of email from programs that  submit
       messages  without  From:  header,  such  as some /bin/mail command-line
       implementations.

       Specify one of the following:

       standard (default)
              Produce a header formatted as From: "name" <address>.   This  is
              the default as of Postfix 3.3.

       legacy Produce  a header formatted as From: address (name). This is the
              behavior prior to Postfix 3.3.

       This feature is available in Postfix 3.3 and later.
Reply | Threaded
Open this post in threaded view
|

Re: cleanup Adds From: Using Comment Syntax for GECOS Name.

Emmanuel Fusté-2
Le 07/01/2018 à 02:49, Wietse Venema a écrit :

> Quick update: I've done a brain-dead simple, but correct, implementation
> that always quotes the name (just like qmail, BTW). If needed, it
> can be made smarter later.
>
> There 's some draft documentation below.
>
> Wietse
>
> header_from_format (default: standard)
>         The format of the Postfix-generated From: header. By  default,  Postfix
>         generates  this header only for clients that match the local_header_re-
>         write_clients setting.
>
>         This setting affects the appearance of email from programs that  submit
>         messages  without  From:  header,  such  as some /bin/mail command-line
>         implementations.
>
>         Specify one of the following:
>
>         standard (default)
>                Produce a header formatted as From: "name" <address>.   This  is
>                the default as of Postfix 3.3.
>
>         legacy Produce  a header formatted as From: address (name). This is the
>                behavior prior to Postfix 3.3.
>
>         This feature is available in Postfix 3.3 and later.
Hello,

As I've been hit by "local_header_rewrite_client" a lots of time because
of local content filter, could you consider to change the default of
"local_header_rewrite_client" from "permit_inet_interface" to "" for the
next compatibility_level bump too ?
As you previously note, by default we should today mandate sane MUA
behavior regarding From: header.

Emmanuel.
Reply | Threaded
Open this post in threaded view
|

Re: cleanup Adds From: Using Comment Syntax for GECOS Name.

Wietse Venema
Emmanuel Fust?:
> Hello,
>
> As I've been hit by "local_header_rewrite_client" a lots of time because
> of local content filter, could you consider to change the default of
> "local_header_rewrite_client" from "permit_inet_interface" to "" for the
> next compatibility_level bump too ?

Absolutely not. The more common case is that of a mail hub that
handles mail from internal clients. The less common case is that
of the after-filter MTA, which already requires special configuration
and that is where rewriting tweaks belong.

        Wietse