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

Changes in CNAME adjusting and resolving.

Was not marking the node as CNAME if the canonical name node was
  not present.
Was not copying the last CNAME record in chain if the next
  canonical name was not present.
parent d1bfc563
No related branches found
No related tags found
No related merge requests found
......@@ -22,3 +22,5 @@ ns.sub A 10.1.0.1 ; glue
a A 10.0.0.4
*.a A 10.0.0.5
c CNAME c.a.example.com.
......@@ -10,7 +10,7 @@
//#define CUCKOO_DEBUG_HASH
//#define ZP_DEBUG
//#define NS_DEBUG
//#define ZDB_DEBUG
#define ZDB_DEBUG
//#define ZN_DEBUG
//#define ZP_DEBUG_PARSE
......
......@@ -129,7 +129,8 @@ void ns_follow_cname( const zn_node **node, const ldns_rdf **qname,
ldns_pkt *response, ldns_rr_list *copied_rrs )
{
debug_ns("Resolving CNAME chain...\n");
while (zn_get_ref_cname(*node) != NULL) {
assert(zn_has_cname(*node) > 0);
do {
// put the CNAME record to answer, but replace the possible wildcard
// name with qname
ldns_rr_list *cname_rrset = zn_find_rrset((*node), LDNS_RR_TYPE_CNAME);
......@@ -151,20 +152,9 @@ void ns_follow_cname( const zn_node **node, const ldns_rdf **qname,
// save the new name which should be used for replacing wildcard
*qname = ldns_rr_rdf(cname_rr, 0);
assert(ldns_rdf_get_type(*qname) == LDNS_RDF_TYPE_DNAME);
}
} while (*node != NULL);
}
/*----------------------------------------------------------------------------*/
//static inline void ns_put_rrset( const zn_node *node, ldns_rr_type type,
// ldns_pkt_section section, ldns_pkt *response )
//{
// ldns_rr_list *rrset = zn_find_rrset(node, type);
// if (rrset != NULL) {
// ldns_pkt_push_rr_list(response, section, rrset);
// }
//}
/*----------------------------------------------------------------------------*/
/*!
* @todo Check return values from push functions!
......
......@@ -349,10 +349,8 @@ int zn_is_delegation_point( const zn_node *node )
void zn_set_ref_cname( zn_node *node, zn_node *cname_ref )
{
assert(node->ref.cname == NULL);
if (cname_ref != NULL) {
node->ref.cname = cname_ref;
zn_flags_set(&node->flags, FLAGS_HAS_CNAME);
}
node->ref.cname = cname_ref;
zn_flags_set(&node->flags, FLAGS_HAS_CNAME);
}
/*----------------------------------------------------------------------------*/
......
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