Logging: avoid claiming a host was used for an addr, when conn refused under TFO
[exim.git] / src / src / transports / smtp.c
index 606c646fb85f06eb965ecb65c43de8e2f7d6a87a..6ce4c9ded56fbda4efaa6830e36d50626a90d4a1 100644 (file)
@@ -590,6 +590,10 @@ 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++;
@@ -2125,15 +2129,9 @@ if (!continue_hostname)
     {
     if ((sx->cctx.sock = smtp_connect(&sx->conn_args, NULL)) < 0)
       {
-      uschar * msg = NULL;
-      if (sx->verify)
-       {
-       msg = US strerror(errno);
-       HDEBUG(D_verify) debug_printf("connect: %s\n", msg);
-       }
       set_errno_nohost(sx->addrlist,
        errno == ETIMEDOUT ? ERRNO_CONNECTTIMEOUT : errno,
-       sx->verify ? msg : NULL,
+       sx->verify ? US strerror(errno) : NULL,
        DEFER, FALSE);
       sx->send_quit = FALSE;
       return DEFER;
@@ -2903,7 +2901,8 @@ FAILED:
                        || errno == ERRNO_UTF8_FWD
 #endif
            ? FAIL : DEFER,
-           pass_message, sx->conn_args.host
+           pass_message,
+           errno == ECONNREFUSED ? NULL : sx->conn_args.host
 #ifdef EXPERIMENTAL_DSN_INFO
            , sx->smtp_greeting, sx->helo_response
 #endif