From e39fdc8556cb9c21af32e56b1a2aba69a2736f0b Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sun, 11 Jun 2017 20:58:21 +0100 Subject: On a continued-transport delivery, do not check the hostlist for mismatch in the transport dispatch level when the transport does hosts-override. Instead do the full trasport process call and let it decide on compatibility with the connection. --- src/OS/Makefile-Base | 2 +- src/src/deliver.c | 32 +++++++++++++++++++++++++------- 2 files changed, 26 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/OS/Makefile-Base b/src/OS/Makefile-Base index f3903180b..3b7246109 100644 --- a/src/OS/Makefile-Base +++ b/src/OS/Makefile-Base @@ -602,7 +602,7 @@ crypt16.o: $(HDRS) crypt16.c daemon.o: $(HDRS) daemon.c dbfn.o: $(HDRS) dbfn.c debug.o: $(HDRS) debug.c -deliver.o: $(HDRS) deliver.c +deliver.o: $(HDRS) transports/smtp.h deliver.c directory.o: $(HDRS) directory.c dns.o: $(HDRS) dns.c enq.o: $(HDRS) enq.c diff --git a/src/src/deliver.c b/src/src/deliver.c index 0e59d5108..e5c951560 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -9,6 +9,7 @@ #include "exim.h" +#include "transports/smtp.h" #include @@ -4453,14 +4454,31 @@ for (delivery_count = 0; addr_remote; delivery_count++) if (continue_transport) { BOOL ok = Ustrcmp(continue_transport, tp->name) == 0; - if (ok && addr->host_list) + + /* If the transport is about to override the host list do not check + it here but take the cost of running the transport process to discover + if the continued_hostname connection is suitable. This is a layering + violation which is unfortunate as it requires we haul in the smtp + include file. */ + + if (ok) { - host_item *h; - ok = FALSE; - for (h = addr->host_list; h; h = h->next) - if (Ustrcmp(h->name, continue_hostname) == 0) -/*XXX should also check port here */ - { ok = TRUE; break; } + smtp_transport_options_block * ob; + + if ( !( tp->info->driver_name == US"smtp" + && (ob = (smtp_transport_options_block *)tp->options_block) + && ob->hosts_override && ob->hosts + ) + && addr->host_list + ) + { + host_item * h; + ok = FALSE; + for (h = addr->host_list; h; h = h->next) + if (Ustrcmp(h->name, continue_hostname) == 0) + /*XXX should also check port here */ + { ok = TRUE; break; } + } } /* Addresses not suitable; defer or queue for fallback hosts (which -- cgit v1.2.3