[exim-dev] SMTP transport bounce message handling

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Brent Jones
Date:  
À: exim-dev
Sujet: [exim-dev] SMTP transport bounce message handling
Hello Exim s/users/devs/g,

I posted this to the exim-users list, but after reading some of the
transports/smtp.c code, it seems like I may need the assistance from a
developer.

My original question is below, but I will expand on what I am looking
to accomplish.
Essentially, we have a requirement to deliver to a non-defined list of
servers strictly through TLS. When I say non-defined, the requirement
is user driven.
Based on headers, subject, or arbitrary data, we have a router that
will pass the message onto a special transport to require TLS delivery
for the message.
That in itself isn't a problem. But when looking at error handling, we
would prefer an instant fail if the recipient server cannot perform
TLS connections.

Currently, the code will defer the message, which is normally fine,
but not for our requirement.
I found in transports/smtp.c:

#ifdef SUPPORT_TLS
TLS_FAILED:
code = '4';
#endif

We have since added a new handler:

#ifdef SUPPORT_TLS
TLSREQ_FAILED:
code = '5';
#endif

However, that failure doesn't generate a very descriptive bounce. It
seems Exim normally include the response of the server as part of a
5xx bounce message, but since the host doesn't advertise TLS, the
transport currently just fails the message with no additional data for
the user to determine why it failed.
I am trying to find a way to add additional data to the bounce. The
log files get descriptive failure information, from this section:

  save_errno = ERRNO_TLSREQUIRED;
  message = string_sprintf("a TLS session is required for %s [%s], but %s",
    host->name, host->address,
    tls_offered? "an attempt to start TLS failed" :
                 "the server did not offer TLS support");
  pass = string_sprintf("a TLS session is required for %s [%s], but %s",
    host->name, host->address,
    tls_offered? "an attempt to start TLS failed" :
                 "the server did not offer TLS support");


goto TLSREQ_FAILED;

But that message does not get included with the bounce, which I would
like it to be included.

Would there be a way to pass that information to the bounce message?


-----
Original question:

I was wondering if is possible to reference a custom error message for
a transport.
I would like certain transports to be more descriptive as to why a
message was delayed, such as a transport that requires TLS. If the
sending server doesn't offer TLS, I would like to inform the user of
the nature of the warning or permanent error.

I looked at deliver.c, but notice only two blocks for generating
errors and warnings, which appear to be global.

Any thoughts?

--
Brent Jones
brent@???