Skip to content
Snippets Groups Projects
Commit 932fcb81 authored by Lubos Slovak's avatar Lubos Slovak
Browse files

Minor fixes in answering.

When processing DNAME, the actual qname should be used instead of
  the one from the query (e.g. when after CNAME).
Saving the actual qname before stripping and using it in DNAME and
  wildcard processing.
parent 7d8ea541
No related branches found
No related tags found
No related merge requests found
......@@ -61,3 +61,5 @@ sub5 CNAME sub3
*.l.example.com. CNAME c.example.com.
*.m.example.com. NS ns.sub2.example.com.
*.n.example.com. DNAME bogus25.com.
o.example.com. CNAME a.e.example.com.
p.example.com. CNAME a.sub.example.com.
......@@ -640,6 +640,7 @@ void ns_answer( zdb_database *zdb, const ldns_rr *question, ldns_pkt *response,
int cname = 0;
while (1) {
ldns_rdf *qname_old = ldns_rdf_clone(qname);
uint labels = ldns_dname_label_count(qname);
uint labels_found = labels;
......@@ -674,8 +675,7 @@ void ns_answer( zdb_database *zdb, const ldns_rr *question, ldns_pkt *response,
ldns_rr_list *dname_rrset = NULL;
if ((dname_rrset = zn_find_rrset(node, LDNS_RR_TYPE_DNAME))
!= NULL) {
ns_process_dname(dname_rrset, ldns_rr_owner(question), response,
copied_rrs);
ns_process_dname(dname_rrset, qname_old, response, copied_rrs);
break;
} else {
// wildcard child?
......@@ -705,9 +705,9 @@ void ns_answer( zdb_database *zdb, const ldns_rr *question, ldns_pkt *response,
break;
} else {
node = wildcard_node;
// renew the qname to be the one from the query
// renew the qname to be the old one (not stripped)
ldns_rdf_deep_free(qname);
qname = ldns_rdf_clone(ldns_rr_owner(question));
qname = ldns_rdf_clone(qname_old);
debug_ns("Node's owner: %s\n", ldns_rdf2str(node->owner));
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment