summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2015-07-29 12:58:23 -0500
committerMark Michelson <mmichelson@digium.com>2015-07-31 09:44:20 -0500
commit86034227ca47ea256186372f09f83a4e18fcdc01 (patch)
tree4fbaa4a0ded7ceee5dd10e8a4d6cf351c9fe14dc /tests
parent687597ca8c2412f79b79f9b13e17f3ec0ff0ce0c (diff)
dns_core: Allow zero-length DNS responses.
A testsuite test recently failed due to a crash that occurred in the DNS core. The problem was that the test could not resolve an address, did not set a result on the DNS query, and then indicated the query was completed. The DNS core does not handle the case of a query with no result gracefully, and so there is a crash. This changeset makes the DNS system resolver set a result with a zero-length answer in the case that a DNS resolution failure occurs early. The DNS core now also will accept such a response without treating it as invalid input. A unit test was updated to no longer treat setting a zero-length response as off-nominal. Change-Id: Ie56641e22debdaa61459e1c9a042e23b78affbf6
Diffstat (limited to 'tests')
-rw-r--r--tests/test_dns.c20
1 files changed, 1 insertions, 19 deletions
diff --git a/tests/test_dns.c b/tests/test_dns.c
index 4e2c4a464..9bbb7daaf 100644
--- a/tests/test_dns.c
+++ b/tests/test_dns.c
@@ -365,9 +365,7 @@ AST_TEST_DEFINE(resolver_set_result_off_nominal)
info->description =
"This test performs the following:\n"
"\t* Attempt to add a DNS result that is both bogus and secure\n"
- "\t* Attempt to add a DNS result that has no canonical name\n"
- "\t* Attempt to add a DNS result that has no answer\n"
- "\t* Attempt to add a DNS result with a zero answer size";
+ "\t* Attempt to add a DNS result that has no canonical name";
return AST_TEST_NOT_RUN;
case TEST_EXECUTE:
break;
@@ -391,22 +389,6 @@ AST_TEST_DEFINE(resolver_set_result_off_nominal)
return AST_TEST_FAIL;
}
- if (!ast_dns_resolver_set_result(&some_query, 0, 0, ns_r_noerror, NULL,
- NULL, DNS_ANSWER_SIZE)) {
- ast_test_status_update(test, "Successfully added result with no answer\n");
- result = ast_dns_query_get_result(&some_query);
- ast_dns_result_free(result);
- return AST_TEST_FAIL;
- }
-
- if (!ast_dns_resolver_set_result(&some_query, 0, 0, ns_r_noerror, NULL,
- DNS_ANSWER, 0)) {
- ast_test_status_update(test, "Successfully added result with answer size of zero\n");
- result = ast_dns_query_get_result(&some_query);
- ast_dns_result_free(result);
- return AST_TEST_FAIL;
- }
-
return AST_TEST_PASS;
}