Testsuite: add dnsdb testcase for defer when used in ACL
authorJeremy Harris <jgh146exb@wizmail.org>
Sat, 28 Jan 2017 17:53:29 +0000 (17:53 +0000)
committerJeremy Harris <jgh146exb@wizmail.org>
Sat, 28 Jan 2017 17:53:29 +0000 (17:53 +0000)
src/src/acl.c
test/confs/2200
test/log/2200
test/scripts/2200-dnsdb/2200
test/stdout/2200

index 64b310968cf93adc8f24b4ec291247d9aad405b3..396e29965af3157e44107f0a08d7b736c4d1f04e 100644 (file)
@@ -2838,18 +2838,15 @@ for (; cb != NULL; cb = cb->next)
   of them, but not for all, because expansion happens down in some lower level
   checking functions in some cases. */
 
-  if (conditions[cb->type].expand_at_top)
+  if (!conditions[cb->type].expand_at_top)
+    arg = cb->arg;
+  else if (!(arg = expand_string(cb->arg)))
     {
-    arg = expand_string(cb->arg);
-    if (arg == NULL)
-      {
-      if (expand_string_forcedfail) continue;
-      *log_msgptr = string_sprintf("failed to expand ACL string \"%s\": %s",
-        cb->arg, expand_string_message);
-      return search_find_defer? DEFER : ERROR;
-      }
+    if (expand_string_forcedfail) continue;
+    *log_msgptr = string_sprintf("failed to expand ACL string \"%s\": %s",
+      cb->arg, expand_string_message);
+    return search_find_defer ? DEFER : ERROR;
     }
-  else arg = cb->arg;
 
   /* Show condition, and expanded condition if it's different */
 
index 904ccfb18e5db2884212fff80c5c3f5f9d74a3fd..73f6f48e7a6e4d59a96b6f03c5843eae9c2832ee 100644 (file)
@@ -7,12 +7,18 @@ primary_hostname = myhost.test.ex
 
 # ----- Main settings -----
 
-acl_not_smtp = check_rcpt
+acl_smtp_rcpt = check_rcpt
+acl_not_smtp = check_not_smtp
 queue_only
 
 begin acl
 
 check_rcpt:
+  accept
+       local_parts =   defer_strict
+       set acl_m1 =    ${lookup dnsdb{defer_strict,a=$domain}}
+
+check_not_smtp:
   warn
        set acl_m1 =    ${map {<,$recipients} \
                                {${lookup dnsdb{a=${domain:$item}}{$value}fail}}}
index f59faf8b98ac7b201a330f8681e6776574461930..84f94626aedbfe5b3583efb2cc1b014dfd1677a7 100644 (file)
@@ -1 +1,2 @@
 1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@myhost.test.ex U=CALLER P=local S=sss
+1999-03-02 09:44:33 U=CALLER F=<> temporarily rejected RCPT <defer_strict@test.again.dns>: failed to expand ACL string "${lookup dnsdb{defer_strict,a=$domain}}": lookup of "defer_strict,a=test.again.dns" gave DEFER: 
index 9f6262524a9da559eeae5bd61a7818c6b3a34df1..96c8dc7ecfa7582f200529d874e746fdd1c19c39 100644 (file)
@@ -60,5 +60,13 @@ a=localhost.test.ex        ${lookup dnsdb{a=localhost.test.ex}{$value}fail}
 exim -d-all+lookup -odq user@shorthost.test.ex
 ****
 #
+# ACL defer_strict
+exim -bs
+HELO test
+MAIL FROM:<>
+RCPT TO:<defer_strict@test.again.dns>
+QUIT
+****
+#
 no_msglog_check
 #
index 71ff120177c31ed9ec0ca08e5c7e5eb41899d6ad..202cadf88e869647e8da3be79b365420c6e9d812 100644 (file)
@@ -54,3 +54,8 @@ ten-2.test.ex
 > a=localhost.test.ex        127.0.0.1
 > a=localhost.test.ex        127.0.0.1
 > 
+220 myhost.test.ex ESMTP Exim x.yz Tue, 2 Mar 1999 09:44:33 +0000\r
+250 myhost.test.ex Hello CALLER at test\r
+250 OK\r
+451 Temporary local problem - please try later\r
+221 myhost.test.ex closing connection\r