dns_core: Allow zero-length DNS responses.
authorMark Michelson <mmichelson@digium.com>
Wed, 29 Jul 2015 17:58:23 +0000 (12:58 -0500)
committerMark Michelson <mmichelson@digium.com>
Fri, 31 Jul 2015 14:44:20 +0000 (09:44 -0500)
commit86034227ca47ea256186372f09f83a4e18fcdc01
tree4fbaa4a0ded7ceee5dd10e8a4d6cf351c9fe14dc
parent687597ca8c2412f79b79f9b13e17f3ec0ff0ce0c
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
include/asterisk/dns_resolver.h
main/dns.c
main/dns_core.c
tests/test_dns.c