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.
diff --git a/src/forward.c b/src/forward.c
index ff0ab7e..414f988 100644
--- a/src/forward.c
+++ b/src/forward.c
@@ -249,9 +249,7 @@
(void)do_bit;
/* may be no servers available. */
- if (!daemon->servers)
- forward = NULL;
- else if (forward || (hash && (forward = lookup_frec_by_sender(ntohs(header->id), udpaddr, hash))))
+ if (forward || (hash && (forward = lookup_frec_by_sender(ntohs(header->id), udpaddr, hash))))
{
/* If we didn't get an answer advertising a maximal packet in EDNS,
fall back to 1280, which should work everywhere on IPv6.
@@ -334,9 +332,9 @@
#endif
type &= ~SERV_DO_DNSSEC;
- if (!flags && !(forward = get_new_frec(now, NULL, 0)))
- /* table full - server failure. */
- flags = F_NEG;
+ if (daemon->servers && !flags)
+ forward = get_new_frec(now, NULL, 0);
+ /* table full - flags == 0, return REFUSED */
if (forward)
{
@@ -1621,6 +1619,9 @@
unsigned int mark = 0;
int have_mark = 0;
+ (void)mark;
+ (void)have_mark;
+
if (getpeername(confd, (struct sockaddr *)&peer_addr, &peer_len) == -1)
return packet;