Log reason for defer, on a hostlist dns-lookup temporary error. Bug 1328
authorJeremy Harris <jgh146exb@wizmail.org>
Tue, 5 May 2015 21:50:56 +0000 (22:50 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Wed, 6 May 2015 14:22:45 +0000 (15:22 +0100)
src/src/acl.c
src/src/host.c
src/src/match.c
test/confs/0605 [new file with mode: 0644]
test/scripts/0000-Basic/0605 [new file with mode: 0644]
test/stderr/0069
test/stderr/0605 [new file with mode: 0644]
test/stdout/0605 [new file with mode: 0644]

index aa9f58f2c3e45f913255278d18b616593b58be3b..b42492d88c4b828b05b3b67e3d89e60690b7dc4b 100644 (file)
@@ -3582,7 +3582,8 @@ for (; cb != NULL; cb = cb->next)
     rc = verify_check_this_host(&arg, sender_host_cache, NULL,
       (sender_host_address == NULL)? US"" : sender_host_address,
       CUSS &host_data);
-    if (host_data != NULL) host_data = string_copy_malloc(host_data);
+    if (rc == DEFER) *log_msgptr = search_error_message;
+    if (host_data) host_data = string_copy_malloc(host_data);
     break;
 
     case ACLC_LOCAL_PARTS:
@@ -3597,8 +3598,7 @@ for (; cb != NULL; cb = cb->next)
       int sep = 0;
       const uschar *s = arg;
       uschar *ss;
-      while ((ss = string_nextinlist(&s, &sep, big_buffer, big_buffer_size))
-              != NULL)
+      while ((ss = string_nextinlist(&s, &sep, big_buffer, big_buffer_size)))
         {
         if (Ustrcmp(ss, "main") == 0) logbits |= LOG_MAIN;
         else if (Ustrcmp(ss, "panic") == 0) logbits |= LOG_PANIC;
index f6c8faac7cde766d0a2997fac9c6cd9ad8a6bb5f..4d76fc4a3df304b3fd1b0b713899adf2ce47ce41 100644 (file)
@@ -1995,11 +1995,11 @@ for (i = 1; i <= times;
     switch (error_num)
       {
       case HOST_NOT_FOUND: error = US"HOST_NOT_FOUND"; break;
-      case TRY_AGAIN: error = US"TRY_AGAIN"; break;
-      case NO_RECOVERY: error = US"NO_RECOVERY"; break;
-      case NO_DATA: error = US"NO_DATA"; break;
+      case TRY_AGAIN:      error = US"TRY_AGAIN"; break;
+      case NO_RECOVERY:    error = US"NO_RECOVERY"; break;
+      case NO_DATA:        error = US"NO_DATA"; break;
       #if NO_DATA != NO_ADDRESS
-      case NO_ADDRESS: error = US"NO_ADDRESS"; break;
+      case NO_ADDRESS:     error = US"NO_ADDRESS"; break;
       #endif
       default: error = US"?"; break;
       }
index 5bf4ef5d802a07e19209fb604ea08fc90e8e6e3d..893ff4863958e7d79213781dd535524e5e008ff4 100644 (file)
@@ -740,7 +740,7 @@ while ((sss = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) != NULL)
 
         case DEFER:
         if (error == NULL)
-          error = string_sprintf("DNS lookup of %s deferred", ss);
+          error = string_sprintf("DNS lookup of \"%s\" deferred", ss);
         if (ignore_defer)
           {
           HDEBUG(D_lists) debug_printf("%s: item ignored by +ignore_defer\n",
@@ -752,6 +752,7 @@ while ((sss = string_nextinlist(&list, &sep, buffer, sizeof(buffer))) != NULL)
           log_write(0, LOG_MAIN, "%s: accepted by +include_defer", error);
           return OK;
           }
+        if (!search_error_message) search_error_message = error;
         goto DEFER_RETURN;
 
         /* The ERROR return occurs when checking hosts, when either a forward
diff --git a/test/confs/0605 b/test/confs/0605
new file mode 100644 (file)
index 0000000..32c7b28
--- /dev/null
@@ -0,0 +1,17 @@
+# Exim test configuration 0605
+
+exim_path = EXIM_PATH
+host_lookup_order = bydns
+spool_directory = DIR/spool
+log_file_path = DIR/spool/log/SERVER%slog
+gecos_pattern = ""
+gecos_name = CALLER_NAME
+
+# ----- Main settings -----
+
+acl_smtp_rcpt = accept hosts = test.again.dns
+
+queue_only
+
+# End
+
diff --git a/test/scripts/0000-Basic/0605 b/test/scripts/0000-Basic/0605
new file mode 100644 (file)
index 0000000..79652be
--- /dev/null
@@ -0,0 +1,10 @@
+# dns retry in hostlist
+# Exim test configuration 0605
+#
+#
+exim -bh HOSTIPV4
+helo test
+mail from:<ralph@dustyshoes.tld>
+rcpt to:<bob@anotherone.tld>
+quit
+****
index df768dde297d1d8be075848c63c92f55c4da5d00..9008167df537c9de2639b2c2d836dd16a4d4e0ff 100644 (file)
@@ -140,7 +140,7 @@ LOG: failed to find host name for V4NET.0.0.13: accepted by +include_unknown
 >>> processing "deny"
 >>> check hosts = +include_defer : test.again.dns
 >>> test.again.dns in dns_again_means_nonexist? no (option unset)
-LOG: DNS lookup of test.again.dns deferred: accepted by +include_defer
+LOG: DNS lookup of "test.again.dns" deferred: accepted by +include_defer
 >>> deny: condition test succeeded in ACL "check_recipienta"
 >>> end of ACL "check_recipienta": DENY
 LOG: H=[V4NET.0.0.13] F=<userx@myhost.test.ex> rejected RCPT <a@test.ex>
@@ -162,7 +162,7 @@ LOG: failed to find host name for V4NET.0.0.13: accepted by +include_unknown
 >>> test.again.dns in dns_again_means_nonexist? no (option unset)
 >>> host in "test.again.dns : V4NET.0.0.13"? list match deferred for test.again.dns
 >>> accept: condition test deferred in ACL "check_recipientb"
-LOG: H=[V4NET.0.0.13] F=<userx@test.ex> temporarily rejected RCPT <b@test.ex>
+LOG: H=[V4NET.0.0.13] F=<userx@test.ex> temporarily rejected RCPT <b@test.ex>: DNS lookup of "test.again.dns" deferred
 >>> host in hosts_connection_nolog? no (option unset)
 >>> host in host_lookup? no (option unset)
 >>> host in host_reject_connection? no (option unset)
@@ -179,7 +179,7 @@ LOG: failed to find host name for V4NET.0.0.13: accepted by +include_unknown
 >>> processing "accept"
 >>> check hosts = +ignore_defer : test.again.dns : V4NET.0.0.13
 >>> test.again.dns in dns_again_means_nonexist? no (option unset)
->>> DNS lookup of test.again.dns deferred: item ignored by +ignore_defer
+>>> DNS lookup of "test.again.dns" deferred: item ignored by +ignore_defer
 >>> host in "+ignore_defer : test.again.dns : V4NET.0.0.13"? yes (matched "V4NET.0.0.13")
 >>> accept: condition test succeeded in ACL "check_recipientc"
 >>> end of ACL "check_recipientc": ACCEPT
diff --git a/test/stderr/0605 b/test/stderr/0605
new file mode 100644 (file)
index 0000000..9e144d4
--- /dev/null
@@ -0,0 +1,15 @@
+>>> host in hosts_connection_nolog? no (option unset)
+>>> host in host_lookup? no (option unset)
+>>> host in host_reject_connection? no (option unset)
+>>> host in sender_unqualified_hosts? no (option unset)
+>>> host in recipient_unqualified_hosts? no (option unset)
+>>> host in helo_verify_hosts? no (option unset)
+>>> host in helo_try_verify_hosts? no (option unset)
+>>> host in helo_accept_junk_hosts? no (option unset)
+>>> test in helo_lookup_domains? no (end of list)
+>>> processing "accept"
+>>> check hosts = test.again.dns
+>>> test.again.dns in dns_again_means_nonexist? no (option unset)
+>>> host in "test.again.dns"? list match deferred for test.again.dns
+>>> accept: condition test deferred in inline ACL
+LOG: H=(test) [ip4.ip4.ip4.ip4] F=<ralph@dustyshoes.tld> temporarily rejected RCPT <bob@anotherone.tld>: DNS lookup of "test.again.dns" deferred
diff --git a/test/stdout/0605 b/test/stdout/0605
new file mode 100644 (file)
index 0000000..64db999
--- /dev/null
@@ -0,0 +1,10 @@
+
+**** SMTP testing session as if from host ip4.ip4.ip4.ip4
+**** but without any ident (RFC 1413) callback.
+**** This is not for real!
+
+220 the.local.host.name ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250 the.local.host.name Hello test [ip4.ip4.ip4.ip4]\r
+250 OK\r
+451 Temporary local problem - please try later\r
+221 the.local.host.name closing connection\r