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
tidying
[exim.git]
/
src
/
src
/
smtp_out.c
diff --git
a/src/src/smtp_out.c
b/src/src/smtp_out.c
index ba6153ea9b9316a1d54a74b889ae3aace7aefb64..c4f32a0c2eea0482488d5baeb2d2040535c373a2 100644
(file)
--- a/
src/src/smtp_out.c
+++ b/
src/src/smtp_out.c
@@
-100,7
+100,7
@@
smtp_get_port(uschar *rstring, address_item *addr, int *port, uschar *msg)
{
uschar *pstring = expand_string(rstring);
{
uschar *pstring = expand_string(rstring);
-if (
pstring == NULL
)
+if (
!pstring
)
{
addr->transport_return = PANIC;
addr->message = string_sprintf("failed to expand \"%s\" (\"port\" option) "
{
addr->transport_return = PANIC;
addr->message = string_sprintf("failed to expand \"%s\" (\"port\" option) "
@@
-124,7
+124,7
@@
if (isdigit(*pstring))
else
{
struct servent *smtp_service = getservbyname(CS pstring, "tcp");
else
{
struct servent *smtp_service = getservbyname(CS pstring, "tcp");
- if (
smtp_service == NULL
)
+ if (
!smtp_service
)
{
addr->transport_return = PANIC;
addr->message = string_sprintf("TCP port \"%s\" is not defined for %s",
{
addr->transport_return = PANIC;
addr->message = string_sprintf("TCP port \"%s\" is not defined for %s",
@@
-319,23
+319,32
@@
pipelining.
Argument:
outblock the SMTP output block
Argument:
outblock the SMTP output block
+ mode more-expected, or plain
Returns: TRUE if OK, FALSE on error, with errno set
*/
static BOOL
Returns: TRUE if OK, FALSE on error, with errno set
*/
static BOOL
-flush_buffer(smtp_outblock *
outblock
)
+flush_buffer(smtp_outblock *
outblock, int mode
)
{
int rc;
int n = outblock->ptr - outblock->buffer;
{
int rc;
int n = outblock->ptr - outblock->buffer;
-HDEBUG(D_transport|D_acl) debug_printf_indent("cmd buf flush %d bytes\n", n);
+HDEBUG(D_transport|D_acl) debug_printf_indent("cmd buf flush %d bytes%s\n", n,
+ mode == SCMD_MORE ? " (more expected)" : "");
+
#ifdef SUPPORT_TLS
if (tls_out.active == outblock->sock)
rc = tls_write(FALSE, outblock->buffer, n);
else
#endif
#ifdef SUPPORT_TLS
if (tls_out.active == outblock->sock)
rc = tls_write(FALSE, outblock->buffer, n);
else
#endif
- rc = send(outblock->sock, outblock->buffer, n, 0);
+ rc = send(outblock->sock, outblock->buffer, n,
+#ifdef MSG_MORE
+ mode == SCMD_MORE ? MSG_MORE : 0
+#else
+ 0
+#endif
+ );
if (rc <= 0)
{
if (rc <= 0)
{
@@
-359,7
+368,7
@@
any error message.
Arguments:
outblock contains buffer for pipelining, and socket
Arguments:
outblock contains buffer for pipelining, and socket
- noflush if TRUE, save the command in the output buffer, for pipelining
+ mode buffer, write-with-more-likely, write
format a format, starting with one of
of HELO, MAIL FROM, RCPT TO, DATA, ".", or QUIT.
If NULL, flush pipeline buffer only.
format a format, starting with one of
of HELO, MAIL FROM, RCPT TO, DATA, ".", or QUIT.
If NULL, flush pipeline buffer only.
@@
-371,7
+380,7
@@
Returns: 0 if command added to pipelining buffer, with nothing transmitted
*/
int
*/
int
-smtp_write_command(smtp_outblock *
outblock, BOOL noflush
, const char *format, ...)
+smtp_write_command(smtp_outblock *
outblock, int mode
, const char *format, ...)
{
int count;
int rc = 0;
{
int count;
int rc = 0;
@@
-393,7
+402,7
@@
if (format)
if (count > outblock->buffersize - (outblock->ptr - outblock->buffer))
{
rc = outblock->cmd_count; /* flush resets */
if (count > outblock->buffersize - (outblock->ptr - outblock->buffer))
{
rc = outblock->cmd_count; /* flush resets */
- if (!flush_buffer(outblock)) return -1;
+ if (!flush_buffer(outblock
, SCMD_FLUSH
)) return -1;
}
Ustrncpy(CS outblock->ptr, big_buffer, count);
}
Ustrncpy(CS outblock->ptr, big_buffer, count);
@@
-423,10
+432,10
@@
if (format)
HDEBUG(D_transport|D_acl|D_v) debug_printf_indent(" SMTP>> %s\n", big_buffer);
}
HDEBUG(D_transport|D_acl|D_v) debug_printf_indent(" SMTP>> %s\n", big_buffer);
}
-if (
!noflush
)
+if (
mode != SCMD_BUFFER
)
{
rc += outblock->cmd_count; /* flush resets */
{
rc += outblock->cmd_count; /* flush resets */
- if (!flush_buffer(outblock)) return -1;
+ if (!flush_buffer(outblock
, mode
)) return -1;
}
return rc;
}
return rc;
@@
-500,8
+509,9
@@
for (;;)
if((rc = ip_recv(sock, inblock->buffer, inblock->buffersize, timeout)) <= 0)
{
if((rc = ip_recv(sock, inblock->buffer, inblock->buffersize, timeout)) <= 0)
{
- if (!errno)
- DEBUG(D_deliver|D_transport|D_acl) debug_printf_indent(" SMTP(closed)<<\n");
+ DEBUG(D_deliver|D_transport|D_acl)
+ debug_printf_indent(errno ? " SMTP(%s)<<\n" : " SMTP(closed)<<\n",
+ strerror(errno));
break;
}
break;
}