From 0aa466ac446bf8cf1617896b1d3321965dd74ad3 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Fri, 19 Nov 2021 16:15:05 +0000 Subject: [PATCH] Fix early use of $sender_host_name Broken-by: 90341c71c1 --- doc/doc-txt/ChangeLog | 5 +++++ src/src/acl.c | 2 +- src/src/daemon.c | 4 +--- test/confs/0624 | 3 ++- test/log/0624 | 9 ++++++--- test/rejectlog/0624 | 2 +- 6 files changed, 16 insertions(+), 9 deletions(-) diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog index 58996c3f8..4ca9323f0 100644 --- a/doc/doc-txt/ChangeLog +++ b/doc/doc-txt/ChangeLog @@ -48,6 +48,11 @@ JH/10 Convert all uses of select() to poll(). FreeBSD 12.2 was found to be are not useable for FD_SET() [and hence select()] and overwrite the stack. Assorted crashes happen. +JH/11 Fix use of $sender_host_name in daemon process. When used in certain + main-section options or in a connect ACL, the value from the first ever + connection was never replaced for subsequent connections. Found by + Wakko Warner. + Exim version 4.95 ----------------- diff --git a/src/src/acl.c b/src/src/acl.c index 5252292ff..c55a42b6f 100644 --- a/src/src/acl.c +++ b/src/src/acl.c @@ -1211,7 +1211,7 @@ int rc; /* Previous success */ -if (sender_host_name != NULL) return OK; +if (sender_host_name) return OK; /* Previous failure */ diff --git a/src/src/daemon.c b/src/src/daemon.c index a248a4f40..b10974a7a 100644 --- a/src/src/daemon.c +++ b/src/src/daemon.c @@ -793,10 +793,8 @@ else (void)close(dup_accept_socket); the incoming host address and an expanded active_hostname. */ log_close_all(); -interface_address = -sender_host_address = NULL; +interface_address = sender_host_name = sender_host_address = NULL; store_reset(reset_point); -sender_host_address = NULL; } diff --git a/test/confs/0624 b/test/confs/0624 index 70f0c2024..a90a0d09a 100644 --- a/test/confs/0624 +++ b/test/confs/0624 @@ -19,6 +19,7 @@ begin acl delay: accept + logwrite = $sender_host_name delay = 2s # ----- Routers ----- @@ -31,7 +32,7 @@ r: begin transports smtp: driver = smtp - hosts = 127.0.0.1 + hosts = ${if eq {b}{$local_part} {HOSTIPV4}{127.0.0.1}} port = ${if eq {c}{$local_part} {PORT_D2}{PORT_D}} allow_localhost hosts_try_fastopen = diff --git a/test/log/0624 b/test/log/0624 index e87a520b5..f70aaa97b 100644 --- a/test/log/0624 +++ b/test/log/0624 @@ -1,19 +1,22 @@ 2017-07-30 18:51:05.712 10HmaX-0005vi-00 <= CALLER@test.ex U=CALLER P=local S=sss for a@test.ex b@test.ex c@test.ex 2017-07-30 18:51:05.712 10HmaX-0005vi-00 => a@test.ex R=r T=smtp H=127.0.0.1 [127.0.0.1]:PORT_D C="250 OK id=10HmaY-0005vi-00" -2017-07-30 18:51:05.712 10HmaX-0005vi-00 => b@test.ex R=r T=smtp H=127.0.0.1 [127.0.0.1]:PORT_D C="250 OK id=10HmaZ-0005vi-00" +2017-07-30 18:51:05.712 10HmaX-0005vi-00 => b@test.ex R=r T=smtp H=ip4.ip4.ip4.ip4 [ip4.ip4.ip4.ip4]:PORT_D C="250 OK id=10HmaZ-0005vi-00" 2017-07-30 18:51:05.712 10HmaX-0005vi-00 => c@test.ex R=r T=smtp H=127.0.0.1 [127.0.0.1]:PORT_D2 C="250 OK id=10HmbA-0005vi-00" 2017-07-30 18:51:05.712 10HmaX-0005vi-00 Completed ******** SERVER ******** 2017-07-30 18:51:05.712 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port PORT_D port PORT_D2 +2017-07-30 18:51:05.712 localhost 2017-07-30 18:51:05.712 H=localhost (the.local.host.name) [127.0.0.1] F= RCPT : discarded by RCPT ACL 2017-07-30 18:51:05.712 10HmaY-0005vi-00 <= CALLER@test.ex H=localhost (the.local.host.name) [127.0.0.1] P=esmtp S=sss id=E10HmaX-0005vi-00@the.local.host.name 2017-07-30 18:51:05.712 10HmaY-0005vi-00 => blackhole (RCPT ACL discarded recipients) 2017-07-30 18:51:05.712 10HmaY-0005vi-00 Completed -2017-07-30 18:51:05.712 H=localhost (the.local.host.name) [127.0.0.1] F= RCPT : discarded by RCPT ACL -2017-07-30 18:51:05.712 10HmaZ-0005vi-00 <= CALLER@test.ex H=localhost (the.local.host.name) [127.0.0.1] P=esmtp S=sss id=E10HmaX-0005vi-00@the.local.host.name +2017-07-30 18:51:05.712 the.local.host.name +2017-07-30 18:51:05.712 H=the.local.host.name [ip4.ip4.ip4.ip4] F= RCPT : discarded by RCPT ACL +2017-07-30 18:51:05.712 10HmaZ-0005vi-00 <= CALLER@test.ex H=the.local.host.name [ip4.ip4.ip4.ip4] P=esmtp S=sss id=E10HmaX-0005vi-00@the.local.host.name 2017-07-30 18:51:05.712 10HmaZ-0005vi-00 => blackhole (RCPT ACL discarded recipients) 2017-07-30 18:51:05.712 10HmaZ-0005vi-00 Completed +2017-07-30 18:51:05.712 localhost 2017-07-30 18:51:05.712 H=localhost (the.local.host.name) [127.0.0.1] F= RCPT : discarded by RCPT ACL 2017-07-30 18:51:05.712 10HmbA-0005vi-00 <= CALLER@test.ex H=localhost (the.local.host.name) [127.0.0.1] P=esmtp S=sss id=E10HmaX-0005vi-00@the.local.host.name 2017-07-30 18:51:05.712 10HmbA-0005vi-00 => blackhole (RCPT ACL discarded recipients) diff --git a/test/rejectlog/0624 b/test/rejectlog/0624 index cfb1500fc..d2dbe7aa4 100644 --- a/test/rejectlog/0624 +++ b/test/rejectlog/0624 @@ -1,5 +1,5 @@ ******** SERVER ******** 2017-07-30 18:51:05.712 H=localhost (the.local.host.name) [127.0.0.1] F= RCPT : discarded by RCPT ACL -2017-07-30 18:51:05.712 H=localhost (the.local.host.name) [127.0.0.1] F= RCPT : discarded by RCPT ACL +2017-07-30 18:51:05.712 H=the.local.host.name [ip4.ip4.ip4.ip4] F= RCPT : discarded by RCPT ACL 2017-07-30 18:51:05.712 H=localhost (the.local.host.name) [127.0.0.1] F= RCPT : discarded by RCPT ACL -- 2.30.2