Fix early use of $sender_host_name
authorJeremy Harris <jgh146exb@wizmail.org>
Fri, 19 Nov 2021 16:15:05 +0000 (16:15 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Fri, 19 Nov 2021 16:15:05 +0000 (16:15 +0000)
Broken-by: 90341c71c1
doc/doc-txt/ChangeLog
src/src/acl.c
src/src/daemon.c
test/confs/0624
test/log/0624
test/rejectlog/0624

index 58996c3f8f5c8651210747186e1e2b55cf8ad663..4ca9323f0241c1a547dee36593775aa2f8a46b35 100644 (file)
@@ -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
 -----------------
index 5252292ffd1b6c6704f3b9d7fd7e2cd1d77d0051..c55a42b6f0971f218d9bfa45df8c7971a1d5ea5d 100644 (file)
@@ -1211,7 +1211,7 @@ int rc;
 
 /* Previous success */
 
-if (sender_host_name != NULL) return OK;
+if (sender_host_name) return OK;
 
 /* Previous failure */
 
index a248a4f40a9f9f29a683a8d3d8ebefb63c19baba..b10974a7ab1c1ddcb7b45856a37aa54a96525f99 100644 (file)
@@ -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;
 }
 
 
index 70f0c2024852d515ddff8f89167cf6a3ea20f9d7..a90a0d09af9a7f4057e4e3812e0fc41399da52e7 100644 (file)
@@ -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 =
index e87a520b51332b9908d049698fc5033d4a5347fa..f70aaa97b22625331bbf4956946fb6ec1a5bd1f4 100644 (file)
@@ -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=<CALLER@test.ex> RCPT <a@test.ex>: 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=<CALLER@test.ex> RCPT <b@test.ex>: 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=<CALLER@test.ex> RCPT <b@test.ex>: 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=<CALLER@test.ex> RCPT <c@test.ex>: 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)
index cfb1500fc08e72d8cf95e7b5366a1fb5d2fe4ccf..d2dbe7aa467e5027928d1dbe6a3586293b039c8c 100644 (file)
@@ -1,5 +1,5 @@
 
 ******** SERVER ********
 2017-07-30 18:51:05.712 H=localhost (the.local.host.name) [127.0.0.1] F=<CALLER@test.ex> RCPT <a@test.ex>: discarded by RCPT ACL
-2017-07-30 18:51:05.712 H=localhost (the.local.host.name) [127.0.0.1] F=<CALLER@test.ex> RCPT <b@test.ex>: discarded by RCPT ACL
+2017-07-30 18:51:05.712 H=the.local.host.name [ip4.ip4.ip4.ip4] F=<CALLER@test.ex> RCPT <b@test.ex>: discarded by RCPT ACL
 2017-07-30 18:51:05.712 H=localhost (the.local.host.name) [127.0.0.1] F=<CALLER@test.ex> RCPT <c@test.ex>: discarded by RCPT ACL