Skip to content
Snippets Groups Projects
Commit 1c28a5fb authored by Jan Kadlec's avatar Jan Kadlec
Browse files

Merge remote-tracking branch 'origin' into ddns-uppercase-tsig

parents 375cea9f 7b6eca40
No related branches found
No related tags found
1 merge request!268Ddns uppercase tsig
......@@ -440,10 +440,9 @@ int hhash_find_next(hhash_t* tbl, const char* key, uint16_t len, value_t** dst)
}
int k = BIN_SEARCH_FIRST_GE_CMP(tbl, tbl->weight, CMP_LE, key, len);
hhelem_t *found = tbl->item + tbl->index[k];
/* Found prev or equal, we want next */
if (k + 1 < tbl->weight) {
found = tbl->item + tbl->index[k + 1];
hhelem_t *found = tbl->item + tbl->index[k + 1];
*dst = (value_t *)KEY_VAL(found->d);
return 0;
} else {
......
......@@ -141,7 +141,7 @@ int zcreator_step(zcreator_t *zc, const knot_rrset_t *rr)
return ret;
}
return sem_fatal_error ? KNOT_EMALF : KNOT_EOK;
return sem_fatal_error ? KNOT_ESEMCHECK : KNOT_EOK;
}
/*! \brief Creates RR from parser input, passes it to handling function. */
......@@ -149,6 +149,7 @@ static void scanner_process(zs_scanner_t *scanner)
{
zcreator_t *zc = scanner->data;
if (zc->ret != KNOT_EOK) {
scanner->stop = true;
return;
}
......@@ -173,13 +174,9 @@ static void scanner_process(zs_scanner_t *scanner)
return;
}
ret = zcreator_step(zc, &rr);
zc->ret = zcreator_step(zc, &rr);
knot_dname_free(&owner, NULL);
knot_rdataset_clear(&rr.rrs, NULL);
if (ret != KNOT_EOK) {
zc->ret = ret;
return;
}
}
static zone_contents_t *create_zone_from_name(const char *origin)
......@@ -254,9 +251,9 @@ zone_contents_t *zonefile_load(zloader_t *loader)
assert(zc);
int ret = zs_scanner_parse_file(loader->scanner, loader->source);
if (ret != 0) {
if (ret != 0 && loader->scanner->error_counter == 0) {
ERROR(zname, "could not load zone, file '%s' (%s)",
loader->source, zs_strerror(ret));
loader->source, zs_strerror(loader->scanner->error_code));
goto fail;
}
......@@ -281,7 +278,7 @@ zone_contents_t *zonefile_load(zloader_t *loader)
zone_node_t *last_nsec3_node = NULL;
int kret = zone_contents_adjust_full(zc->z,
&first_nsec3_node, &last_nsec3_node);
&first_nsec3_node, &last_nsec3_node);
if (kret != KNOT_EOK) {
ERROR(zname, "failed to finalize zone contents (%s)",
knot_strerror(kret));
......
......@@ -45,6 +45,7 @@ const error_table_t error_messages[] = {
{ KNOT_ERROR, "failed" },
{ KNOT_ENOTRUNNING, "resource is not running" },
{ KNOT_EPARSEFAIL, "parser failed" },
{ KNOT_ESEMCHECK, "semantic check" },
{ KNOT_EEXPIRED, "resource is expired" },
{ KNOT_EUPTODATE, "zone is up-to-date" },
{ KNOT_EFEWDATA, "not enough data to parse" },
......
......@@ -61,6 +61,7 @@ enum knot_error {
KNOT_ERROR = -10000,
KNOT_ENOTRUNNING,
KNOT_EPARSEFAIL,
KNOT_ESEMCHECK,
KNOT_EEXPIRED,
KNOT_EUPTODATE,
KNOT_EFEWDATA,
......
......@@ -257,6 +257,7 @@ static int parse_partial_rr(zs_scanner_t *s, const char *lp, unsigned flags)
return KNOT_EPARSEFAIL;
}
cls = buff;
buff = NULL;
s->r_class = num;
DBG("%s: parsed class=%u '%s'\n", __func__, s->r_class, cls);
lp = tok_skipspace(lp + len);
......@@ -271,11 +272,14 @@ static int parse_partial_rr(zs_scanner_t *s, const char *lp, unsigned flags)
}
if (knot_rrtype_from_string(buff, &num) == 0) {
type = buff;
buff = NULL;
s->r_type = num;
DBG("%s: parsed type=%u '%s'\n", __func__, s->r_type, type);
lp = tok_skipspace(lp + len);
}
free(buff);
/* Remainder */
if (*lp == '\0') {
free(cls);
......
......@@ -279,7 +279,9 @@ int zs_scanner_parse(zs_scanner_t *scanner,
* \brief Parses specified zone file.
*
* \note Zone scanner error code and other information are stored in
* the scanner structure.
* the scanner structure. If error and error_count == 0, there is
* a more general problem with loading and this error is not processed
* with process_error!
*
* \param scanner Zone scanner.
* \param file_name Name of file to process.
......
......@@ -10,8 +10,10 @@ t.link(zone, knot, ddns=True)
t.start()
zone[0].name = "examPle.com"
update = knot.update(zone)
update.add("knot.example.com.", 60, "TXT", "test")
update.add("kNoT.ExamPle.com.", 60, "TXT", "test")
update.add("test.example.com.", 60, "TXT", "test")
update.send("NOERROR")
resp = knot.dig("knot.example.com.", "TXT")
......
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