diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2022-12-23 18:02:25 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2022-12-23 18:07:57 +0000 |
commit | 0762e1a4d6de4b7b0206314302297c9dd6d7ae73 (patch) | |
tree | a0a06de3ccab66778aaae65bd4c1d1d6e6cdc0bf /src | |
parent | 02f746c26c113c1bd97cc25cc75797327eca9434 (diff) |
Expand max_rcpt option on smtp transport. Bug 2946
Diffstat (limited to 'src')
-rw-r--r-- | src/src/deliver.c | 12 | ||||
-rw-r--r-- | src/src/functions.h | 10 | ||||
-rw-r--r-- | src/src/globals.c | 2 | ||||
-rw-r--r-- | src/src/macros.h | 4 | ||||
-rw-r--r-- | src/src/structs.h | 2 | ||||
-rw-r--r-- | src/src/transports/smtp.c | 12 |
6 files changed, 30 insertions, 12 deletions
diff --git a/src/src/deliver.c b/src/src/deliver.c index c5e00eaef..ca31df587 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -4290,10 +4290,14 @@ So look out for the place it gets used. } /* Get the maximum it can handle in one envelope, with zero meaning - unlimited, which is forced for the MUA wrapper case. */ - - address_count_max = tp->max_addresses; - if (address_count_max == 0 || mua_wrapper) address_count_max = 999999; + unlimited, which is forced for the MUA wrapper case and if the + value could vary depending on the messages. + For those, we only split (below) by (tpt,dest,erraddr,hdrs) and rely on the + transport splitting further by max_rcp. So we potentially lose some + parallellism. */ + + address_count_max = mua_wrapper || Ustrchr(tp->max_addresses, '$') + ? UNLIMITED_ADDRS : expand_max_rcpt(tp->max_addresses); /************************************************************************/ diff --git a/src/src/functions.h b/src/src/functions.h index 3ca346c04..1817144ea 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -1307,6 +1307,14 @@ debug_printf("cmdlog: '%s'\n", client_cmd_log ? client_cmd_log->s : US"(unset)") +static inline int +expand_max_rcpt(const uschar * str_max_rcpt) +{ +const uschar * s = expand_cstring(str_max_rcpt); +int res; +return !s || !*s || (res = Uatoi(s)) == 0 ? UNLIMITED_ADDRS : res; +} + # endif /* !COMPILE_UTILITY */ /******************************************************************************/ @@ -1314,6 +1322,6 @@ debug_printf("cmdlog: '%s'\n", client_cmd_log ? client_cmd_log->s : US"(unset)") #endif /* _FUNCTIONS_H_ */ -/* vi: aw +/* vi: aw ai sw=2 */ /* End of functions.h */ diff --git a/src/src/globals.c b/src/src/globals.c index e5b72592f..efe34902a 100644 --- a/src/src/globals.c +++ b/src/src/globals.c @@ -1592,7 +1592,7 @@ transport_instance transport_defaults = { /* All non-mentioned elements zero/NULL/FALSE */ .batch_max = 1, .multi_domain = TRUE, - .max_addresses = 100, + .max_addresses = US"100", .connection_max_messages = 500, .uid = (uid_t)(-1), .gid = (gid_t)(-1), diff --git a/src/src/macros.h b/src/src/macros.h index a631877a1..585067fc9 100644 --- a/src/src/macros.h +++ b/src/src/macros.h @@ -1136,4 +1136,8 @@ typedef unsigned mcs_flags; #else # define EXIM_NOFOLLOW 0 #endif + +/* A big number for (effectively) unlimited envelope addresses */ +#define UNLIMITED_ADDRS 999999 + /* End of macros.h */ diff --git a/src/src/structs.h b/src/src/structs.h index e1d93a943..eae66e88d 100644 --- a/src/src/structs.h +++ b/src/src/structs.h @@ -183,7 +183,7 @@ typedef struct transport_instance { uschar *expand_multi_domain; /* ) */ BOOL multi_domain; /* ) */ BOOL overrides_hosts; /* ) Used only for remote transports */ - int max_addresses; /* ) */ + uschar *max_addresses; /* ) */ int connection_max_messages;/* ) */ /**************************************/ BOOL deliver_as_creator; /* Used only by pipe at present */ diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index ed5f83b3e..c5951832b 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -114,7 +114,7 @@ optionlist smtp_transport_options[] = { { "interface", opt_stringptr, LOFF(interface) }, { "keepalive", opt_bool, LOFF(keepalive) }, { "lmtp_ignore_quota", opt_bool, LOFF(lmtp_ignore_quota) }, - { "max_rcpt", opt_int | opt_public, + { "max_rcpt", opt_stringptr | opt_public, OPT_OFF(transport_instance, max_addresses) }, { "message_linelength_limit", opt_int, LOFF(message_linelength_limit) }, { "multi_domain", opt_expand_bool | opt_public, @@ -2121,8 +2121,9 @@ sx->dane_required = verify_check_given_host(CUSS &ob->hosts_require_dane, sx->conn_args.host) == OK; #endif -if ((sx->max_mail = sx->conn_args.tblock->connection_max_messages) == 0) sx->max_mail = 999999; -if ((sx->max_rcpt = sx->conn_args.tblock->max_addresses) == 0) sx->max_rcpt = 999999; +if ((sx->max_mail = sx->conn_args.tblock->connection_max_messages) == 0) + sx->max_mail = UNLIMITED_ADDRS; +sx->max_rcpt = expand_max_rcpt(sx->conn_args.tblock->max_addresses); sx->igquotstr = US""; if (!sx->helo_data) sx->helo_data = ob->helo_data; @@ -2819,8 +2820,9 @@ if (tls_out.active.sock >= 0) #ifdef EXPERIMMENTAL_ESMTP_LIMITS /* As we are about to send another EHLO, forget any LIMITS received so far. */ sx->peer_limit_mail = sx->peer_limit_rcpt = sx->peer_limit_rcptdom = 0; - if ((sx->max_mail = sx->conn_args.tblock->connection_max_message) == 0) sx->max_mail = 999999; - if ((sx->max_rcpt = sx->conn_args.tblock->max_addresses) == 0) sx->max_rcpt = 999999; + if ((sx->max_mail = sx->conn_args.tblock->connection_max_message) == 0) + sx->max_mail = UNLIMITED_ADDRS; + sx->max_rcpt = expand_max_rcpt(sx->conn_args.tblock->max_addresses); sx->single_rcpt_domain = FALSE; #endif |