[prev in list] [next in list] [prev in thread] [next in thread]
List: busybox
Subject: [PATCH 1/2] nslookup: handle replies without RRs
From: Jo-Philipp Wich <jo () mein ! io>
Date: 2019-06-27 15:27:28
Message-ID: 20190627152729.6861-1-jo () mein ! io
[Download RAW message or body]
Under some circumstances, a DNS reply might contain no resource records,
e.g. when a valid domain is queried that does not have records of the
requested type.
Example with nslookup from BIND dnsutils:
$ nslookup -q=SRV example.org
Server: 10.11.12.13
Address: 10.11.12.13#53
Non-authoritative answer:
*** Can't find example.org: No answer
Currently the busybox nslookup applet simply prints nothing after the
"Non-authoritative answer:" line in the same situation.
This change modifies nslookup to either print "Parse error" or "No answer"
diagnostics, depending on the parse_reply() return value.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
---
networking/nslookup.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/networking/nslookup.c b/networking/nslookup.c
index 24e09d4f0..f7fd1d377 100644
--- a/networking/nslookup.c
+++ b/networking/nslookup.c
@@ -615,9 +615,15 @@ static int send_queries(struct ns *ns)
G.query[qn].name, rcodes[rcode]);
G.exitcode = EXIT_FAILURE;
} else {
- if (parse_reply(reply, recvlen) < 0) {
+ switch (parse_reply(reply, recvlen)) {
+ case -1:
printf("*** Can't find %s: Parse error\n", G.query[qn].name);
G.exitcode = EXIT_FAILURE;
+ break;
+
+ case 0:
+ printf("*** Can't find %s: No answer\n", G.query[qn].name);
+ break;
}
}
bb_putchar('\n');
--
2.11.0
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic