about summary refs log tree commit diff
path: root/resolv
diff options
context:
space:
mode:
Diffstat (limited to 'resolv')
-rw-r--r--resolv/res_comp.c2
-rw-r--r--resolv/res_debug.c14
-rw-r--r--resolv/res_send.c6
3 files changed, 20 insertions, 2 deletions
diff --git a/resolv/res_comp.c b/resolv/res_comp.c
index aa6afa39eb..1342205f28 100644
--- a/resolv/res_comp.c
+++ b/resolv/res_comp.c
@@ -116,7 +116,7 @@ dn_expand(msg, eomorig, comp_dn, exp_dn, length)
 				return (-1);
 			checked += n + 1;
 			while (--n >= 0) {
-				if ((c = *cp++) == '.') {
+				if (((c = *cp++) == '.') || (c == '\\')) {
 					if (dn + n + 2 >= eom)
 						return (-1);
 					*dn++ = '\\';
diff --git a/resolv/res_debug.c b/resolv/res_debug.c
index 602042e198..c5e68e36e9 100644
--- a/resolv/res_debug.c
+++ b/resolv/res_debug.c
@@ -309,6 +309,7 @@ __fp_nquery(msg, len, file)
 			ntohs(hp->id));
 		putc('\n', file);
 	}
+	if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEADX))
 	putc(';', file);
 	if ((!_res.pfcode) || (_res.pfcode & RES_PRF_HEAD2)) {
 		fprintf(file, "; flags:");
@@ -340,9 +341,21 @@ __fp_nquery(msg, len, file)
 		if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES))
 			fprintf(file, ";; QUESTIONS:\n");
 		while (--n >= 0) {
+			if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES))
 			fprintf(file, ";;\t");
 			TruncTest(cp);
+			if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES))
 			cp = p_cdnname(cp, msg, len, file);
+			else {
+				int n;
+				char name[MAXDNAME];
+
+				if ((n = dn_expand(msg, msg+len, cp, name,
+						sizeof name)) < 0)
+					cp = NULL;
+				else
+					cp += n;
+			}
 			ErrorTest(cp);
 			TruncTest(cp);
 			if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES))
@@ -354,6 +367,7 @@ __fp_nquery(msg, len, file)
 				fprintf(file, ", class = %s\n",
 					__p_class(_getshort((u_char*)cp)));
 			cp += INT16SZ;
+			if ((!_res.pfcode) || (_res.pfcode & RES_PRF_QUES))
 			putc('\n', file);
 		}
 	}
diff --git a/resolv/res_send.c b/resolv/res_send.c
index f8e58f3e11..5a10faa393 100644
--- a/resolv/res_send.c
+++ b/resolv/res_send.c
@@ -682,9 +682,13 @@ res_send(buf, buflen, ans, anssiz)
 				goto same_ns;
 			}
 		} /*if vc/dg*/
+		Dprint((_res.options & RES_DEBUG) ||
+		       ((_res.pfcode & RES_PRF_REPLY) &&
+			(_res.pfcode & RES_PRF_HEAD1)),
+		       (stdout, ";; got answer:\n"));
 		DprintQ((_res.options & RES_DEBUG) ||
 			(_res.pfcode & RES_PRF_REPLY),
-			(stdout, ";; got answer:\n"),
+			(stdout, ""),
 			ans, resplen);
 		/*
 		 * If using virtual circuits, we assume that the first server