Loading ...
Sorry, an error occurred while loading the content.

Re: PATCH: reporting MIME errors to content filter

Expand Messages
  • Wietse Venema
    ... This is not needed. Postfix should already report one MIME error to the SMTP client, as long as the message has no other reject errors.
    Message 1 of 4 , Jan 2, 2011
    • 0 Attachment
      Wietse Venema:
      > Ralf Hildebrandt:
      > > Today I encountered this on the python.org mailserver:
      > >
      > > Jan 2 14:49:54 albatross postfix/cleanup[5983]: 949B8EE99E: reject mime-error improper use of 8-bit data in message header: To: Alice Bevan?McGregor <alice@....com>, web-sig@... from localhost[127.0.0.1]; from=<pje@....com> to=<web-sig@...>
      > >
      > > which resulted in this:
      > >
      > > Jan 2 14:49:54 albatross postfix/smtpd[4866]: proxy-reject:
      > > END-OF-MESSAGE: 554 permanent error; from=<pje@....com>
      > > to=<web-sig@...> proto=ESMTP helo=<sparrow.telecommunity.com>
      > >
      > > In the bounce, pje only got the "554 permanent error" message.
      >
      > When the MIME processor was added to Postfix, there was no way to get
      > the error message back to the SMTP client.
      >
      > I suppose that the following patch brings Postfix MIME error
      > reporting up to the same level as reject messages from Postfix
      > header/body_checks.

      This is not needed. Postfix should already report one MIME error
      to the SMTP client, as long as the message has no other "reject"
      errors.

      > Wietse
      >
      > diff -cr /var/tmp/postfix-2.8-20110102/src/cleanup/cleanup_message.c src/cleanup/cleanup_message.c
      > *** /var/tmp/postfix-2.8-20110102/src/cleanup/cleanup_message.c Tue Jul 27 16:34:20 2010
      > --- src/cleanup/cleanup_message.c Sun Jan 2 17:00:13 2011
      > ***************
      > *** 880,885 ****
      > --- 880,886 ----
      > {
      > CLEANUP_STATE *state = (CLEANUP_STATE *) context;
      > const char *origin;
      > + const char *error_text;
      >
      > /*
      > * Message header too large errors are handled after the end of the
      > ***************
      > *** 889,897 ****
      > if ((origin = nvtable_find(state->attr, MAIL_ATTR_LOG_ORIGIN)) == 0)
      > origin = MAIL_ATTR_ORG_NONE;
      > #define TEXT_LEN (len < 100 ? (int) len : 100)
      > msg_info("%s: reject: mime-error %s: %.*s from %s; from=<%s> to=<%s>",
      > ! state->queue_id, mime_state_error(err_code), TEXT_LEN, text,
      > origin, state->sender, state->recip ? state->recip : "unknown");
      > }
      > }
      >
      > --- 890,901 ----
      > if ((origin = nvtable_find(state->attr, MAIL_ATTR_LOG_ORIGIN)) == 0)
      > origin = MAIL_ATTR_ORG_NONE;
      > #define TEXT_LEN (len < 100 ? (int) len : 100)
      > + error_text = mime_state_error(err_code);
      > msg_info("%s: reject: mime-error %s: %.*s from %s; from=<%s> to=<%s>",
      > ! state->queue_id, error_text, TEXT_LEN, text,
      > origin, state->sender, state->recip ? state->recip : "unknown");
      > + if (state->reason == 0)
      > + state->reason = dsn_prepend("5.7.1", error_text);
      > }
      > }
      >
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.