summaryrefslogtreecommitdiffstats
path: root/daemon/zimport.c
diff options
context:
space:
mode:
authorIvana Krumlová <ivana.krumlova@nic.cz>2019-07-04 17:06:02 +0200
committerIvana Krumlová <ivana.krumlova@nic.cz>2019-07-09 14:05:39 +0200
commit9b38be40e9d02f3eb9dc90e3069e95aaea8164e1 (patch)
tree953dd50a9845bfebe330106591bef120c646fe85 /daemon/zimport.c
parentzimport: avoid crash on empty zone file (diff)
downloadknot-resolver-9b38be40e9d02f3eb9dc90e3069e95aaea8164e1.tar.xz
knot-resolver-9b38be40e9d02f3eb9dc90e3069e95aaea8164e1.zip
prefill: check correct origin attribute
name of SOA record must be "."
Diffstat (limited to 'daemon/zimport.c')
-rw-r--r--daemon/zimport.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/daemon/zimport.c b/daemon/zimport.c
index 5bcc54c5..cf1021ef 100644
--- a/daemon/zimport.c
+++ b/daemon/zimport.c
@@ -687,14 +687,9 @@ static int zi_state_parsing(zs_scanner_t *s)
}
zone_import_ctx_t *z_import = (zone_import_ctx_t *) s->process.data;
empty = false;
- if (z_import->origin == 0) {
- z_import->origin = knot_dname_copy(s->zone_origin,
- &z_import->pool);
- } else if (!knot_dname_is_equal(z_import->origin, s->zone_origin)) {
- kr_log_error("[zscanner] line: %"PRIu64
- ": zone origin changed unexpectedly\n",
- s->line_counter);
- return -1;
+ if (s->r_type == 6) {
+ z_import->origin = knot_dname_copy(s->r_owner,
+ &z_import->pool);
}
break;
case ZS_STATE_ERROR:
@@ -714,6 +709,10 @@ static int zi_state_parsing(zs_scanner_t *s)
kr_log_error("[zimport] empty zone file\n");
return -1;
}
+ if (!((zone_import_ctx_t *) s->process.data)->origin) {
+ kr_log_error("[zimport] zone file doesn't contain SOA record\n");
+ return -1;
+ }
return (s->error.counter == 0) ? 0 : -1;
default:
kr_log_error("[zscanner] line: %"PRIu64