if ((len = chunk_ptr - deliver_out_buffer) > mlen)
{
+ DEBUG(D_transport) debug_printf("flushing headers buffer\n");
+
/* If CHUNKING, prefix with BDAT (size) NON-LAST. Also, reap responses
from previous SMTP commands. */
if (tctx && tctx->options & topt_use_bdat && tctx->chunk_cb)
- if (tctx->chunk_cb(fd, tctx, (unsigned)len, tc_reap_prev|tc_reap_one) != OK)
+ {
+ if ( tctx->chunk_cb(fd, tctx, (unsigned)len, 0) != OK
+ || !transport_write_block(fd, deliver_out_buffer, len)
+ || tctx->chunk_cb(fd, tctx, 0, tc_reap_prev) != OK
+ )
+ return FALSE;
+ }
+ else
+ if (!transport_write_block(fd, deliver_out_buffer, len))
return FALSE;
-
- if (!transport_write_block(fd, deliver_out_buffer, len))
- return FALSE;
chunk_ptr = deliver_out_buffer;
}
addr (chain of) addresses (for extra headers), or NULL;
only the first address is used
fd file descriptor to write the message to
+ tctx transport context
sendfn function for output (transport or verify)
- wck_flags
- use_crlf turn NL into CR LF
- use_bdat callback before chunk flush
- rewrite_rules chain of header rewriting rules
- rewrite_existflags flags for the rewriting rules
- chunk_cb transport callback function for data-chunk commands
Returns: TRUE on success; FALSE on failure.
*/
end_dot if TRUE, send a terminating "." line at the end
no_headers if TRUE, omit the headers
no_body if TRUE, omit the body
- size_limit if > 0, this is a limit to the size of message written;
+ check_string a string to check for at the start of lines, or NULL
+ escape_string a string to insert in front of any check string
+ size_limit if > 0, this is a limit to the size of message written;
it is used when returning messages to their senders,
and is approximate rather than exact, owing to chunk
buffering
- check_string a string to check for at the start of lines, or NULL
- escape_string a string to insert in front of any check string
Returns: TRUE on success; FALSE (with errno) on failure.
In addition, the global variable transport_count
return FALSE;
}
-/* When doing RFC3030 CHUNKING output, work out how much data will be in the
-last BDAT, consisting of the current write_chunk() output buffer fill
+/* When doing RFC3030 CHUNKING output, work out how much data would be in a
+last-BDAT, consisting of the current write_chunk() output buffer fill
(optimally, all of the headers - but it does not matter if we already had to
flush that buffer with non-last BDAT prependix) plus the amount of body data
-(as expanded for CRLF lines). Then create and write the BDAT, and ensure
+(as expanded for CRLF lines). Then create and write BDAT(s), and ensure
that further use of write_chunk() will not prepend BDATs.
The first BDAT written will also first flush any outstanding MAIL and RCPT
commands which were buffered thans to PIPELINING.
if (size > DELIVER_OUT_BUFFER_SIZE && hsize > 0)
{
+ DEBUG(D_transport)
+ debug_printf("sending small initial BDAT; hssize=%d\n", hsize);
if ( tctx->chunk_cb(fd, tctx, hsize, 0) != OK
|| !transport_write_block(fd, deliver_out_buffer, hsize)
|| tctx->chunk_cb(fd, tctx, 0, tc_reap_prev) != OK
goto CLEANUP;
}
-/* Call original function to write the -K file; does the CRLF expansion */
+/* Call original function to write the -K file; does the CRLF expansion
+(but, in the CHUNKING case, not dot-stuffing and dot-termination). */
options = tctx->options;
tctx->options &= ~topt_use_bdat;
}
/* Rewind file and feed it to the goats^W DKIM lib */
+dkim->dot_stuffed = !!(options & topt_end_dot);
lseek(dkim_fd, 0, SEEK_SET);
-dkim_signature = dkim_exim_sign(dkim_fd,
- dkim->dkim_private_key,
- dkim->dkim_domain,
- dkim->dkim_selector,
- dkim->dkim_canon,
- dkim->dkim_sign_headers);
-if (dkim_signature)
+if ((dkim_signature = dkim_exim_sign(dkim_fd, dkim)))
siglen = Ustrlen(dkim_signature);
else if (dkim->dkim_strict)
{
if ((pid = fork()) == 0)
{
- int i = 16;
+ int i = 17;
const uschar **argv;
/* Disconnect entirely from the parent process. If we are running in the
argv = CUSS child_exec_exim(CEE_RETURN_ARGV, TRUE, &i, FALSE, 0);
- if (smtp_use_dsn) argv[i++] = US"-MCD";
-
if (smtp_authenticated) argv[i++] = US"-MCA";
- #ifdef SUPPORT_TLS
- if (tls_offered) argv[i++] = US"-MCT";
- #endif
-
- if (smtp_use_size) argv[i++] = US"-MCS";
- if (smtp_use_pipelining) argv[i++] = US"-MCP";
+ if (smtp_peer_options & PEER_OFFERED_CHUNKING) argv[i++] = US"-MCK";
+ if (smtp_peer_options & PEER_OFFERED_DSN) argv[i++] = US"-MCD";
+ if (smtp_peer_options & PEER_OFFERED_PIPE) argv[i++] = US"-MCP";
+ if (smtp_peer_options & PEER_OFFERED_SIZE) argv[i++] = US"-MCS";
+#ifdef SUPPORT_TLS
+ if (smtp_peer_options & PEER_OFFERED_TLS) argv[i++] = US"-MCT";
+#endif
if (queue_run_pid != (pid_t)0)
{