diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2015-05-23 18:07:58 +0100 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2015-05-23 19:50:13 +0100 |
commit | dd2a32ad5058ad7831621b99a1eadc264d4982c9 (patch) | |
tree | 33595a8c88500cd7df2c62c3025ca3dff045b3fb /test | |
parent | 0539a19dc27efcfc77713a87aba6b61fef947249 (diff) |
Testsuite: move test.again.dns and test.fail.dns handling to fakens
Diffstat (limited to 'test')
-rw-r--r-- | test/README | 7 | ||||
-rw-r--r-- | test/src/fakens.c | 86 | ||||
-rw-r--r-- | test/stderr/0069 | 9 | ||||
-rw-r--r-- | test/stderr/0183 | 16 | ||||
-rw-r--r-- | test/stderr/0605 | 3 | ||||
-rw-r--r-- | test/stderr/2202 | 11 |
6 files changed, 83 insertions, 49 deletions
diff --git a/test/README b/test/README index f63c97fa4..7bf4ceea5 100644 --- a/test/README +++ b/test/README @@ -1144,9 +1144,6 @@ fake zone files. These are: 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. @@ -1154,10 +1151,6 @@ fakens, are: 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 diff --git a/test/src/fakens.c b/test/src/fakens.c index bb8d4e206..aff5f40f6 100644 --- a/test/src/fakens.c +++ b/test/src/fakens.c @@ -583,6 +583,55 @@ alarmfn(int sig) { } + +/************************************************* +* 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 * *************************************************/ @@ -666,38 +715,11 @@ domain[domlen] = 0; 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 && diff --git a/test/stderr/0069 b/test/stderr/0069 index 0af08eaa6..15b8a4318 100644 --- a/test/stderr/0069 +++ b/test/stderr/0069 @@ -137,6 +137,9 @@ 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) +>>> 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 @@ -157,6 +160,9 @@ LOG: failed to find host name for V4NET.0.0.13: accepted by +include_unknown >>> 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 @@ -176,6 +182,9 @@ 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) +>>> 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" diff --git a/test/stderr/0183 b/test/stderr/0183 index b5e5deb46..70385352e 100644 --- a/test/stderr/0183 +++ b/test/stderr/0183 @@ -30,7 +30,7 @@ local_part=userx domain=test.again.dns 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 @@ -122,7 +122,7 @@ expanded list of hosts = "test.again.dns" options = bydns 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 @@ -223,7 +223,7 @@ local_part=userx domain=test.fail.dns 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 @@ -314,7 +314,7 @@ expanded list of hosts = "test.fail.dns" options = bydns 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 @@ -599,7 +599,7 @@ srv in "^srv"? yes (matched "^srv") 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 @@ -619,17 +619,17 @@ srv in "^srv"? yes (matched "^srv") 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 diff --git a/test/stderr/0605 b/test/stderr/0605 index 9e144d402..d2def942f 100644 --- a/test/stderr/0605 +++ b/test/stderr/0605 @@ -10,6 +10,9 @@ >>> 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 diff --git a/test/stderr/2202 b/test/stderr/2202 index 043e99569..24ebf9947 100644 --- a/test/stderr/2202 +++ b/test/stderr/2202 @@ -36,7 +36,7 @@ internal_search_find: file="NULL" 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 @@ -55,8 +55,15 @@ Forward DNS security status: unverified 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" |