summaryrefslogtreecommitdiff
path: root/lib/dns/xfrin.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dns/xfrin.c')
-rw-r--r--lib/dns/xfrin.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/dns/xfrin.c b/lib/dns/xfrin.c
index a2bc35dc8a55d..aec238d3fc1af 100644
--- a/lib/dns/xfrin.c
+++ b/lib/dns/xfrin.c
@@ -292,6 +292,9 @@ axfr_putdata(dns_xfrin_ctx_t *xfr, dns_diffop_t op,
dns_difftuple_t *tuple = NULL;
+ if (rdata->rdclass != xfr->rdclass)
+ return(DNS_R_BADCLASS);
+
CHECK(dns_zone_checknames(xfr->zone, name, rdata));
CHECK(dns_difftuple_create(xfr->diff.mctx, op,
name, ttl, rdata, &tuple));
@@ -377,8 +380,11 @@ ixfr_putdata(dns_xfrin_ctx_t *xfr, dns_diffop_t op,
dns_name_t *name, dns_ttl_t ttl, dns_rdata_t *rdata)
{
isc_result_t result;
-
dns_difftuple_t *tuple = NULL;
+
+ if (rdata->rdclass != xfr->rdclass)
+ return(DNS_R_BADCLASS);
+
if (op == DNS_DIFFOP_ADD)
CHECK(dns_zone_checknames(xfr->zone, name, rdata));
CHECK(dns_difftuple_create(xfr->diff.mctx, op,
@@ -1224,10 +1230,17 @@ xfrin_recv_done(isc_task_t *task, isc_event_t *ev) {
DNS_MESSAGEPARSE_PRESERVEORDER);
if (result != ISC_R_SUCCESS || msg->rcode != dns_rcode_noerror ||
+ msg->opcode != dns_opcode_query ||msg->rdclass != xfr->rdclass ||
(xfr->checkid && msg->id != xfr->id)) {
- if (result == ISC_R_SUCCESS)
+ if (result == ISC_R_SUCCESS && msg->rcode != dns_rcode_noerror)
result = ISC_RESULTCLASS_DNSRCODE + msg->rcode; /*XXX*/
- if (result == ISC_R_SUCCESS || result == DNS_R_NOERROR)
+ else if (result == ISC_R_SUCCESS &&
+ msg->opcode != dns_opcode_query)
+ result = DNS_R_UNEXPECTEDOPCODE;
+ else if (result == ISC_R_SUCCESS &&
+ msg->rdclass != xfr->rdclass)
+ result = DNS_R_BADCLASS;
+ else if (result == ISC_R_SUCCESS || result == DNS_R_NOERROR)
result = DNS_R_UNEXPECTEDID;
if (xfr->reqtype == dns_rdatatype_axfr ||
xfr->reqtype == dns_rdatatype_soa)