LMTP delivery and DSN action value for "success"

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

LMTP delivery and DSN action value for "success"

Michel Sébastien
Hi all.
I use LMTP transport to deliver mails into Cyrus and when asking DSN success I got an action "relayed".
I think LMTP is a final transport like local and virtual mailbox, but the DSN action value for both is "delivered".
This should be "delivered" too for LMTP transport ?

See example below :

Your message was successfully delivered to the destination(s)
listed below. If the message was delivered to mailbox you will
receive no further notifications. Otherwise you may still receive
notifications of mail delivery errors from other systems.

                   The mail system

<[hidden email]>: delivery via virtual: delivered to maildir

<[hidden email]>: delivery via
    127.0.0.1[127.0.0.1]:2003: 250 2.1.5 Ok: Stored

<[hidden email]>: delivery via local: delivered to mailbox

--835751710F.1234450008/smtp.localhost.net
Content-Description: Delivery report
Content-Type: message/delivery-status

Reporting-MTA: dns; smtp.localhost.net
Original-Envelope-Id: "id0001"
X-Postfix-Queue-ID: 835751710F
X-Postfix-Sender: rfc822; [hidden email]
Arrival-Date: Thu, 12 Feb 2009 14:46:46 +0000 (UTC)

Final-Recipient: rfc822; [hidden email]
Action: delivered
Status: 2.0.0
Diagnostic-Code: X-Postfix; delivery via virtual: delivered to maildir

Final-Recipient: rfc822; [hidden email]
Action: relayed
Status: 2.1.5
Remote-MTA: dns; 127.0.0.1
Diagnostic-Code: smtp; 250 2.1.5 Ok: Stored

Final-Recipient: rfc822; [hidden email]
Action: delivered
Status: 2.0.0
Diagnostic-Code: X-Postfix; delivery via local: delivered to mailbox

---
Below a patch (postfix 2.5.6) to change LMTP Action value from "relayed" to "delivered"


*** src/smtp/smtp_rcpt.c        2006-01-07 21:16:40.000000000 +0000
--- src/smtp/smtp_rcpt.c.1      2009-02-12 17:32:42.000000000 +0000
***************
*** 144,150 ****
      if (session->features & SMTP_FEATURE_DSN)
        rcpt->dsn_notify &= ~DSN_NOTIFY_SUCCESS;

!     dsb_update(why, resp->dsn, "relayed", DSB_MTYPE_DNS, session->host,
               DSB_DTYPE_SMTP, resp->str, "%s", resp->str);

      status = sent(DEL_REQ_TRACE_FLAGS(request->flags),
--- 144,151 ----
      if (session->features & SMTP_FEATURE_DSN)
        rcpt->dsn_notify &= ~DSN_NOTIFY_SUCCESS;

!     dsb_update(why, resp->dsn, (state->misc_flags & SMTP_MISC_FLAG_USE_LMTP) ? "delivered" : "relayed",
!              DSB_MTYPE_DNS, session->host,
               DSB_DTYPE_SMTP, resp->str, "%s", resp->str);

      status = sent(DEL_REQ_TRACE_FLAGS(request->flags),


thanks,
Sébastien


Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité du groupe Atos Origin ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis.

This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.

Reply | Threaded
Open this post in threaded view
|

RE: LMTP delivery and DSN action value for "success"

Michel Sébastien
>> Hi all.
>> I use LMTP transport to deliver mails into Cyrus and when asking
>> DSN success I got an action "relayed".

> Besides final delivery, LMTP is also used to deliver mail into
> content filters.  The advantage of LMTP is that the protocol reports
> one end-of-message status for each recipient.
I didn't kown this usage


> - If the LMTP server announces DSN support then we know for sure
> that it is not doing final delivery.

> - If the LMTP server does not announce DSN support, then either it
> does final delivery, or it is poorly-implemented content filter.

> In terms of code, this would look like:
thanks, I tested successfully this approach, see below the resulting patch :

diff -crB postfix-2.5.6/src/global/mail_params.h postfix-2.5.6-dsn/src/global/mail_params.h
*** postfix-2.5.6/src/global/mail_params.h      2008-07-27 19:10:27.000000000 +0000
--- postfix-2.5.6-dsn/src/global/mail_params.h  2009-02-23 09:07:29.000000000 +0000
***************
*** 1046,1051 ****
--- 1046,1055 ----
  #define DEF_LMTP_PIX_DELAY    "10s"
  extern int var_smtp_pix_delay;

+ #define VAR_LMTP_ASSUME_FINAL "lmtp_assume_final"
+ #define DEF_LMTP_ASSUME_FINAL 0
+ extern bool var_lmtp_assume_final;
+
   /*
    * Courageous people may want to turn off PIX bug workarounds.
    */
diff -crB postfix-2.5.6/src/smtp/lmtp_params.c postfix-2.5.6-dsn/src/smtp/lmtp_params.c
*** postfix-2.5.6/src/smtp/lmtp_params.c        2008-01-14 20:42:07.000000000 +0000
--- postfix-2.5.6-dsn/src/smtp/lmtp_params.c    2009-02-23 10:28:42.000000000 +0000
***************
*** 101,105 ****
--- 101,106 ----
        VAR_LMTP_SENDER_AUTH, DEF_LMTP_SENDER_AUTH, &var_smtp_sender_auth,
        VAR_LMTP_CNAME_OVERR, DEF_LMTP_CNAME_OVERR, &var_smtp_cname_overr,
        VAR_LMTP_SASL_AUTH_SOFT_BOUNCE, DEF_LMTP_SASL_AUTH_SOFT_BOUNCE, &var_smtp_sasl_auth_soft_bounce,
+       VAR_LMTP_ASSUME_FINAL, DEF_LMTP_ASSUME_FINAL, &var_lmtp_assume_final,
        0,
      };
diff -crB postfix-2.5.6/src/smtp/smtp.c postfix-2.5.6-dsn/src/smtp/smtp.c
*** postfix-2.5.6/src/smtp/smtp.c       2008-01-15 00:41:46.000000000 +0000
--- postfix-2.5.6-dsn/src/smtp/smtp.c   2009-02-23 13:57:37.000000000 +0000
***************
*** 571,576 ****
--- 571,582 ----
  /* .IP "\fBsmtp_fallback_relay ($fallback_relay)\fR"
  /*    Optional list of relay hosts for SMTP destinations that can't be
  /*    found or that are unreachable.
+ /* .PP
+ /*      Available with Postfix 2.5 and later:
+ /* .IP "\fBlmtp_assume_final (no)\fR"
+ /*      Set LMTP transport as final delivery for DSN extension, so action
+ /*      value is "delivered" instead of "relayed" for SUCCESS notification.
+ /* .PP
  /* SEE ALSO
  /*    generic(5), output address rewriting
  /*    header_checks(5), message header content inspection
***************
*** 761,766 ****
--- 767,773 ----
  char   *var_smtp_mime_chks;
  char   *var_smtp_nest_chks;
  char   *var_smtp_body_chks;
+ bool  var_lmtp_assume_final;

   /* Special handling of 535 AUTH errors. */
  char   *var_smtp_sasl_auth_cache_name;
diff -crB postfix-2.5.6/src/smtp/smtp_rcpt.c postfix-2.5.6-dsn/src/smtp/smtp_rcpt.c
*** postfix-2.5.6/src/smtp/smtp_rcpt.c  2006-01-07 21:16:40.000000000 +0000
--- postfix-2.5.6-dsn/src/smtp/smtp_rcpt.c      2009-02-23 11:04:56.000000000 +0000
***************
*** 116,121 ****
--- 116,122 ----

  /* Global library. */

+ #include <mail_params.h>
  #include <deliver_request.h>          /* smtp_rcpt_done */
  #include <deliver_completed.h>                /* smtp_rcpt_done */
  #include <sent.h>                     /* smtp_rcpt_done */
***************
*** 141,151 ****
       *
       * Note: the DSN action is ignored in case of address probes.
       */
!     if (session->features & SMTP_FEATURE_DSN)
!       rcpt->dsn_notify &= ~DSN_NOTIFY_SUCCESS;

-     dsb_update(why, resp->dsn, "relayed", DSB_MTYPE_DNS, session->host,
-              DSB_DTYPE_SMTP, resp->str, "%s", resp->str);

      status = sent(DEL_REQ_TRACE_FLAGS(request->flags),
                  request->queue_id, &request->msg_stats, rcpt,
--- 142,162 ----
       *
       * Note: the DSN action is ignored in case of address probes.
       */
!     if (session->features & SMTP_FEATURE_DSN) {
!         /* delivery via pass-through content filter */
!         rcpt->dsn_notify &= ~DSN_NOTIFY_SUCCESS;
!         dsb_update(why, resp->dsn, "relayed", DSB_MTYPE_DNS, session->host,
!                    DSB_DTYPE_SMTP, resp->str, "%s", resp->str);
!     } else if (var_lmtp_assume_final == 0) {
!         /* backwards compatible */
!         dsb_update(why, resp->dsn, "relayed", DSB_MTYPE_DNS, session->host,
!                    DSB_DTYPE_SMTP, resp->str, "%s", resp->str);
!     } else {
!         /* assume final delivery */
!         dsb_update(why, resp->dsn, "delivered", DSB_MTYPE_DNS, session->host,
!                    DSB_DTYPE_SMTP, resp->str, "%s", resp->str);
!     }


      status = sent(DEL_REQ_TRACE_FLAGS(request->flags),
                  request->queue_id, &request->msg_stats, rcpt,




Ce message et les pièces jointes sont confidentiels et réservés à l'usage exclusif de ses destinataires. Il peut également être protégé par le secret professionnel. Si vous recevez ce message par erreur, merci d'en avertir immédiatement l'expéditeur et de le détruire. L'intégrité du message ne pouvant être assurée sur Internet, la responsabilité du groupe Atos Origin ne pourra être recherchée quant au contenu de ce message. Bien que les meilleurs efforts soient faits pour maintenir cette transmission exempte de tout virus, l'expéditeur ne donne aucune garantie à cet égard et sa responsabilité ne saurait être recherchée pour tout dommage résultant d'un virus transmis.

This e-mail and the documents attached are confidential and intended solely for the addressee; it may also be privileged. If you receive this e-mail in error, please notify the sender immediately and destroy it. As its integrity cannot be secured on the Internet, the Atos Origin group liability cannot be triggered for the message content. Although the sender endeavours to maintain a computer virus-free network, the sender does not warrant that this transmission is virus-free and will not be liable for any damages resulting from any virus transmitted.