name[len] = 0;
endname = name + len;
-/* This code, for forcing TRY_AGAIN and NO_RECOVERY, is here so that it works
-for the old test suite that uses a real nameserver. When the old test suite is
-eventually abandoned, this code could be moved into the fakens utility. */
-
-if (len >= 14 && Ustrcmp(endname - 14, "test.again.dns") == 0)
- {
- int delay = Uatoi(name); /* digits at the start of the name */
- DEBUG(D_dns) debug_printf("Return from DNS lookup of %s (%s) faked for testing\n",
- name, dns_text_type(type));
- if (delay > 0)
- {
- DEBUG(D_dns) debug_printf("delaying %d seconds\n", delay);
- sleep(delay);
- }
- h_errno = TRY_AGAIN;
- return -1;
- }
-
-if (len >= 13 && Ustrcmp(endname - 13, "test.fail.dns") == 0)
- {
- DEBUG(D_dns) debug_printf("Return from DNS lookup of %s (%s) faked for testing\n",
- name, dns_text_type(type));
- h_errno = NO_RECOVERY;
- return -1;
- }
-
/* Look for the fakens utility, and if it exists, call it. */
(void)string_format(utilname, sizeof(utilname), "%s/bin/fakens",
int af;
#endif
-/* If we are in the test harness, a name ending in .test.again.dns always
-forces a temporary error response, unless the name is in
-dns_again_means_nonexist. */
-
-if (running_in_test_harness)
- {
- const uschar *endname = host->name + Ustrlen(host->name);
- if (Ustrcmp(endname - 14, "test.again.dns") == 0) goto RETURN_AGAIN;
- }
-
/* Make sure DNS options are set as required. This appears to be necessary in
some circumstances when the get..byname() function actually calls the DNS. */
data block. The addresses that are generated are in the
10.250.0.0/16 network.
-The domain names that are handled directly by Exim, without being passed to
-fakens, are:
-
test.again.dns This always provokes a TRY_AGAIN response, for testing the
handling of temporary DNS error. If the full domain name
starts with digits, a delay of that many seconds occurs.
test.fail.dns This always provokes a NO_RECOVERY response, for testing
DNS server failures.
-This special handling could now be done in the fakens program, but while the
-old test suite is still being used it has to be done in Exim itself, so for the
-moment it remains there.
-
The use of gethostbyname() and its IPv6 friends is also subverted when Exim is
running in the test harness. The test code handles a few special names
directly; for all the others it uses DNS lookups, which are then handled as
{
}
+
+/*************************************************
+* Special-purpose domains *
+*************************************************/
+
+static int
+special_manyhome(uschar * packet, uschar * domain)
+{
+uschar *pk = packet + 12;
+uschar *rdlptr;
+int i, j;
+
+memset(packet, 0, 12);
+
+for (i = 104; i <= 111; i++) for (j = 0; j <= 255; j++)
+ {
+ pk = packname(domain, pk);
+ *pk++ = (ns_t_a >> 8) & 255;
+ *pk++ = (ns_t_a) & 255;
+ *pk++ = 0;
+ *pk++ = 1; /* class = IN */
+ pk += 4; /* TTL field; don't care */
+ rdlptr = pk; /* remember rdlength field */
+ pk += 2;
+
+ *pk++ = 10; *pk++ = 250; *pk++ = i; *pk++ = j;
+
+ rdlptr[0] = ((pk - rdlptr - 2) >> 8) & 255;
+ rdlptr[1] = (pk - rdlptr - 2) & 255;
+ }
+
+packet[6] = (2048 >> 8) & 255;
+packet[7] = 2048 & 255;
+packet[10] = 0;
+packet[11] = 0;
+
+(void)fwrite(packet, 1, pk - packet, stdout);
+return 0;
+}
+
+static int
+special_again(uschar * packet, uschar * domain)
+{
+int delay = atoi(CCS domain); /* digits at the start of the name */
+if (delay > 0) sleep(delay);
+return TRY_AGAIN;
+}
+
+
/*************************************************
* Entry point and main program *
*************************************************/
for (i = 0; i < domlen; i++) domain[i] = tolower(domain[i]);
if (Ustrcmp(domain, "manyhome.test.ex") == 0 && Ustrcmp(qtype, "A") == 0)
- {
- uschar *pk = packet + 12;
- uschar *rdlptr;
- int i, j;
-
- memset(packet, 0, 12);
-
- for (i = 104; i <= 111; i++) for (j = 0; j <= 255; j++)
- {
- pk = packname(domain, pk);
- *pk++ = (ns_t_a >> 8) & 255;
- *pk++ = (ns_t_a) & 255;
- *pk++ = 0;
- *pk++ = 1; /* class = IN */
- pk += 4; /* TTL field; don't care */
- rdlptr = pk; /* remember rdlength field */
- pk += 2;
-
- *pk++ = 10; *pk++ = 250; *pk++ = i; *pk++ = j;
-
- rdlptr[0] = ((pk - rdlptr - 2) >> 8) & 255;
- rdlptr[1] = (pk - rdlptr - 2) & 255;
- }
-
- packet[6] = (2048 >> 8) & 255;
- packet[7] = 2048 & 255;
- packet[10] = 0;
- packet[11] = 0;
-
- (void)fwrite(packet, 1, pk - packet, stdout);
- return 0;
- }
+ return special_manyhome(packet, domain);
+else if (domlen >= 14 && Ustrcmp(domain + domlen - 14, "test.again.dns") == 0)
+ return special_again(packet, domain);
+else if (domlen >= 13 && Ustrcmp(domain + domlen - 13, "test.fail.dns") == 0)
+ return NO_RECOVERY;
if (Ustrchr(domain, '.') == NULL && qualify != NULL &&
>>> processing "deny"
>>> check hosts = +include_defer : test.again.dns
>>> test.again.dns in dns_again_means_nonexist? no (option unset)
+>>> test.again.dns in dns_again_means_nonexist? no (option unset)
+>>> no IP address found for host test.again.dns (during SMTP connection from [V4NET.0.0.13])
+>>> test.again.dns in dns_again_means_nonexist? no (option unset)
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
>>> processing "accept"
>>> check hosts = test.again.dns : V4NET.0.0.13
>>> test.again.dns in dns_again_means_nonexist? no (option unset)
+>>> test.again.dns in dns_again_means_nonexist? no (option unset)
+>>> no IP address found for host test.again.dns (during SMTP connection from [V4NET.0.0.13])
+>>> 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>: DNS lookup of "test.again.dns" deferred
>>> processing "accept"
>>> check hosts = +ignore_defer : test.again.dns : V4NET.0.0.13
>>> test.again.dns in dns_again_means_nonexist? no (option unset)
+>>> test.again.dns in dns_again_means_nonexist? no (option unset)
+>>> no IP address found for host test.again.dns (during SMTP connection from [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
>>> 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"
calling lookuphost router
lookuphost router called for userx@test.again.dns
domain = test.again.dns
-Return from DNS lookup of test.again.dns (MX) faked for testing
+DNS lookup of test.again.dns (MX) using fakens
DNS lookup of test.again.dns (MX) gave TRY_AGAIN
test.again.dns in dns_again_means_nonexist? no (option unset)
returning DNS_AGAIN
set transport smtp
finding IP address for test.again.dns
doing DNS lookup
-Return from DNS lookup of test.again.dns (A) faked for testing
+DNS lookup of test.again.dns (A) using fakens
DNS lookup of test.again.dns (A) gave TRY_AGAIN
test.again.dns in dns_again_means_nonexist? no (option unset)
returning DNS_AGAIN
calling lookuphost router
lookuphost router called for userx@test.fail.dns
domain = test.fail.dns
-Return from DNS lookup of test.fail.dns (MX) faked for testing
+DNS lookup of test.fail.dns (MX) using fakens
DNS lookup of test.fail.dns (MX) gave NO_RECOVERY
returning DNS_FAIL
lookuphost router: defer for userx@test.fail.dns
set transport smtp
finding IP address for test.fail.dns
doing DNS lookup
-Return from DNS lookup of test.fail.dns (A) faked for testing
+DNS lookup of test.fail.dns (A) using fakens
DNS lookup of test.fail.dns (A) gave NO_RECOVERY
returning DNS_FAIL
useryz router: defer for usery@test.fail.dns
calling srv router
srv router called for srv@test.again.dns
domain = test.again.dns
-Return from DNS lookup of _smtp._tcp.test.again.dns (SRV) faked for testing
+DNS lookup of _smtp._tcp.test.again.dns (SRV) using fakens
DNS lookup of _smtp._tcp.test.again.dns (SRV) gave TRY_AGAIN
_smtp._tcp.test.again.dns in dns_again_means_nonexist? no (option unset)
returning DNS_AGAIN
calling srv router
srv router called for srv@test.fail.dns
domain = test.fail.dns
-Return from DNS lookup of _smtp._tcp.test.fail.dns (SRV) faked for testing
+DNS lookup of _smtp._tcp.test.fail.dns (SRV) using fakens
DNS lookup of _smtp._tcp.test.fail.dns (SRV) gave NO_RECOVERY
returning DNS_FAIL
test.fail.dns in "test.fail.dns"? yes (matched "test.fail.dns")
DNS_FAIL treated as DNS_NODATA (domain in srv_fail_domains)
-Return from DNS lookup of test.fail.dns (MX) faked for testing
+DNS lookup of test.fail.dns (MX) using fakens
DNS lookup of test.fail.dns (MX) gave NO_RECOVERY
returning DNS_FAIL
test.fail.dns in "test.fail.dns"? yes (matched "test.fail.dns")
DNS_FAIL treated as DNS_NODATA (domain in mx_fail_domains)
-Return from DNS lookup of test.fail.dns (A) faked for testing
+DNS lookup of test.fail.dns (A) using fakens
DNS lookup of test.fail.dns (A) gave NO_RECOVERY
returning DNS_FAIL
srv router: defer for srv@test.fail.dns
>>> processing "accept"
>>> check hosts = test.again.dns
>>> test.again.dns in dns_again_means_nonexist? no (option unset)
+>>> test.again.dns in dns_again_means_nonexist? no (option unset)
+>>> no IP address found for host test.again.dns (during SMTP connection from (test) [ip4.ip4.ip4.ip4])
+>>> 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
type=dnsdb key=">:defer_never,mxh=cioce.test.again.dns"
database lookup required for >:defer_never,mxh=cioce.test.again.dns
dnsdb key: cioce.test.again.dns
-Return from DNS lookup of cioce.test.again.dns (MX) faked for testing
+DNS lookup of cioce.test.again.dns (MX) using fakens
DNS lookup of cioce.test.again.dns (MX) gave TRY_AGAIN
cioce.test.again.dns in dns_again_means_nonexist? yes (matched "*")
cioce.test.again.dns is in dns_again_means_nonexist: returning DNS_NOMATCH
ip4.ip4.ip4.ip4 OK
sender_fullhost = the.local.host.name [ip4.ip4.ip4.ip4]
sender_rcvhost = the.local.host.name ([ip4.ip4.ip4.ip4])
+using host_fake_gethostbyname for cioce.test.again.dns (IPv4)
+DNS lookup of cioce.test.again.dns (A) using fakens
+DNS lookup of cioce.test.again.dns (A) gave TRY_AGAIN
cioce.test.again.dns in dns_again_means_nonexist? yes (matched "*")
-cioce.test.again.dns is in dns_again_means_nonexist: returning HOST_FIND_FAILED
+cioce.test.again.dns is in dns_again_means_nonexist: returning DNS_NOMATCH
+get[host|ipnode]byname[2](af=inet) returned 1 (HOST_NOT_FOUND)
+no IP address found for host cioce.test.again.dns (during SMTP connection from the.local.host.name [ip4.ip4.ip4.ip4])
+LOG: host_lookup_failed MAIN
+ no IP address found for host cioce.test.again.dns (during SMTP connection from the.local.host.name [ip4.ip4.ip4.ip4])
failed to find IP address for cioce.test.again.dns: item ignored by +ignore_unknown
host in "+ignore_unknown : *.cioce.test.again.dns : cioce.test.again.dns : "? no (end of list)
accept: condition test failed in ACL "rcpt"