summaryrefslogtreecommitdiffstats
path: root/contrib/bind9/lib/dns/message.c
diff options
context:
space:
mode:
authordougb <dougb@FreeBSD.org>2011-02-06 22:46:07 +0000
committerdougb <dougb@FreeBSD.org>2011-02-06 22:46:07 +0000
commit31eda3d2ca1e9ed626d5939e944ccfbf3544cc85 (patch)
tree29f19579e118cac909f58ae061a7319418f2e0ed /contrib/bind9/lib/dns/message.c
parent3364c35469daaa167b9e79a0d6e1983ed75c616e (diff)
parent8287cb3f73a2d36684fdf69f4009f28e17dd3800 (diff)
downloadFreeBSD-src-31eda3d2ca1e9ed626d5939e944ccfbf3544cc85.zip
FreeBSD-src-31eda3d2ca1e9ed626d5939e944ccfbf3544cc85.tar.gz
Update to BIND 9.6.3, the latest from ISC on the 9.6 branch.
All 9.6 users with DNSSEC validation enabled should upgrade to this version, or the latest version in the 9.7 branch, prior to 2011-03-31 in order to avoid validation failures for names in .COM as described here: https://www.isc.org/announcement/bind-9-dnssec-validation-fails-new-ds-record In addition the fixes for this and other bugs, there are also the following: * Various fixes to kerberos support, including GSS-TSIG * Various fixes to avoid leaking memory, and to problems that could prevent a clean shutdown of named
Diffstat (limited to 'contrib/bind9/lib/dns/message.c')
-rw-r--r--contrib/bind9/lib/dns/message.c96
1 files changed, 55 insertions, 41 deletions
diff --git a/contrib/bind9/lib/dns/message.c b/contrib/bind9/lib/dns/message.c
index 2e34120..4a01178e 100644
--- a/contrib/bind9/lib/dns/message.c
+++ b/contrib/bind9/lib/dns/message.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004-2009 Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1999-2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or distribute this software for any
@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: message.c,v 1.245.50.3 2009/11/24 03:25:53 marka Exp $ */
+/* $Id: message.c,v 1.245.50.7 2010-06-03 05:29:03 marka Exp $ */
/*! \file */
@@ -1531,6 +1531,8 @@ getsection(isc_buffer_t *source, dns_message_t *msg, dns_decompress_t *dctx,
} else if (rdtype == dns_rdatatype_tsig && msg->tsig == NULL) {
msg->tsig = rdataset;
msg->tsigname = name;
+ /* Windows doesn't like TSIG names to be compressed. */
+ msg->tsigname->attributes |= DNS_NAMEATTR_NOCOMPRESS;
rdataset = NULL;
free_rdataset = ISC_FALSE;
free_name = ISC_FALSE;
@@ -2478,7 +2480,9 @@ dns_message_reply(dns_message_t *msg, isc_boolean_t want_question_section) {
if (msg->opcode != dns_opcode_query &&
msg->opcode != dns_opcode_notify)
want_question_section = ISC_FALSE;
- if (want_question_section) {
+ if (msg->opcode == dns_opcode_update)
+ first_section = DNS_SECTION_ADDITIONAL;
+ else if (want_question_section) {
if (!msg->question_ok)
return (DNS_R_FORMERR);
first_section = DNS_SECTION_ANSWER;
@@ -3155,7 +3159,8 @@ dns_message_pseudosectiontotext(dns_message_t *msg,
ADD_STRING(target, ", flags:");
if ((ps->ttl & DNS_MESSAGEEXTFLAG_DO) != 0)
ADD_STRING(target, " do");
- mbz = ps->ttl & ~DNS_MESSAGEEXTFLAG_DO & 0xffff;
+ mbz = ps->ttl & 0xffff;
+ mbz &= ~DNS_MESSAGEEXTFLAG_DO; /* Known Flags. */
if (mbz != 0) {
ADD_STRING(target, "; MBZ: ");
snprintf(buf, sizeof(buf), "%.4x ", mbz);
@@ -3173,42 +3178,46 @@ dns_message_pseudosectiontotext(dns_message_t *msg,
/* Print EDNS info, if any */
dns_rdata_init(&rdata);
dns_rdataset_current(ps, &rdata);
- if (rdata.length < 4)
- return (ISC_R_SUCCESS);
isc_buffer_init(&optbuf, rdata.data, rdata.length);
isc_buffer_add(&optbuf, rdata.length);
- optcode = isc_buffer_getuint16(&optbuf);
- optlen = isc_buffer_getuint16(&optbuf);
-
- if (optcode == DNS_OPT_NSID) {
- ADD_STRING(target, "; NSID");
- } else {
- ADD_STRING(target, "; OPT=");
- sprintf(buf, "%u", optcode);
- ADD_STRING(target, buf);
- }
-
- if (optlen != 0) {
- int i;
- ADD_STRING(target, ": ");
-
- optdata = rdata.data + 4;
- for (i = 0; i < optlen; i++) {
- sprintf(buf, "%02x ", optdata[i]);
+ while (isc_buffer_remaininglength(&optbuf) != 0) {
+ INSIST(isc_buffer_remaininglength(&optbuf) >= 4U);
+ optcode = isc_buffer_getuint16(&optbuf);
+ optlen = isc_buffer_getuint16(&optbuf);
+ INSIST(isc_buffer_remaininglength(&optbuf) >= optlen);
+
+ if (optcode == DNS_OPT_NSID) {
+ ADD_STRING(target, "; NSID");
+ } else {
+ ADD_STRING(target, "; OPT=");
+ sprintf(buf, "%u", optcode);
ADD_STRING(target, buf);
}
- for (i = 0; i < optlen; i++) {
- ADD_STRING(target, " (");
- if (isprint(optdata[i]))
- isc_buffer_putmem(target, &optdata[i],
- 1);
- else
- isc_buffer_putstr(target, ".");
- ADD_STRING(target, ")");
+
+ if (optlen != 0) {
+ int i;
+ ADD_STRING(target, ": ");
+
+ optdata = isc_buffer_current(&optbuf);
+ for (i = 0; i < optlen; i++) {
+ sprintf(buf, "%02x ", optdata[i]);
+ ADD_STRING(target, buf);
+ }
+ for (i = 0; i < optlen; i++) {
+ ADD_STRING(target, " (");
+ if (isprint(optdata[i]))
+ isc_buffer_putmem(target,
+ &optdata[i],
+ 1);
+ else
+ isc_buffer_putstr(target, ".");
+ ADD_STRING(target, ")");
+ }
+ isc_buffer_forward(&optbuf, optlen);
}
+ ADD_STRING(target, "\n");
}
- ADD_STRING(target, "\n");
return (ISC_R_SUCCESS);
case DNS_PSEUDOSECTION_TSIG:
ps = dns_message_gettsig(msg, &name);
@@ -3258,21 +3267,26 @@ dns_message_totext(dns_message_t *msg, const dns_master_style_t *style,
ADD_STRING(target, ", id: ");
snprintf(buf, sizeof(buf), "%6u", msg->id);
ADD_STRING(target, buf);
- ADD_STRING(target, "\n;; flags: ");
+ ADD_STRING(target, "\n;; flags:");
if ((msg->flags & DNS_MESSAGEFLAG_QR) != 0)
- ADD_STRING(target, "qr ");
+ ADD_STRING(target, " qr");
if ((msg->flags & DNS_MESSAGEFLAG_AA) != 0)
- ADD_STRING(target, "aa ");
+ ADD_STRING(target, " aa");
if ((msg->flags & DNS_MESSAGEFLAG_TC) != 0)
- ADD_STRING(target, "tc ");
+ ADD_STRING(target, " tc");
if ((msg->flags & DNS_MESSAGEFLAG_RD) != 0)
- ADD_STRING(target, "rd ");
+ ADD_STRING(target, " rd");
if ((msg->flags & DNS_MESSAGEFLAG_RA) != 0)
- ADD_STRING(target, "ra ");
+ ADD_STRING(target, " ra");
if ((msg->flags & DNS_MESSAGEFLAG_AD) != 0)
- ADD_STRING(target, "ad ");
+ ADD_STRING(target, " ad");
if ((msg->flags & DNS_MESSAGEFLAG_CD) != 0)
- ADD_STRING(target, "cd ");
+ ADD_STRING(target, " cd");
+ /*
+ * The final unnamed flag must be zero.
+ */
+ if ((msg->flags & 0x0040U) != 0)
+ ADD_STRING(target, "; MBZ: 0x4");
if (msg->opcode != dns_opcode_update) {
ADD_STRING(target, "; QUESTION: ");
} else {
OpenPOWER on IntegriCloud