Fix wrong reply to simple name when --domain-needed set and no servers configured.

Also return REFUSED and not SERVFAIL when out of memory.

Thanks to Allain Legacy for problem report.
This commit is contained in:
Simon Kelley
2016-01-19 21:23:30 +00:00
parent f7443d76f7
commit d05dd58de1
3 changed files with 17 additions and 9 deletions

View File

@@ -896,9 +896,7 @@ size_t setup_reply(struct dns_header *header, size_t qlen,
header->nscount = htons(0);
header->arcount = htons(0);
header->ancount = htons(0); /* no answers unless changed below */
if (flags == F_NEG)
SET_RCODE(header, SERVFAIL); /* couldn't get memory */
else if (flags == F_NOERR)
if (flags == F_NOERR)
SET_RCODE(header, NOERROR); /* empty domain */
else if (flags == F_NXDOMAIN)
SET_RCODE(header, NXDOMAIN);