2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 14:07:59 +00:00

'\0' terminate code.

All reasons for marking a server bad should be logged to the lame channel.
This commit is contained in:
Mark Andrews
2002-08-29 07:01:49 +00:00
parent 6b25d2f7f7
commit a39a2424bb

View File

@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/ */
/* $Id: resolver.c,v 1.248 2002/08/27 04:53:42 marka Exp $ */ /* $Id: resolver.c,v 1.249 2002/08/29 07:01:49 marka Exp $ */
#include <config.h> #include <config.h>
@@ -1355,13 +1355,15 @@ add_bad(fetchctx_t *fctx, isc_sockaddr_t *address, isc_result_t reason) {
return; return;
if (reason == DNS_R_UNEXPECTEDRCODE) { if (reason == DNS_R_UNEXPECTEDRCODE) {
isc_buffer_init(&b, code, sizeof(code)); isc_buffer_init(&b, code, sizeof(code) - 1);
dns_rcode_totext(fctx->rmessage->rcode, &b); dns_rcode_totext(fctx->rmessage->rcode, &b);
code[isc_buffer_usedlength(&b)] = '\0';
sep1 = "("; sep1 = "(";
sep2 = ") "; sep2 = ") ";
} else if (reason == DNS_R_UNEXPECTEDOPCODE) { } else if (reason == DNS_R_UNEXPECTEDOPCODE) {
isc_buffer_init(&b, code, sizeof(code)); isc_buffer_init(&b, code, sizeof(code) - 1);
dns_opcode_totext(fctx->rmessage->opcode, &b); dns_opcode_totext(fctx->rmessage->opcode, &b);
code[isc_buffer_usedlength(&b)] = '\0';
sep1 = "("; sep1 = "(";
sep2 = ") "; sep2 = ") ";
} else { } else {
@@ -1371,7 +1373,7 @@ add_bad(fetchctx_t *fctx, isc_sockaddr_t *address, isc_result_t reason) {
} }
dns_name_format(&fctx->name, namebuf, sizeof(namebuf)); dns_name_format(&fctx->name, namebuf, sizeof(namebuf));
isc_sockaddr_format(address, addrbuf, sizeof(addrbuf)); isc_sockaddr_format(address, addrbuf, sizeof(addrbuf));
isc_log_write(dns_lctx, DNS_LOGCATEGORY_RESOLVER, isc_log_write(dns_lctx, DNS_LOGCATEGORY_LAME_SERVERS,
DNS_LOGMODULE_RESOLVER, ISC_LOG_INFO, DNS_LOGMODULE_RESOLVER, ISC_LOG_INFO,
"%s %s%s%sresolving '%s': %s", "%s %s%s%sresolving '%s': %s",
dns_result_totext(reason), sep1, code, sep2, dns_result_totext(reason), sep1, code, sep2,