-/* $Cambridge: exim/src/src/transport.c,v 1.5 2005/03/08 15:32:02 tom Exp $ */
+/* $Cambridge: exim/src/src/transport.c,v 1.8 2005/05/03 14:20:01 ph10 Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
same alias might share some of them) but we want to output them in the
opposite order. This is a bit tedious, but there shouldn't be very many
of them. We just walk the list twice, reversing the pointers each time,
- but on the second time, write out the items. */
+ but on the second time, write out the items.
+
+ Headers added to an address by a router are guaranteed to end with a newline.
+ */
if (addr != NULL)
{
/* If a string containing additional headers exists, expand it and write
out the result. This is done last so that if it (deliberately or accidentally)
isn't in header format, it won't mess up any other headers. An empty string
- or a forced expansion failure are noops. */
+ or a forced expansion failure are noops. An added header string from a
+ transport may not end with a newline; add one if it does not. */
if (add_headers != NULL)
{
if (s[len-1] != '\n' && !write_chunk(fd, US"\n", 1, use_crlf))
return FALSE;
DEBUG(D_transport)
- debug_printf("added header line(s):\n%s---\n", s);
+ {
+ debug_printf("added header line(s):\n%s", s);
+ if (s[len-1] != '\n') debug_printf("\n");
+ debug_printf("---\n");
+ }
}
}
}
signed message down the original fd (or TLS fd).
Arguments: as for internal_transport_write_message() above, with additional
- arguments:
+ arguments:
uschar *dk_private_key The private key to use (filename or plain data)
uschar *dk_domain Override domain (normally NULL)
uschar *dk_selector The selector to use.
int sread = 0;
int wwritten = 0;
uschar *dk_signature = NULL;
-
+
snprintf(CS dk_spool_name, 256, "%s/input/%s/%s-K",
spool_directory, message_subdir, message_id);
dk_fd = Uopen(dk_spool_name, O_RDWR|O_CREAT|O_EXCL, SPOOL_MODE);
save_errno = errno;
goto CLEANUP;
}
-
+
/* Call original function */
rc = transport_write_message(addr, dk_fd, options,
size_limit, add_headers, remove_headers,
check_string, escape_string, rewrite_rules,
rewrite_existflags);
-
+
/* Save error state. We must clean up before returning. */
if (!rc)
{
dk_domain,
dk_selector,
dk_canon);
-
+
if (dk_signature != NULL)
{
/* Send the signature first */
}
}
- /* Rewind file and send it down the original fd. */
+ /* Rewind file and send it down the original fd. */
lseek(dk_fd, 0, SEEK_SET);
-
+
while((sread = read(dk_fd,sbuf,2048)) > 0)
{
char *p = sbuf;
goto DK_WRITE;
}
}
-
+
if (sread == -1)
{
save_errno = errno;
int pfd[2];
pid_t filter_pid, write_pid;
+transport_filter_timed_out = FALSE;
+
/* If there is no filter command set up, call the internal function that does
the actual work, passing it the incoming fd, and return its result. */
if (sigalrm_seen)
{
errno = ETIMEDOUT;
+ transport_filter_timed_out = TRUE;
goto TIDY_UP;
}