X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/7d758a6a6842fac6c511039c29d76300e2e21ccd..d185889f47b9b27088e777f7d382295c51271586:/src/src/transport.c diff --git a/src/src/transport.c b/src/src/transport.c index 5bcf8c1ae..49ea29e0a 100644 --- a/src/src/transport.c +++ b/src/src/transport.c @@ -11,25 +11,6 @@ transports. */ #include "exim.h" -/* Structure for keeping list of addresses that have been added to -Envelope-To:, in order to avoid duplication. */ - -struct aci { - struct aci *next; - address_item *ptr; - }; - - -/* Static data for write_chunk() */ - -static uschar *chunk_ptr; /* chunk pointer */ -static uschar *nl_check; /* string to look for at line start */ -static int nl_check_length; /* length of same */ -static uschar *nl_escape; /* string to insert */ -static int nl_escape_length; /* length of same */ -static int nl_partial_match; /* length matched at chunk end */ - - /* Generic options for transports, all of which live inside transport_instance data blocks and which therefore have the opt_public flag set. Note that there are other options living inside this structure which can be set only from @@ -106,21 +87,47 @@ optionlist optionlist_transports[] = { int optionlist_transports_size = nelem(optionlist_transports); +#ifdef MACRO_PREDEF + +# include "macro_predef.h" void -readconf_options_transports(void) +options_transports(void) { struct transport_info * ti; +uschar buf[64]; -readconf_options_from_list(optionlist_transports, nelem(optionlist_transports), US"TRANSPORTS", NULL); +options_from_list(optionlist_transports, nelem(optionlist_transports), US"TRANSPORTS", NULL); for (ti = transports_available; ti->driver_name[0]; ti++) { - macro_create(string_sprintf("_DRIVER_TRANSPORT_%T", ti->driver_name), US"y", FALSE, TRUE); - readconf_options_from_list(ti->options, (unsigned)*ti->options_count, US"TRANSPORT", ti->driver_name); + snprintf(buf, sizeof(buf), "_DRIVER_TRANSPORT_%T", ti->driver_name); + builtin_macro_create(buf); + options_from_list(ti->options, (unsigned)*ti->options_count, US"TRANSPORT", ti->driver_name); } } +#else /*!MACRO_PREDEF*/ + +/* Structure for keeping list of addresses that have been added to +Envelope-To:, in order to avoid duplication. */ + +struct aci { + struct aci *next; + address_item *ptr; + }; + + +/* Static data for write_chunk() */ + +static uschar *chunk_ptr; /* chunk pointer */ +static uschar *nl_check; /* string to look for at line start */ +static int nl_check_length; /* length of same */ +static uschar *nl_escape; /* string to insert */ +static int nl_escape_length; /* length of same */ +static int nl_partial_match; /* length matched at chunk end */ + + /************************************************* * Initialize transport list * *************************************************/ @@ -203,6 +210,7 @@ Arguments: tctx transport context: file descriptor or string to write to block block of bytes to write len number of bytes to write + more further data expected soon Returns: TRUE on success, FALSE on failure (with errno preserved); transport_count is incremented by the number of bytes written @@ -233,7 +241,7 @@ for (i = 0; i < 100; i++) { rc = #ifdef SUPPORT_TLS - (tls_out.active == fd) ? tls_write(FALSE, block, len) : + tls_out.active == fd ? tls_write(FALSE, block, len, more) : #endif #ifdef MSG_MORE more ? send(fd, block, len, MSG_MORE) : @@ -250,7 +258,7 @@ for (i = 0; i < 100; i++) rc = #ifdef SUPPORT_TLS - (tls_out.active == fd) ? tls_write(FALSE, block, len) : + tls_out.active == fd ? tls_write(FALSE, block, len, more) : #endif #ifdef MSG_MORE more ? send(fd, block, len, MSG_MORE) : @@ -968,9 +976,11 @@ if (!(tctx->options & topt_no_headers)) if (tctx->options & topt_add_delivery_date) { - uschar buffer[100]; - int n = sprintf(CS buffer, "Delivery-date: %s\n", tod_stamp(tod_full)); - if (!write_chunk(tctx, buffer, n)) goto bad; + uschar * s = tod_stamp(tod_full); + + if ( !write_chunk(tctx, US"Delivery-date: ", 15) + || !write_chunk(tctx, s, Ustrlen(s)) + || !write_chunk(tctx, US"\n", 1)) goto bad; } /* Then the message's headers. Don't write any that are flagged as "old"; @@ -2264,6 +2274,7 @@ if (expand_arguments) return TRUE; } +#endif /*!MACRO_PREDEF*/ /* vi: aw ai sw=2 */ /* End of transport.c */