Index: [thread] [date] [author] [stats]
  From: markus schnalke <meillo@marmaro.de>
  To  : <masqmail@marmaro.de>
  Date: Thu, 24 Jun 2010 11:53:54 +0200

Behavior with no recipient headers

Hoi,

I discovered this bug: masqmail inserts a To: header with the sender's
address when you call masqmail from the command line and don't supply
any recipient headers (To:, Cc:, Bcc:).

I digged into the code (mainly accept_message_prepare() in accept.c)
and investigated related situations. The result is: there is some
strange behavior of masqmail in several such corner-case situations.

I feel the wish to document them down here.

In all examples: Alice sends to Bob. The hostname of localhost is
`dream'. These values were substituted by me.


Situation 1
-----------

Message directly on stdin:

    $ masqmail bob@localhost
    foo
    .

leads to:

    From mail  Thu Jun 24 11:01:09 2010
    Envelope-to: <bob@localhost>
    Return-path: <alice@dream>
    Received: from alice by dream with local (masqmail 0.2.23) id
     1ORiJ3-4kn-00 for <bob@localhost>; Thu, 24 Jun 2010 11:01:09 +0200
    From: <alice@dream>
 -> To: <alice@dream>
    Date: Thu, 24 Jun 2010 11:01:09 +0200
    Message-ID: <1ORiJ3-4kn-00@dream>
    
    foo

The value of the To: header is a bug, which will be solved in 0.2.25.


For comparation, postfix creates:

    From alice  Thu Jun 24 11:05:47 2010
    Return-path: <alice@dream>
    [...]
    Message-Id: <20100624090527.ACE8325C@dream>
    Date: Thu, 24 Jun 2010 11:05:25 +0200 (CEST)
    From: alice@dream
 -> To: undisclosed-recipients:;
    Envelope-to: bob@localhost
    Subject: 
    
    foo



Situation 2
-----------

SMTP dialog on stdin:

    $ masqmail -bs
    220 dream MasqMail 0.2.23 ESMTP
    ehlo
    250-dream Nice to meet you with ESMTP
    250-PIPELINING
    250 HELP
    mail from: alice@localhost
    250 OK alice@localhost is a nice guy.
    rcpt to: bob@localhost
    250 OK bob@localhost is our friend.
    data
    354 okay, and do not forget the dot
    foo
    .
    250 OK id=1ORh64-0zQ-00
    quit
    221 goodbye

leads to:

    From mail  Thu Jun 24 09:43:40 2010
    Envelope-to: <bob@localhost>
    Return-path: <alice@localhost>
    Received: from root by dream with esmtp (masqmail 0.2.23) id
     1ORh64-0zQ-00 for <bob@localhost>; Thu, 24 Jun 2010 09:43:40 +0200
    From: <alice@localhost>
    Date: Thu, 24 Jun 2010 09:43:40 +0200
    Message-ID: <1ORh64-0zQ-00@dream>
    
    foo

This message is invalid according to RFC822, because it doesn't
include any recipient header. (See end of mail.)

For comparision, postfix creates:

    From alice  Thu Jun 24 11:19:01 2010
    Return-path: <alice@dream>
    [...]
    Message-Id: <20100624091844.BD65A2277@dream>
    Date: Thu, 24 Jun 2010 11:18:34 +0200 (CEST)
    From: alice@dream
 -> To: undisclosed-recipients:;
    Envelope-to: bob@localhost
    
    foo



Situation 3
-----------

SMTP dialog at port 25.

    $ telnet localhost 25 
    Trying 127.0.0.1...
    Connected to localhost.localdomain.
    Escape character is '^]'.
    220 dream MasqMail 0.2.23 ESMTP
    ehlo
    250-dream Nice to meet you with ESMTP
    250-PIPELINING
    250 HELP
    mail from: alice@localhost
    250 OK alice@localhost is a nice guy.
    rcpt to: bob@localhost
    250 OK bob@localhost is our friend.
    data
    354 okay, and do not forget the dot
    foo
    .
    250 OK id=1ORhAb-1Da-00
    quit
    221 goodbye
    Connection closed by foreign host.

leads to:

    From mail  Thu Jun 24 09:48:21 2010
    Envelope-to: <bob@localhost>
    Return-path: <alice@localhost>
    Received: from 127.0.0.1 (ident=unknown) by dream with esmtp (masqmail
     0.2.23) id 1ORhAb-1Da-00 for <bob@localhost>; Thu, 24 Jun 2010
     09:48:21 +0200
    From: <alice@localhost>
    Date: Thu, 24 Jun 2010 09:48:21 +0200
    Message-ID: <1ORhAb-1Da-00@dream>
    
    foo

Again, no recpipient header.

For comparision, postfix creates:

    From alice  Thu Jun 24 11:25:13 2010
    Return-path: <alice@dream>
    Delivery-date: Thu, 24 Jun 2010 11:24:59 +0200
    [...]
    Message-Id: <20100624092443.47B0C25C@dream>
    Date: Thu, 24 Jun 2010 11:24:36 +0200 (CEST)
    From: alice@dream
 -> To: undisclosed-recipients:;
    Envelope-to: bob@localhost
    
    foo



RFC822 says:

     A.3.  COMPLETE HEADERS

     A.3.1.  Minimum required

     Date:     26 Aug 76 1429 EDT        Date:     26 Aug 76 1429 EDT
     From:     Jones@Registry.Org   or   From:     Jones@Registry.Org
     Bcc:                                To:       Smith@Registry.Org

        Note that the "Bcc" field may be empty, while the  "To"  field
        is required to have at least one address.

It doesn't talk about ``Undisclosed recipients''.


RFC2822 says:


    Finally, since a "Bcc:" field may contain no addresses, a "Bcc:"
    field can be sent without any addresses indicating to the
    recipients that blind copies were sent to someone.

and

    A.1.3. Group addresses

    ----
    From: Pete <pete@silly.example>
    To: A Group:Chris Jones <c@a.test>,joe@where.test,John
    <jdoe@one.test>;
    Cc: Undisclosed recipients:;
    Date: Thu, 13 Feb 1969 23:32:54 -0330
    Message-ID: <testabcd.1234@silly.example>

    Testing.
    ----

       In this message, the "To:" field has a single group recipient named A
       Group which contains 3 addresses, and a "Cc:" field with an empty
       group recipient named Undisclosed recipients.



And finally, sendmail. It lets the admin decide what to do when no
repipient headers are given. See ``NoRecipientAction'' in man page of
sendmail(8). The possible values of this option (parenthesed
annotations by me, based on exim(8) man page and my research):

- none:  leaves the message unchanged (exim does this and masqmail in
         SMTP mode)

- add-to:  adds a To: header with the envelope recipients (masqmail
           wanted to do this, but the implementation is broken)

- add-apparently-to:  adds an Apparently-To: header with the
                      envelope recipients (see:
http://www.iana.org/assignments/message-headers/prov/apparently-to )

- add-bcc:  adds an empty Bcc: header (described in RFC822. masqmail
	    does this when called with -t and only Bcc: headers are
            present.)

- add-to-undisclosed:  adds a header reading `To: undisclosed-recipients:;'.
		       (postfix does this, qmail does something
                       similar)


I think it would be best if masqmail would follow postfix approach and
always would choose the ``add-to-undisclosed'' option.


I'll change this soon if no complaints show up.


meillo


Index: [thread] [date] [author] [stats]