diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/src/smtp_out.c | 2 | ||||
-rw-r--r-- | src/src/transports/smtp.c | 27 |
2 files changed, 24 insertions, 5 deletions
diff --git a/src/src/smtp_out.c b/src/src/smtp_out.c index d8cb42e01..ea052b58a 100644 --- a/src/src/smtp_out.c +++ b/src/src/smtp_out.c @@ -641,7 +641,7 @@ for (;;) if((rc = ip_recv(cctx, inblock->buffer, inblock->buffersize, timeout)) <= 0) { - DEBUG(D_deliver|D_transport|D_acl) + DEBUG(D_deliver|D_transport|D_acl|D_v) debug_printf_indent(errno ? " SMTP(%s)<<\n" : " SMTP(closed)<<\n", strerror(errno)); break; diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index 6ce4c9ded..94c1fe40c 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -590,10 +590,6 @@ switch(*errno_value) transport_count); return FALSE; - case ECONNREFUSED: /* First-read error on a TFO conn */ - if (verify_mode) *message = US strerror(*errno_value); - return FALSE; /* nonverify, do not set message */ - case ERRNO_SMTPFORMAT: /* Handle malformed SMTP response */ s = string_printing(buffer); while (isspace(*s)) s++; @@ -2844,6 +2840,29 @@ return OK; int code; RESPONSE_FAILED: + if (errno == ECONNREFUSED) /* first-read error on a TFO conn */ + { + /* There is a testing facility for simulating a connection timeout, as I + can't think of any other way of doing this. It converts a connection + refused into a timeout if the timeout is set to 999999. This is done for + a 3whs connection in ip_connect(), but a TFO connection does not error + there - instead it gets ECONNREFUSED on the first data read. Tracking + that a TFO really was done is too hard, or we would set a + sx->pending_conn_done bit and test that in smtp_reap_banner() and + smtp_reap_ehlo(). That would let us also add the conn-timeout to the + cmd-timeout. */ + + if (f.running_in_test_harness && ob->connect_timeout == 999999) + errno = ETIMEDOUT; + set_errno_nohost(sx->addrlist, + errno == ETIMEDOUT ? ERRNO_CONNECTTIMEOUT : errno, + sx->verify ? US strerror(errno) : NULL, + DEFER, FALSE); + sx->send_quit = FALSE; + return DEFER; + } + + /* really an error on an SMTP read */ message = NULL; sx->send_quit = check_response(sx->conn_args.host, &errno, sx->addrlist->more_errno, sx->buffer, &code, &message, &pass_message); |