summaryrefslogtreecommitdiffstats
path: root/contrib/bind/tools/nslookup/debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/bind/tools/nslookup/debug.c')
-rw-r--r--contrib/bind/tools/nslookup/debug.c86
1 files changed, 71 insertions, 15 deletions
diff --git a/contrib/bind/tools/nslookup/debug.c b/contrib/bind/tools/nslookup/debug.c
index e523ae6..e61c08f 100644
--- a/contrib/bind/tools/nslookup/debug.c
+++ b/contrib/bind/tools/nslookup/debug.c
@@ -55,7 +55,7 @@
#ifndef lint
static char sccsid[] = "@(#)debug.c 5.26 (Berkeley) 3/21/91";
-static char rcsid[] = "$Id: debug.c,v 8.4 1996/05/21 07:04:38 vixie Exp $";
+static char rcsid[] = "$Id: debug.c,v 8.10 1996/12/18 04:09:50 vixie Exp $";
#endif /* not lint */
/*
@@ -141,6 +141,12 @@ Fprint_query(msg, eom, printHeader,file)
fprintf(file,", want recursion");
if (hp->ra)
fprintf(file,", recursion avail.");
+ if (hp->unused)
+ fprintf(file,", UNUSED-QUERY_BIT");
+ if (hp->ad)
+ fprintf(file,", authentic data");
+ if (hp->cd)
+ fprintf(file,", checking disabled");
fprintf(file,"\n\tquestions = %d", ntohs(hp->qdcount));
fprintf(file,", answers = %d", ntohs(hp->ancount));
fprintf(file,", authority records = %d", ntohs(hp->nscount));
@@ -170,6 +176,11 @@ Fprint_query(msg, eom, printHeader,file)
*/
if (n = ntohs(hp->ancount)) {
fprintf(file," ANSWERS:\n");
+ if (type == T_A && n > MAXADDRS) {
+ printf("Limiting response to MAX Addrs = %d \n",
+ MAXADDRS);
+ n = MAXADDRS;
+ }
while (--n >= 0) {
fprintf(file, INDENT);
cp = Print_rr(cp, msg, eom, file);
@@ -248,17 +259,17 @@ Print_cdname2(cp, msg, eom, file)
* Print resource record fields in human readable form.
*/
u_char *
-Print_rr(cp, msg, eom, file)
- u_char *cp, *msg, *eom;
+Print_rr(ocp, msg, eom, file)
+ u_char *ocp, *msg, *eom;
FILE *file;
{
int type, class, dlen, n, c;
u_int32_t rrttl, ttl;
struct in_addr inaddr;
- u_char *cp1, *cp2;
+ u_char *cp, *cp1, *cp2;
int debug;
- if ((cp = Print_cdname(cp, msg, eom, file)) == NULL) {
+ if ((cp = Print_cdname(ocp, msg, eom, file)) == NULL) {
fprintf(file, "(name truncated?)\n");
return (NULL); /* compression error */
}
@@ -333,6 +344,45 @@ Print_rr(cp, msg, eom, file)
cp += INT16SZ;
fprintf(file,", mail exchanger = ");
goto doname;
+
+ case T_NAPTR:
+ fprintf(file, "\torder = %u",_getshort((u_char*)cp));
+ cp += INT16SZ;
+ fprintf(file,", preference = %u\n", _getshort((u_char*)cp));
+ cp += INT16SZ;
+ /* Flags */
+ n = *cp++;
+ fprintf(file,"\tflags = \"%.*s\"\n", (int)n, cp);
+ cp += n;
+ /* Service */
+ n = *cp++;
+ fprintf(file,"\tservices = \"%.*s\"\n", (int)n, cp);
+ cp += n;
+ /* Regexp */
+ n = *cp++;
+ fprintf(file,"\trule = \"%.*s\"\n", (int)n, cp);
+ cp += n;
+ /* Replacement */
+ fprintf(file,"\treplacement = ");
+ cp = Print_cdname(cp, msg, eom, file);
+ if (cp == NULL) {
+ fprintf(file, "(replacement truncated?)\n");
+ return (NULL); /* compression error */
+ }
+ (void) putc('\n', file);
+
+ break;
+ case T_SRV:
+ fprintf(file, "\tpriority = %u",_getshort((u_char*)cp));
+ cp += INT16SZ;
+ fprintf(file,", weight = %u", _getshort((u_char*)cp));
+ cp += INT16SZ;
+ fprintf(file,", port= %u\n", _getshort((u_char*)cp));
+ cp += INT16SZ;
+
+ fprintf(file,"\thost = ");
+ goto doname;
+
case T_PX:
fprintf(file,"\tpreference = %u",_getshort((u_char*)cp));
cp += INT16SZ;
@@ -467,19 +517,22 @@ doname:
break;
case T_TXT:
- (void) fputs("\ttext = \"", file);
+ (void) fputs("\ttext = ", file);
cp2 = cp1 + dlen;
while (cp < cp2) {
+ (void) putc('"', file);
if (n = (unsigned char) *cp++) {
- for (c = n; c > 0 && cp < cp2; c--)
- if ((*cp == '\n') || (*cp == '"')) {
- (void) putc('\\', file);
- (void) putc(*cp++, file);
- } else
- (void) putc(*cp++, file);
+ for (c = n; c > 0 && cp < cp2; c--) {
+ if ((*cp == '\n') || (*cp == '"') || (*cp == '\\'))
+ (void) putc('\\', file);
+ (void) putc(*cp++, file);
+ }
}
+ (void) putc('"', file);
+ if (cp < cp2)
+ (void) putc(' ', file);
}
- (void) fputs("\"\n", file);
+ (void) putc('\n', file);
break;
case T_X25:
@@ -506,8 +559,9 @@ doname:
case T_AAAA: {
char t[sizeof "ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255"];
- fprintf(file, "IPv6 address = %s\n",
+ fprintf(file, "\tIPv6 address = %s\n",
inet_ntop(AF_INET6, cp, t, sizeof t));
+ cp += IN6ADDRSZ;
break;
}
@@ -574,7 +628,9 @@ doname:
break;
default:
- fprintf(file,"\t??? unknown type %d ???\n", type);
+ fprintf(file,"\trecord type %d, interpreted as:\n", type);
+ /* Let resolver library try to print it */
+ p_rr(ocp, msg, file);
cp += dlen;
}
if (_res.options & RES_DEBUG && type != T_SOA) {
OpenPOWER on IntegriCloud