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

Better handling of CNAME loop in IXFR-in

refs #1565
parent 2ee233b9
No related branches found
No related tags found
No related merge requests found
......@@ -65,7 +65,8 @@ enum knot_error {
KNOT_EXFRREFUSED, /*!< Zone transfer refused by the server. */
KNOT_ECONN, /*!< Connection reset. */
KNOT_EIXFRSPACE, /*!< IXFR reply did not fit in. */
KNOT_ERROR_COUNT = 31
KNOT_ECNAME, /*!< CNAME loop found in zone. */
KNOT_ERROR_COUNT = 32
};
/*! \brief Table linking error messages to error codes. */
......
......@@ -50,5 +50,6 @@ const error_table_t knot_error_msgs[KNOT_ERROR_COUNT] = {
{KNOT_TSIG_EBADTIME, "TSIG signing time out of range." },
{KNOT_ECONN, "Connection reset."},
{KNOT_EIXFRSPACE, "IXFR reply did not fit in."},
{KNOT_ECNAME, "CNAME loop found in zone."},
{KNOT_ERROR, 0}
};
......@@ -972,7 +972,7 @@ static void knot_zone_contents_check_loops_in_tree(knot_zone_tree_node_t *tnode,
if (cname != NULL) {
// this means the node is in the chain already
args->err = /*KNOT_ENOIXFR*/KNOT_ERROR;
args->err = KNOT_ERROR;
}
cname_chain_free(chain);
......@@ -2210,11 +2210,17 @@ int knot_zone_contents_adjust(knot_zone_contents_t *zone)
/*
* In second walkthrough check CNAME loops, including wildcards.
*/
adjust_arg.err = KNOT_EOK;
dbg_zone("Checking CNAME and wildcard loops.\n");
knot_zone_tree_forward_apply_inorder(zone->nodes,
knot_zone_contents_check_loops_in_tree,
(void *)&adjust_arg);
if (adjust_arg.err != KNOT_EOK) {
dbg_zone("Found CNAME loop in data. Aborting transfer.\n");
return adjust_arg.err;
}
adjust_arg.first_node = NULL;
adjust_arg.previous_node = NULL;
......
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