Fix hosts_connection_nolog ensuring that sender_host_cache is not
authorJeremy Harris <jgh146exb@wizmail.org>
Thu, 17 Dec 2015 23:22:09 +0000 (23:22 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Thu, 17 Dec 2015 23:25:56 +0000 (23:25 +0000)
incorrectly filled in by the daemon, where the sender_host will
be varying.

doc/doc-txt/ChangeLog
src/src/daemon.c
src/src/exim.c
src/src/smtp_in.c
test/confs/0614 [new file with mode: 0644]
test/log/0614 [new file with mode: 0644]
test/scripts/0000-Basic/0614 [new file with mode: 0644]
test/stdout/0614 [new file with mode: 0644]

index 884abc2131ddfa25c8e0046b7fbe9280c49c115d..4622fbd36c71c3d8fcf730f3a0bb58ade0d9d418 100644 (file)
@@ -131,6 +131,9 @@ JH/29 Move Events support from Experimental to mainline, enabled by default
 
 JH/30 Updated DANE implementation code to current from Viktor Dukhovni.
 
+JH/31 Fix bug with hosts_connection_nolog and named-lists which were wrongly
+      cached by the daemon.
+
 
 Exim version 4.86
 -----------------
index 65195ccd193c81316ca8d684199807d7bc7bb066..24874c374f0a9f8d5d61b69eea8eadf7075c2cac 100644 (file)
@@ -341,6 +341,7 @@ arrange to unset the selector in the subprocess. */
 if (LOGGING(smtp_connection))
   {
   uschar *list = hosts_connection_nolog;
+  memset(sender_host_cache, 0, sizeof(sender_host_cache));
   if (list != NULL && verify_check_host(&list) == OK)
     save_log_selector &= ~L_smtp_connection;
   else
index 9e4dafe2f22ca5ae86e921db5a4788ea85f148b0..f8cfda8a8b4b5bc851e3e65756aa1b40d6d96891 100644 (file)
@@ -5051,6 +5051,7 @@ if (host_checking)
     "**** This is not for real!\n\n",
       sender_host_address);
 
+  memset(sender_host_cache, 0, sizeof(sender_host_cache));
   if (verify_check_host(&hosts_connection_nolog) == OK)
     BIT_CLEAR(log_selector, log_selector_size, Li_smtp_connection);
   log_write(L_smtp_connection, LOG_MAIN, "%s", smtp_get_connection_info());
@@ -5225,6 +5226,7 @@ if (smtp_input)
   {
   smtp_in = stdin;
   smtp_out = stdout;
+  memset(sender_host_cache, 0, sizeof(sender_host_cache));
   if (verify_check_host(&hosts_connection_nolog) == OK)
     BIT_CLEAR(log_selector, log_selector_size, Li_smtp_connection);
   log_write(L_smtp_connection, LOG_MAIN, "%s", smtp_get_connection_info());
index 3fce125d36edc46089f422cc9e69e9b5268f1c59..b48e436e3c0d8ae3d89aa59c4b6c22b3da875b60 100644 (file)
@@ -1866,8 +1866,6 @@ pipelining_enable = TRUE;
 sync_cmd_limit = NON_SYNC_CMD_NON_PIPELINING;
 smtp_exit_function_called = FALSE;    /* For avoiding loop in not-quit exit */
 
-memset(sender_host_cache, 0, sizeof(sender_host_cache));
-
 /* If receiving by -bs from a trusted user, or testing with -bh, we allow
 authentication settings from -oMaa to remain in force. */
 
diff --git a/test/confs/0614 b/test/confs/0614
new file mode 100644 (file)
index 0000000..2b23617
--- /dev/null
@@ -0,0 +1,20 @@
+# Exim test configuration 0614
+# hosts_connection_nolog versus sender_host lists caching
+
+exim_path = EXIM_PATH
+host_lookup_order = bydns
+primary_hostname = myhost.test.ex
+spool_directory = DIR/spool
+log_file_path = DIR/spool/log/%slog
+gecos_pattern = ""
+gecos_name = CALLER_NAME
+tls_advertise_hosts =
+
+# ----- Main settings -----
+
+log_selector = +smtp_connection
+hostlist nolog = 127.0.0.1
+hosts_connection_nolog = +nolog
+queue_only
+
+# End
diff --git a/test/log/0614 b/test/log/0614
new file mode 100644 (file)
index 0000000..f52733f
--- /dev/null
@@ -0,0 +1,3 @@
+1999-03-02 09:44:33 exim x.yz daemon started: pid=pppp, no queue runs, listening for SMTP on port 1225
+1999-03-02 09:44:33 SMTP connection from [ip4.ip4.ip4.ip4] (TCP/IP connection count = 1)
+1999-03-02 09:44:33 SMTP connection from [ip4.ip4.ip4.ip4] closed by QUIT
diff --git a/test/scripts/0000-Basic/0614 b/test/scripts/0000-Basic/0614
new file mode 100644 (file)
index 0000000..ff3931b
--- /dev/null
@@ -0,0 +1,17 @@
+# hosts_connection_nolog versus sender_host lists caching
+exim -bd -DSERVER=server -oX PORT_D
+****
+#
+# Will not log connection due to hosts_connection_nolog
+client 127.0.0.1 PORT_D
+??? 220
+QUIT
+****
+#
+# Connection should be logged
+client HOSTIPV4 PORT_D
+??? 220
+QUIT
+****
+#
+killdaemon
diff --git a/test/stdout/0614 b/test/stdout/0614
new file mode 100644 (file)
index 0000000..f670e1e
--- /dev/null
@@ -0,0 +1,10 @@
+Connecting to 127.0.0.1 port 1225 ... connected
+??? 220
+<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> QUIT
+End of script
+Connecting to ip4.ip4.ip4.ip4 port 1225 ... connected
+??? 220
+<<< 220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000
+>>> QUIT
+End of script