mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-23 15:58:58 -04:00
Check opcode of messages returned by dns_request_getresponse
(cherry picked from commit ed4e00713f)
This commit is contained in:
parent
7f25f79afd
commit
498de906fa
2 changed files with 81 additions and 0 deletions
|
|
@ -2472,6 +2472,10 @@ update_completed(isc_task_t *task, isc_event_t *event) {
|
|||
check_result(result, "dns_request_getresponse");
|
||||
}
|
||||
|
||||
if (answer->opcode != dns_opcode_update) {
|
||||
fatal("invalid OPCODE in response to UPDATE request");
|
||||
}
|
||||
|
||||
if (answer->rcode != dns_rcode_noerror) {
|
||||
seenerror = true;
|
||||
if (!debugging) {
|
||||
|
|
@ -2678,6 +2682,10 @@ recvsoa(isc_task_t *task, isc_event_t *event) {
|
|||
show_message(stderr, rcvmsg, "Reply from SOA query:");
|
||||
}
|
||||
|
||||
if (rcvmsg->opcode != dns_opcode_query) {
|
||||
fatal("invalid OPCODE in response to SOA query");
|
||||
}
|
||||
|
||||
if (rcvmsg->rcode != dns_rcode_noerror &&
|
||||
rcvmsg->rcode != dns_rcode_nxdomain) {
|
||||
fatal("response to SOA query was unsuccessful");
|
||||
|
|
@ -3151,6 +3159,10 @@ recvgss(isc_task_t *task, isc_event_t *event) {
|
|||
"recvmsg reply from GSS-TSIG query");
|
||||
}
|
||||
|
||||
if (rcvmsg->opcode != dns_opcode_query) {
|
||||
fatal("invalid OPCODE in response to GSS-TSIG query");
|
||||
}
|
||||
|
||||
if (rcvmsg->rcode == dns_rcode_formerr && !tried_other_gsstsig) {
|
||||
ddebug("recvgss trying %s GSS-TSIG",
|
||||
use_win2k_gsstsig ? "Standard" : "Win2k");
|
||||
|
|
|
|||
|
|
@ -58,6 +58,7 @@
|
|||
#include <dns/name.h>
|
||||
#include <dns/nsec.h>
|
||||
#include <dns/nsec3.h>
|
||||
#include <dns/opcode.h>
|
||||
#include <dns/peer.h>
|
||||
#include <dns/private.h>
|
||||
#include <dns/rcode.h>
|
||||
|
|
@ -13073,6 +13074,23 @@ stub_glue_response_cb(isc_task_t *task, isc_event_t *event) {
|
|||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unexpected opcode.
|
||||
*/
|
||||
if (msg->opcode != dns_opcode_query) {
|
||||
char opcode[128];
|
||||
isc_buffer_t rb;
|
||||
|
||||
isc_buffer_init(&rb, opcode, sizeof(opcode));
|
||||
(void)dns_opcode_totext(msg->rcode, &rb);
|
||||
|
||||
dns_zone_log(zone, ISC_LOG_INFO,
|
||||
"refreshing stub: "
|
||||
"unexpected opcode (%.*s) from %s (source %s)",
|
||||
(int)rb.used, opcode, master, source);
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unexpected rcode.
|
||||
*/
|
||||
|
|
@ -13485,6 +13503,23 @@ stub_callback(isc_task_t *task, isc_event_t *event) {
|
|||
goto next_master;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unexpected opcode.
|
||||
*/
|
||||
if (msg->opcode != dns_opcode_query) {
|
||||
char opcode[128];
|
||||
isc_buffer_t rb;
|
||||
|
||||
isc_buffer_init(&rb, opcode, sizeof(opcode));
|
||||
(void)dns_opcode_totext(msg->rcode, &rb);
|
||||
|
||||
dns_zone_log(zone, ISC_LOG_INFO,
|
||||
"refreshing stub: "
|
||||
"unexpected opcode (%.*s) from %s (source %s)",
|
||||
(int)rb.used, opcode, master, source);
|
||||
goto next_master;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unexpected rcode.
|
||||
*/
|
||||
|
|
@ -13874,6 +13909,23 @@ refresh_callback(isc_task_t *task, isc_event_t *event) {
|
|||
goto next_master;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unexpected opcode.
|
||||
*/
|
||||
if (msg->opcode != dns_opcode_query) {
|
||||
char opcode[128];
|
||||
isc_buffer_t rb;
|
||||
|
||||
isc_buffer_init(&rb, opcode, sizeof(opcode));
|
||||
(void)dns_opcode_totext(msg->rcode, &rb);
|
||||
|
||||
dns_zone_log(zone, ISC_LOG_INFO,
|
||||
"refresh: "
|
||||
"unexpected opcode (%.*s) from %s (source %s)",
|
||||
(int)rb.used, opcode, master, source);
|
||||
goto next_master;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unexpected rcode.
|
||||
*/
|
||||
|
|
@ -18044,6 +18096,23 @@ forward_callback(isc_task_t *task, isc_event_t *event) {
|
|||
goto next_master;
|
||||
}
|
||||
|
||||
/*
|
||||
* Unexpected opcode.
|
||||
*/
|
||||
if (msg->opcode != dns_opcode_update) {
|
||||
char opcode[128];
|
||||
isc_buffer_t rb;
|
||||
|
||||
isc_buffer_init(&rb, opcode, sizeof(opcode));
|
||||
(void)dns_opcode_totext(msg->rcode, &rb);
|
||||
|
||||
dns_zone_log(zone, ISC_LOG_INFO,
|
||||
"forwarding dynamic update: "
|
||||
"unexpected opcode (%.*s) from %s",
|
||||
(int)rb.used, opcode, master);
|
||||
goto next_master;
|
||||
}
|
||||
|
||||
switch (msg->rcode) {
|
||||
/*
|
||||
* Pass these rcodes back to client.
|
||||
|
|
|
|||
Loading…
Reference in a new issue