Skip to content
Snippets Groups Projects
Commit ec928660 authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

Small correction for name->FQDN converting code.

refs #1423
parent 66933e2b
No related branches found
No related tags found
No related merge requests found
......@@ -477,20 +477,28 @@ zone_start: TEXT {
this_zone->notify_retries = 0; // Default policy applies
this_zone->ixfr_fslimit = -1; // Default policy applies
this_zone->dbsync_timeout = -1; // Default policy applies
this_zone->name = $1.t;
// Append mising dot to ensure FQDN
size_t nlen = strlen(this_zone->name);
if (this_zone->name[nlen - 1] != '.') {
this_zone->name = realloc(this_zone->name, nlen + 1 + 1);
strcat(this_zone->name, ".");
char *name = $1.t;
size_t nlen = strlen(name);
if (name[nlen - 1] != '.') {
this_zone->name = malloc(nlen + 2);
if (this_zone->name != NULL) {
memcpy(this_zone->name, name, nlen);
this_zone->name[nlen] = '.';
this_zone->name[nlen + 1] = '\0';
}
free(name);
} else {
this_zone->name = name; /* Already FQDN */
}
/* Check domain name. */
knot_dname_t *dn = knot_dname_new_from_str(this_zone->name,
nlen + 1,
0);
if (dn == 0) {
knot_dname_t *dn = NULL;
if (this_zone->name != NULL) {
dn = knot_dname_new_from_str(this_zone->name, nlen + 1, 0);
}
if (dn == NULL) {
free(this_zone->name);
free(this_zone);
cf_error(scanner, "invalid zone origin");
......
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