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.
*/
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)
{
to write to the filter, and in this process just suck from the filter and write
down the given fd. At the end, tidy up the pipes and the processes.
+XXX
Arguments: as for internal_transport_write_message() above
Returns: TRUE on success; FALSE (with errno) for any failure