git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix error logged for send failure
[exim.git]
/
src
/
src
/
transports
/
smtp.c
diff --git
a/src/src/transports/smtp.c
b/src/src/transports/smtp.c
index 95bee582d104c2db141496ba4b1e5c346585d1c9..e177ee9c31d8b197a8b8146fa58d17234b420aae 100644
(file)
--- a/
src/src/transports/smtp.c
+++ b/
src/src/transports/smtp.c
@@
-2,7
+2,7
@@
* Exim - an Internet mail transport agent *
*************************************************/
* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) University of Cambridge 1995 - 201
6
*/
+/* Copyright (c) University of Cambridge 1995 - 201
7
*/
/* See the file NOTICE for conditions of use and distribution. */
#include "../exim.h"
/* See the file NOTICE for conditions of use and distribution. */
#include "../exim.h"
@@
-583,7
+583,8
@@
if (*errno_value == 0 || *errno_value == ECONNRESET)
*message = US string_sprintf("Remote host closed connection "
"in response to %s%s", pl, smtp_command);
}
*message = US string_sprintf("Remote host closed connection "
"in response to %s%s", pl, smtp_command);
}
-else *message = US string_sprintf("%s [%s]", host->name, host->address);
+else
+ *message = US string_sprintf("%s [%s]", host->name, host->address);
return FALSE;
}
return FALSE;
}
@@
-1453,9
+1454,7
@@
smtp_setup_conn(smtp_context * sx, BOOL suppress_tls)
dns_answer tlsa_dnsa;
#endif
BOOL pass_message = FALSE;
dns_answer tlsa_dnsa;
#endif
BOOL pass_message = FALSE;
-
uschar * message = NULL;
uschar * message = NULL;
-int save_errno;
int yield = OK;
int rc;
int yield = OK;
int rc;
@@
-1550,14
+1549,13
@@
if (continue_hostname == NULL)
if (sx->inblock.sock < 0)
{
uschar * msg = NULL;
if (sx->inblock.sock < 0)
{
uschar * msg = NULL;
- int save_errno = errno;
if (sx->verify)
{
msg = strerror(errno);
HDEBUG(D_verify) debug_printf("connect: %s\n", msg);
}
set_errno_nohost(sx->addrlist,
if (sx->verify)
{
msg = strerror(errno);
HDEBUG(D_verify) debug_printf("connect: %s\n", msg);
}
set_errno_nohost(sx->addrlist,
-
save_errno == ETIMEDOUT ? ERRNO_CONNECTTIMEOUT : save_
errno,
+
errno == ETIMEDOUT ? ERRNO_CONNECTTIMEOUT :
errno,
sx->verify ? string_sprintf("could not connect: %s", msg)
: NULL,
DEFER, FALSE);
sx->verify ? string_sprintf("could not connect: %s", msg)
: NULL,
DEFER, FALSE);
@@
-1774,12
+1772,8
@@
goto SEND_QUIT;
if (rsp != sx->buffer && rsp[0] == 0 && (errno == 0 || errno == ECONNRESET))
{
if (rsp != sx->buffer && rsp[0] == 0 && (errno == 0 || errno == ECONNRESET))
{
- sx->send_quit = FALSE;
- save_errno = ERRNO_SMTPCLOSED;
- message = string_sprintf("Remote host closed connection "
- "in response to %s (EHLO response was: %s)",
- smtp_command, sx->buffer);
- goto FAILED;
+ errno = ERRNO_SMTPCLOSED;
+ goto EHLOHELO_FAILED;
}
Ustrncpy(sx->buffer, rsp, sizeof(sx->buffer)/2);
goto RESPONSE_FAILED;
}
Ustrncpy(sx->buffer, rsp, sizeof(sx->buffer)/2);
goto RESPONSE_FAILED;
@@
-1858,6
+1852,7
@@
if ( smtp_peer_options & PEER_OFFERED_TLS
)
{
Ustrncpy(sx->buffer, buffer2, sizeof(sx->buffer));
)
{
Ustrncpy(sx->buffer, buffer2, sizeof(sx->buffer));
+ sx->buffer[sizeof(sx->buffer)-1] = '\0';
goto RESPONSE_FAILED;
}
}
goto RESPONSE_FAILED;
}
}
@@
-1886,7
+1881,7
@@
if ( smtp_peer_options & PEER_OFFERED_TLS
sx->host->name, sx->host->address);
# endif
sx->host->name, sx->host->address);
# endif
-
save_
errno = ERRNO_TLSFAILURE;
+ errno = ERRNO_TLSFAILURE;
message = US"failure while setting up TLS session";
sx->send_quit = FALSE;
goto TLS_FAILED;
message = US"failure while setting up TLS session";
sx->send_quit = FALSE;
goto TLS_FAILED;
@@
-1973,7
+1968,7
@@
else if ( sx->smtps
|| verify_check_given_host(&sx->ob->hosts_require_tls, sx->host) == OK
)
{
|| verify_check_given_host(&sx->ob->hosts_require_tls, sx->host) == OK
)
{
-
save_
errno = ERRNO_TLSREQUIRED;
+ errno = ERRNO_TLSREQUIRED;
message = string_sprintf("a TLS session is required, but %s",
smtp_peer_options & PEER_OFFERED_TLS
? "an attempt to start TLS failed" : "the server did not offer TLS support");
message = string_sprintf("a TLS session is required, but %s",
smtp_peer_options & PEER_OFFERED_TLS
? "an attempt to start TLS failed" : "the server did not offer TLS support");
@@
-2096,35
+2091,36
@@
return OK;
{
int code;
{
int code;
- uschar * set_message;
RESPONSE_FAILED:
RESPONSE_FAILED:
- {
- save_errno = errno;
message = NULL;
message = NULL;
- sx->send_quit = check_response(sx->host, &
save_
errno, sx->addrlist->more_errno,
+ sx->send_quit = check_response(sx->host, &errno, sx->addrlist->more_errno,
sx->buffer, &code, &message, &pass_message);
goto FAILED;
sx->buffer, &code, &message, &pass_message);
goto FAILED;
- }
SEND_FAILED:
SEND_FAILED:
- {
- save_errno = errno;
code = '4';
message = US string_sprintf("send() to %s [%s] failed: %s",
code = '4';
message = US string_sprintf("send() to %s [%s] failed: %s",
- sx->host->name, sx->host->address, strerror(
save_
errno));
+ sx->host->name, sx->host->address, strerror(errno));
sx->send_quit = FALSE;
goto FAILED;
sx->send_quit = FALSE;
goto FAILED;
- }
/* This label is jumped to directly when a TLS negotiation has failed,
or was not done for a host for which it is required. Values will be set
/* This label is jumped to directly when a TLS negotiation has failed,
or was not done for a host for which it is required. Values will be set
- in message and
save_
errno, and setting_up will always be true. Treat as
+ in message and errno, and setting_up will always be true. Treat as
a temporary error. */
a temporary error. */
+ EHLOHELO_FAILED:
+ code = '4';
+ message = string_sprintf("Remote host closed connection in response to %s"
+ " (EHLO response was: %s)", smtp_command, sx->buffer);
+ sx->send_quit = FALSE;
+ goto FAILED;
+
#ifdef SUPPORT_TLS
TLS_FAILED:
#ifdef SUPPORT_TLS
TLS_FAILED:
- code = '4';
+ code = '4';
+ goto FAILED;
#endif
/* The failure happened while setting up the call; see if the failure was
#endif
/* The failure happened while setting up the call; see if the failure was
@@
-2134,9
+2130,8
@@
return OK;
whatever), defer all addresses, and yield DEFER, so that the host is not
tried again for a while. */
whatever), defer all addresses, and yield DEFER, so that the host is not
tried again for a while. */
-
FAILED:
+FAILED:
sx->ok = FALSE; /* For when reached by GOTO */
sx->ok = FALSE; /* For when reached by GOTO */
- set_message = message;
yield = code == '5'
#ifdef SUPPORT_I18N
yield = code == '5'
#ifdef SUPPORT_I18N
@@
-2144,7
+2139,7
@@
return OK;
#endif
? FAIL : DEFER;
#endif
? FAIL : DEFER;
- set_errno(sx->addrlist,
save_errno, set_
message, yield, pass_message, sx->host
+ set_errno(sx->addrlist,
errno,
message, yield, pass_message, sx->host
#ifdef EXPERIMENTAL_DSN_INFO
, sx->smtp_greeting, sx->helo_response
#endif
#ifdef EXPERIMENTAL_DSN_INFO
, sx->smtp_greeting, sx->helo_response
#endif
@@
-3189,7
+3184,7
@@
if (sx.completed_addr && sx.ok && sx.send_quit)
if (! (sx.ok = smtp_write_command(&sx.outblock, FALSE, "RSET\r\n") >= 0))
{
msg = US string_sprintf("send() to %s [%s] failed: %s", host->name,
if (! (sx.ok = smtp_write_command(&sx.outblock, FALSE, "RSET\r\n") >= 0))
{
msg = US string_sprintf("send() to %s [%s] failed: %s", host->name,
- host->address, strerror(
save_
errno));
+ host->address, strerror(errno));
sx.send_quit = FALSE;
}
else if (! (sx.ok = smtp_read_response(&sx.inblock, sx.buffer,
sx.send_quit = FALSE;
}
else if (! (sx.ok = smtp_read_response(&sx.inblock, sx.buffer,