zone.c
Go to the documentation of this file.
/*
* Copyright (c) 2009 NLNet Labs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
* IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#include "adapter/adapter.h"
#include "file.h"
#include "hsm.h"
#include "locks.h"
#include "log.h"
#include "status.h"
#include "util.h"
#include "signer/backup.h"
#include "signer/zone.h"
#include "wire/netio.h"
#include "compat.h"
#include "daemon/signertasks.h"
#include <ldns/ldns.h>
static const char* zone_str = "zone";
zone_type*
zone_create(char* name, ldns_rr_class klass)
{
zone_type* zone = NULL;
int err;
if (!name || !klass) {
return NULL;
}
CHECKALLOC(zone = (zone_type*) calloc(1, sizeof(zone_type)));
/* [start] PS 9218653: Drop trailing dot in domain name */
if (strlen(name) > 1 && name[strlen(name)-1] == '.') {
name[strlen(name)-1] = '\0';
}
/* [end] PS 9218653 */
if (pthread_mutex_init(&zone->zone_lock, NULL)) {
free(zone);
return NULL;
}
if (pthread_mutex_init(&zone->xfr_lock, NULL)) {
(void)pthread_mutex_destroy(&zone->zone_lock);
free(zone);
return NULL;
}
zone->name = strdup(name);
if (!zone->name) {
ods_log_error("[%s] unable to create zone %s: allocator_strdup() "
"failed", zone_str, name);
zone_cleanup(zone);
return NULL;
}
zone->klass = klass;
zone->default_ttl = 3600; /* TODO: configure --default-ttl option? */
zone->apex = ldns_dname_new_frm_str(name);
/* check zone->apex? */
zone->notify_command = NULL;
zone->notify_ns = NULL;
zone->notify_args = NULL;
zone->policy_name = NULL;
zone->signconf_filename = NULL;
zone->adinbound = NULL;
zone->adoutbound = NULL;
zone->zl_status = ZONE_ZL_OK;
zone->xfrd = NULL;
zone->notify = NULL;
zone->db = namedb_create((void*)zone);
if (!zone->db) {
ods_log_error("[%s] unable to create zone %s: namedb_create() "
"failed", zone_str, name);
zone_cleanup(zone);
return NULL;
}
zone->ixfr = ixfr_create();
if (!zone->ixfr) {
ods_log_error("[%s] unable to create zone %s: ixfr_create() "
"failed", zone_str, name);
zone_cleanup(zone);
return NULL;
}
zone->zoneconfigvalid = 0;
zone->signconf = signconf_create();
if (!zone->signconf) {
ods_log_error("[%s] unable to create zone %s: signconf_create() "
"failed", zone_str, name);
zone_cleanup(zone);
return NULL;
}
zone->stats = stats_create();
zone->rrstore = rrset_store_initialize();
return zone;
}
ods_status
zone_load_signconf(zone_type* zone, signconf_type** new_signconf)
{
ods_status status = ODS_STATUS_OK;
signconf_type* signconf = NULL;
char* datestamp = NULL;
if (!zone || !zone->name || !zone->signconf) {
return ODS_STATUS_ASSERT_ERR;
}
if (!zone->signconf_filename) {
ods_log_warning("[%s] zone %s has no signconf filename, treat as "
"insecure?", zone_str, zone->name);
return ODS_STATUS_INSECURE;
}
status = signconf_update(&signconf, zone->signconf_filename,
zone->signconf->last_modified);
if (status == ODS_STATUS_OK) {
if (!signconf) {
/* this is unexpected */
ods_log_alert("[%s] unable to load signconf for zone %s: signconf "
"status ok but no signconf stored", zone_str, zone->name);
return ODS_STATUS_ASSERT_ERR;
}
(void)time_datestamp(signconf->last_modified, "%Y-%m-%d %T",
&datestamp);
ods_log_debug("[%s] zone %s signconf file %s is modified since %s",
zone_str, zone->name, zone->signconf_filename,
datestamp?datestamp:"Unknown");
free((void*)datestamp);
*new_signconf = signconf;
} else if (status == ODS_STATUS_UNCHANGED) {
/* OPENDNSSEC-686: changes happening within one second will not be
* seen
*/
(void)time_datestamp(zone->signconf->last_modified,
"%Y-%m-%d %T", &datestamp);
ods_log_verbose("[%s] zone %s signconf file %s is unchanged since "
"%s", zone_str, zone->name, zone->signconf_filename,
datestamp?datestamp:"Unknown");
free((void*)datestamp);
} else {
ods_log_error("[%s] unable to load signconf for zone %s: signconf %s "
"%s", zone_str, zone->name, zone->signconf_filename,
ods_status2str(status));
}
return status;
}
ods_status
zone_publish_dnskeys(zone_type* zone, int skip_hsm_access)
{
hsm_ctx_t* ctx = NULL;
uint32_t ttl = 0;
unsigned int i;
ods_status status = ODS_STATUS_OK;
rrset_type* rrset = NULL;
rr_type* dnskey = NULL;
if (!zone || !zone->db || !zone->signconf || !zone->signconf->keys) {
return ODS_STATUS_ASSERT_ERR;
}
ods_log_assert(zone->name);
/* hsm access */
if (!skip_hsm_access) {
ctx = hsm_create_context();
if (ctx == NULL) {
ods_log_error("[%s] unable to publish keys for zone %s: "
"error creating libhsm context", zone_str, zone->name);
return ODS_STATUS_HSM_ERR;
}
}
ttl = zone->default_ttl;
/* dnskey ttl */
if (zone->signconf->dnskey_ttl) {
ttl = (uint32_t) duration2time(zone->signconf->dnskey_ttl);
}
/* publish keys */
for (i=0; i < zone->signconf->keys->count; i++) {
if (!zone->signconf->keys->keys[i].publish) {
continue;
}
if (!zone->signconf->keys->keys[i].dnskey) {
/* get dnskey */
if (zone->signconf->keys->keys[i].resourcerecord) {
if ((status = rrset_getliteralrr(&zone->signconf->keys->keys[i].dnskey, zone->signconf->keys->keys[i].resourcerecord, ttl, zone->apex)) != ODS_STATUS_OK) {
ods_log_error("[%s] unable to publish dnskeys for zone %s: "
"error decoding literal dnskey", zone_str, zone->name);
if (!skip_hsm_access) {
hsm_destroy_context(ctx);
}
return status;
}
} else {
status = lhsm_get_key(ctx, zone->apex,
&zone->signconf->keys->keys[i], skip_hsm_access);
if (status != ODS_STATUS_OK) {
ods_log_error("[%s] unable to publish dnskeys for zone %s: "
"error creating dnskey", zone_str, zone->name);
break;
}
}
}
ods_log_debug("[%s] publish %s DNSKEY locator %s", zone_str,
zone->name, zone->signconf->keys->keys[i].locator);
if (!skip_hsm_access) {
ods_log_assert(zone->signconf->keys->keys[i].dnskey);
ldns_rr_set_ttl(zone->signconf->keys->keys[i].dnskey, ttl);
ldns_rr_set_class(zone->signconf->keys->keys[i].dnskey, zone->klass);
status = zone_add_rr(zone, zone->signconf->keys->keys[i].dnskey, 0);
if (status == ODS_STATUS_UNCHANGED) {
/* rr already exists, adjust pointer */
rrset = zone_lookup_rrset(zone, zone->apex, LDNS_RR_TYPE_DNSKEY);
ods_log_assert(rrset);
dnskey = rrset_lookup_rr(rrset,
zone->signconf->keys->keys[i].dnskey);
ods_log_assert(dnskey);
if (dnskey->rr != zone->signconf->keys->keys[i].dnskey) {
ldns_rr_free(zone->signconf->keys->keys[i].dnskey);
}
zone->signconf->keys->keys[i].dnskey = dnskey->rr;
status = ODS_STATUS_OK;
} else if (status != ODS_STATUS_OK) {
ods_log_error("[%s] unable to publish dnskeys for zone %s: "
"error adding dnskey", zone_str, zone->name);
break;
}
}
}
/* done */
if (!skip_hsm_access) {
hsm_destroy_context(ctx);
}
return status;
}
void
zone_rollback_dnskeys(zone_type* zone)
{
uint16_t i = 0;
rrset_type* rrset = NULL;
rr_type* dnskey = NULL;
if (!zone || !zone->signconf || !zone->signconf->keys) {
return;
}
rrset = zone_lookup_rrset(zone, zone->apex, LDNS_RR_TYPE_DNSKEY);
/* unlink dnskey rrs */
for (i=0; i < zone->signconf->keys->count; i++) {
if (rrset && zone->signconf->keys->keys[i].dnskey) {
dnskey = rrset_lookup_rr(rrset,
zone->signconf->keys->keys[i].dnskey);
if (dnskey && !dnskey->exists &&
dnskey->rr == zone->signconf->keys->keys[i].dnskey) {
zone->signconf->keys->keys[i].dnskey = NULL;
}
}
}
}
ods_status
zone_publish_nsec3param(zone_type* zone)
{
rrset_type* rrset = NULL;
rr_type* n3prr = NULL;
ldns_rr* rr = NULL;
ods_status status = ODS_STATUS_OK;
if (!zone || !zone->name || !zone->db || !zone->signconf) {
return ODS_STATUS_ASSERT_ERR;
}
if (!zone->signconf->nsec3params) {
/* NSEC */
ods_log_assert(zone->signconf->nsec_type == LDNS_RR_TYPE_NSEC);
return ODS_STATUS_OK;
}
if (!zone->signconf->nsec3params->rr) {
uint32_t paramttl =
(uint32_t) duration2time(zone->signconf->nsec3param_ttl);
rr = ldns_rr_new_frm_type(LDNS_RR_TYPE_NSEC3PARAMS);
if (!rr) {
ods_log_error("[%s] unable to publish nsec3params for zone %s: "
"error creating rr (%s)", zone_str, zone->name,
ods_status2str(status));
return ODS_STATUS_MALLOC_ERR;
}
ldns_rr_set_class(rr, zone->klass);
ldns_rr_set_ttl(rr, paramttl);
ldns_rr_set_owner(rr, ldns_rdf_clone(zone->apex));
ldns_nsec3_add_param_rdfs(rr,
zone->signconf->nsec3params->algorithm, 0,
zone->signconf->nsec3params->iterations,
zone->signconf->nsec3params->salt_len,
zone->signconf->nsec3params->salt_data);
ldns_set_bit(ldns_rdf_data(ldns_rr_rdf(rr, 1)), 7, 0);
zone->signconf->nsec3params->rr = rr;
}
/* Delete all nsec3param rrs. */
(void) zone_del_nsec3params(zone);
ods_log_assert(zone->signconf->nsec3params->rr);
status = zone_add_rr(zone, ldns_rr_clone(zone->signconf->nsec3params->rr), 0);
if (status == ODS_STATUS_UNCHANGED) {
status = ODS_STATUS_OK;
} else if (status != ODS_STATUS_OK) {
ods_log_error("[%s] unable to publish nsec3params for zone %s: "
"error adding nsec3params (%s)", zone_str,
zone->name, ods_status2str(status));
}
return status;
}
void
zone_rollback_nsec3param(zone_type* zone)
{
rrset_type* rrset = NULL;
rr_type* n3prr = NULL;
if (!zone || !zone->signconf || !zone->signconf->nsec3params) {
return;
}
rrset = zone_lookup_rrset(zone, zone->apex, LDNS_RR_TYPE_NSEC3PARAMS);
if (rrset && zone->signconf->nsec3params->rr) {
n3prr = rrset_lookup_rr(rrset, zone->signconf->nsec3params->rr);
if (n3prr && !n3prr->exists &&
n3prr->rr == zone->signconf->nsec3params->rr) {
zone->signconf->nsec3params->rr = NULL;
}
}
}
ods_status
zone_prepare_keys(zone_type* zone)
{
hsm_ctx_t* ctx = NULL;
uint16_t i = 0;
ods_status status = ODS_STATUS_OK;
if (!zone || !zone->db || !zone->signconf || !zone->signconf->keys) {
return ODS_STATUS_ASSERT_ERR;
}
ods_log_assert(zone->name);
/* hsm access */
ctx = hsm_create_context();
if (ctx == NULL) {
ods_log_error("[%s] unable to prepare signing keys for zone %s: "
"error creating libhsm context", zone_str, zone->name);
return ODS_STATUS_HSM_ERR;
}
/* prepare keys */
for (i=0; i < zone->signconf->keys->count; i++) {
if(zone->signconf->dnskey_signature != NULL && zone->signconf->keys->keys[i].ksk)
continue;
/* get dnskey */
status = lhsm_get_key(ctx, zone->apex, &zone->signconf->keys->keys[i], 0);
if (status != ODS_STATUS_OK) {
ods_log_error("[%s] unable to prepare signing keys for zone %s: "
"error getting dnskey", zone_str, zone->name);
break;
}
ods_log_assert(zone->signconf->keys->keys[i].dnskey);
ods_log_assert(zone->signconf->keys->keys[i].params);
}
/* done */
hsm_destroy_context(ctx);
return status;
}
ods_status
zone_update_serial(zone_type* zone)
{
ods_status status = ODS_STATUS_OK;
rrset_type* rrset = NULL;
rr_type* soa = NULL;
ldns_rr* rr = NULL;
ldns_rdf* soa_rdata = NULL;
ods_log_assert(zone);
ods_log_assert(zone->apex);
ods_log_assert(zone->name);
ods_log_assert(zone->db);
ods_log_assert(zone->signconf);
if (zone->db->serial_updated) {
/* already done, unmark and return ok */
ods_log_debug("[%s] zone %s soa serial already up to date",
zone_str, zone->name);
zone->db->serial_updated = 0;
return ODS_STATUS_OK;
}
rrset = zone_lookup_rrset(zone, zone->apex, LDNS_RR_TYPE_SOA);
if (!rrset || !rrset->rrs || !rrset->rrs[0].rr) {
ods_log_error("[%s] unable to update zone %s soa serial: failed to "
"find soa rrset", zone_str, zone->name);
return ODS_STATUS_ERR;
}
ods_log_assert(rrset);
ods_log_assert(rrset->rrs);
ods_log_assert(rrset->rrs[0].rr);
rr = ldns_rr_clone(rrset->rrs[0].rr);
if (!rr) {
ods_log_error("[%s] unable to update zone %s soa serial: failed to "
"clone soa rr", zone_str, zone->name);
return ODS_STATUS_ERR;
}
status = namedb_update_serial(zone->db, zone->name,
zone->signconf->soa_serial, zone->db->inbserial);
if (status != ODS_STATUS_OK) {
ods_log_error("[%s] unable to update zone %s soa serial: %s",
zone_str, zone->name, ods_status2str(status));
if (status == ODS_STATUS_CONFLICT_ERR) {
ods_log_error("[%s] If this is the result of a key rollover, "
"please increment the serial in the unsigned zone %s",
zone_str, zone->name);
}
ldns_rr_free(rr);
return status;
}
ods_log_verbose("[%s] zone %s set soa serial to %u", zone_str,
zone->name, zone->db->intserial);
soa_rdata = ldns_rr_set_rdf(rr,
ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32,
zone->db->intserial), SE_SOA_RDATA_SERIAL);
if (soa_rdata) {
ldns_rdf_deep_free(soa_rdata);
soa_rdata = NULL;
} else {
ods_log_error("[%s] unable to update zone %s soa serial: failed to "
"replace soa serial rdata", zone_str, zone->name);
ldns_rr_free(rr);
return ODS_STATUS_ERR;
}
soa = rrset_add_rr(rrset, rr);
ods_log_assert(soa);
rrset_diff(rrset, 0, 0);
zone->db->serial_updated = 0;
return ODS_STATUS_OK;
}
rrset_type*
zone_lookup_rrset(zone_type* zone, ldns_rdf* owner, ldns_rr_type type)
{
domain_type* domain = NULL;
if (!zone || !owner || !type) {
return NULL;
}
domain = namedb_lookup_domain(zone->db, owner);
if (!domain) {
return NULL;
}
return domain_lookup_rrset(domain, type);
}
ods_status
zone_add_rr(zone_type* zone, ldns_rr* rr, int do_stats)
{
domain_type* domain = NULL;
rrset_type* rrset = NULL;
rr_type* record = NULL;
ods_status status = ODS_STATUS_OK;
ods_log_assert(rr);
ods_log_assert(zone);
ods_log_assert(zone->name);
ods_log_assert(zone->db);
ods_log_assert(zone->signconf);
/* If we already have this RR, return ODS_STATUS_UNCHANGED */
domain = namedb_lookup_domain(zone->db, ldns_rr_owner(rr));
if (!domain) {
domain = namedb_add_domain(zone->db, ldns_rr_owner(rr));
if (!domain) {
ods_log_error("[%s] unable to add RR to zone %s: "
"failed to add domain", zone_str, zone->name);
return ODS_STATUS_ERR;
}
if (ldns_dname_compare(domain->dname, zone->apex) == 0) {
domain->is_apex = 1;
} else {
status = namedb_domain_entize(zone->db, domain, zone->apex);
if (status != ODS_STATUS_OK) {
ods_log_error("[%s] unable to add RR to zone %s: "
"failed to entize domain", zone_str, zone->name);
return ODS_STATUS_ERR;
}
}
}
rrset = domain_lookup_rrset(domain, ldns_rr_get_type(rr));
if (!rrset) {
rrset = rrset_create(domain->zone, ldns_rr_get_type(rr));
if (!rrset) {
ods_log_error("[%s] unable to add RR to zone %s: "
"failed to add RRset", zone_str, zone->name);
return ODS_STATUS_ERR;
}
domain_add_rrset(domain, rrset);
}
record = rrset_lookup_rr(rrset, rr);
uint32_t ttl_rr = ldns_rr_ttl(rr);
uint32_t ttl_rrset = rrset_lookup_ttl(rrset, ttl_rr);
if (record && ttl_rr == ttl_rrset && ttl_rr == ldns_rr_ttl(record->rr)) {
record->is_added = 1; /* already exists, just mark added */
record->is_removed = 0; /* unset is_removed */
return ODS_STATUS_UNCHANGED;
} else {
record = rrset_add_rr(rrset, rr);
ods_log_assert(record);
ods_log_assert(record->rr);
ods_log_assert(record->is_added);
if (ttl_rr != ttl_rrset) {
char *str = ldns_rr2str(rr);
str[(strlen(str)) - 1] = '\0';
for (int i = 0; i < strlen(str); i++) {
if (str[i] == '\t') {
str[i] = ' ';
}
}
ods_log_error("In zone file %s: TTL for the record '%s' (%d) not"
" equal to recordset TTL (%d)", zone->name, str, ttl_rr, ttl_rrset);
LDNS_FREE(str);
}
}
/* update stats */
if (do_stats && zone->stats) {
zone->stats->sort_count += 1;
}
return ODS_STATUS_OK;
}
ods_status
zone_del_rr(zone_type* zone, ldns_rr* rr, int do_stats)
{
domain_type* domain = NULL;
rrset_type* rrset = NULL;
rr_type* record = NULL;
ods_log_assert(rr);
ods_log_assert(zone);
ods_log_assert(zone->name);
ods_log_assert(zone->db);
ods_log_assert(zone->signconf);
domain = namedb_lookup_domain(zone->db, ldns_rr_owner(rr));
if (!domain) {
ods_log_warning("[%s] unable to delete RR from zone %s: "
"domain not found", zone_str, zone->name);
return ODS_STATUS_UNCHANGED;
}
rrset = domain_lookup_rrset(domain, ldns_rr_get_type(rr));
if (!rrset) {
ods_log_warning("[%s] unable to delete RR from zone %s: "
"RRset not found", zone_str, zone->name);
return ODS_STATUS_UNCHANGED;
}
record = rrset_lookup_rr(rrset, rr);
if (!record) {
ods_log_error("[%s] unable to delete RR from zone %s: "
"RR not found", zone_str, zone->name);
return ODS_STATUS_UNCHANGED;
}
record->is_removed = 1;
record->is_added = 0; /* unset is_added */
/* update stats */
if (do_stats && zone->stats) {
zone->stats->sort_count -= 1;
}
return ODS_STATUS_OK;
}
ods_status
zone_del_nsec3params(zone_type* zone)
{
domain_type* domain = NULL;
rrset_type* rrset = NULL;
int i;
ods_log_assert(zone);
ods_log_assert(zone->name);
ods_log_assert(zone->db);
domain = namedb_lookup_domain(zone->db, zone->apex);
if (!domain) {
ods_log_verbose("[%s] unable to delete RR from zone %s: "
"domain not found", zone_str, zone->name);
return ODS_STATUS_UNCHANGED;
}
rrset = domain_lookup_rrset(domain, LDNS_RR_TYPE_NSEC3PARAMS);
if (!rrset) {
ods_log_verbose("[%s] NSEC3PARAM in zone %s not found: "
"skipping delete", zone_str, zone->name);
return ODS_STATUS_UNCHANGED;
}
/* We don't actually delete the record as we still need the
* information in the IXFR. Just set it as removed. The code
* inserting the new record may flip this flag when the record
* hasn't changed. */
for (i=0; i < rrset->rr_count; i++) {
rrset->rrs[i].is_removed = 1;
}
return ODS_STATUS_OK;
}
void
zone_merge(zone_type* z1, zone_type* z2)
{
const char* str;
adapter_type* adtmp = NULL;
if (!z1 || !z2) {
return;
}
/* policy name */
if (ods_strcmp(z2->policy_name, z1->policy_name) != 0) {
if (z2->policy_name) {
str = strdup(z2->policy_name);
if (!str) {
ods_log_error("[%s] failed to merge policy %s name to zone "
"%s", zone_str, z2->policy_name, z1->name);
} else {
free((void*)z1->policy_name);
z1->policy_name = str;
z1->zl_status = ZONE_ZL_UPDATED;
}
} else {
free((void*)z1->policy_name);
z1->policy_name = NULL;
z1->zl_status = ZONE_ZL_UPDATED;
}
}
/* signconf filename */
if (ods_strcmp(z2->signconf_filename, z1->signconf_filename) != 0) {
if (z2->signconf_filename) {
str = strdup(z2->signconf_filename);
if (!str) {
ods_log_error("[%s] failed to merge signconf filename %s to "
"zone %s", zone_str, z2->policy_name, z1->name);
} else {
free((void*)z1->signconf_filename);
z1->signconf_filename = str;
z1->zl_status = ZONE_ZL_UPDATED;
}
} else {
free((void*)z1->signconf_filename);
z1->signconf_filename = NULL;
z1->zl_status = ZONE_ZL_UPDATED;
}
}
/* adapters */
if (adapter_compare(z2->adinbound, z1->adinbound) != 0) {
adtmp = z2->adinbound;
z2->adinbound = z1->adinbound;
z1->adinbound = adtmp;
adtmp = NULL;
}
if (adapter_compare(z2->adoutbound, z1->adoutbound) != 0) {
adtmp = z2->adoutbound;
z2->adoutbound = z1->adoutbound;
z1->adoutbound = adtmp;
adtmp = NULL;
}
}
void
zone_cleanup(zone_type* zone)
{
if (!zone) {
return;
}
pthread_mutex_lock(&zone->zone_lock);
ldns_rdf_deep_free(zone->apex);
adapter_cleanup(zone->adinbound);
adapter_cleanup(zone->adoutbound);
namedb_cleanup(zone->db);
ixfr_cleanup(zone->ixfr);
xfrd_cleanup(zone->xfrd, 1);
notify_cleanup(zone->notify);
signconf_cleanup(zone->signconf);
pthread_mutex_unlock(&zone->zone_lock);
stats_cleanup(zone->stats);
free(zone->notify_command);
free(zone->notify_args);
free((void*)zone->policy_name);
free((void*)zone->signconf_filename);
free((void*)zone->name);
collection_class_destroy(&zone->rrstore);
pthread_mutex_destroy(&zone->xfr_lock);
pthread_mutex_destroy(&zone->zone_lock);
free(zone);
}
ods_status
zone_recover2(engine_type* engine, zone_type* zone)
{
char* filename = NULL;
FILE* fd = NULL;
const char* token = NULL;
time_t when = 0;
ods_status status = ODS_STATUS_OK;
/* zone part */
int klass = 0;
uint32_t inbound = 0, internal = 0, outbound = 0;
/* signconf part */
time_t lastmod = 0;
/* nsec3params part */
const char* salt = NULL;
ods_log_assert(zone);
ods_log_assert(zone->name);
ods_log_assert(zone->signconf);
ods_log_assert(zone->db);
filename = ods_build_path(zone->name, ".backup2", 0, 1);
if (!filename) {
return ODS_STATUS_MALLOC_ERR;
}
fd = ods_fopen(filename, NULL, "r");
if (fd) {
/* start recovery */
if (!backup_read_check_str(fd, ODS_SE_FILE_MAGIC_V3)) {
ods_log_error("[%s] corrupted backup file zone %s: read magic "
"error", zone_str, zone->name);
goto recover_error2;
}
if (!backup_read_check_str(fd, ";;Time:") |
!backup_read_time_t(fd, &when)) {
ods_log_error("[%s] corrupted backup file zone %s: read time "
"error", zone_str, zone->name);
goto recover_error2;
}
/* zone stuff */
if (!backup_read_check_str(fd, ";;Zone:") |
!backup_read_check_str(fd, "name") |
!backup_read_check_str(fd, zone->name)) {
ods_log_error("[%s] corrupted backup file zone %s: read name "
"error", zone_str, zone->name);
goto recover_error2;
}
if (!backup_read_check_str(fd, "class") |
!backup_read_int(fd, &klass)) {
ods_log_error("[%s] corrupted backup file zone %s: read class "
"error", zone_str, zone->name);
goto recover_error2;
}
if (!backup_read_check_str(fd, "inbound") |
!backup_read_uint32_t(fd, &inbound) |
!backup_read_check_str(fd, "internal") |
!backup_read_uint32_t(fd, &internal) |
!backup_read_check_str(fd, "outbound") |
!backup_read_uint32_t(fd, &outbound)) {
ods_log_error("[%s] corrupted backup file zone %s: read serial "
"error", zone_str, zone->name);
goto recover_error2;
}
zone->klass = (ldns_rr_class) klass;
zone->db->inbserial = inbound;
zone->db->intserial = internal;
zone->db->outserial = outbound;
/* signconf part */
if (!backup_read_check_str(fd, ";;Signconf:") |
!backup_read_check_str(fd, "lastmod") |
!backup_read_time_t(fd, &lastmod) |
!backup_read_check_str(fd, "maxzonettl") |
!backup_read_check_str(fd, "0") |
!backup_read_check_str(fd, "resign") |
!backup_read_duration(fd, &zone->signconf->sig_resign_interval) |
!backup_read_check_str(fd, "refresh") |
!backup_read_duration(fd, &zone->signconf->sig_refresh_interval) |
!backup_read_check_str(fd, "valid") |
!backup_read_duration(fd, &zone->signconf->sig_validity_default) |
!backup_read_check_str(fd, "denial") |
!backup_read_duration(fd,&zone->signconf->sig_validity_denial) |
!backup_read_check_str(fd, "keyset") |
!backup_read_duration(fd,&zone->signconf->sig_validity_keyset) |
!backup_read_check_str(fd, "jitter") |
!backup_read_duration(fd, &zone->signconf->sig_jitter) |
!backup_read_check_str(fd, "offset") |
!backup_read_duration(fd, &zone->signconf->sig_inception_offset) |
!backup_read_check_str(fd, "nsec") |
!backup_read_rr_type(fd, &zone->signconf->nsec_type) |
!backup_read_check_str(fd, "dnskeyttl") |
!backup_read_duration(fd, &zone->signconf->dnskey_ttl) |
!backup_read_check_str(fd, "soattl") |
!backup_read_duration(fd, &zone->signconf->soa_ttl) |
!backup_read_check_str(fd, "soamin") |
!backup_read_duration(fd, &zone->signconf->soa_min) |
!backup_read_check_str(fd, "serial") |
!backup_read_str(fd, &zone->signconf->soa_serial)) {
ods_log_error("[%s] corrupted backup file zone %s: read signconf "
"error", zone_str, zone->name);
goto recover_error2;
}
/* nsec3params part */
if (zone->signconf->nsec_type == LDNS_RR_TYPE_NSEC3) {
if (!backup_read_check_str(fd, ";;Nsec3parameters:") |
!backup_read_check_str(fd, "salt") |
!backup_read_str(fd, &salt) |
!backup_read_check_str(fd, "algorithm") |
!backup_read_uint32_t(fd, &zone->signconf->nsec3_algo) |
!backup_read_check_str(fd, "optout") |
!backup_read_int(fd, &zone->signconf->nsec3_optout) |
!backup_read_check_str(fd, "iterations") |
!backup_read_uint32_t(fd, &zone->signconf->nsec3_iterations)) {
ods_log_error("[%s] corrupted backup file zone %s: read "
"nsec3parameters error", zone_str, zone->name);
goto recover_error2;
}
zone->signconf->nsec3_salt = strdup(salt);
free((void*) salt);
salt = NULL;
zone->signconf->nsec3params = nsec3params_create(
zone->signconf,
(uint8_t) zone->signconf->nsec3_algo,
(uint8_t) zone->signconf->nsec3_optout,
(uint16_t) zone->signconf->nsec3_iterations,
zone->signconf->nsec3_salt);
if (!zone->signconf->nsec3params) {
ods_log_error("[%s] corrupted backup file zone %s: unable to "
"create nsec3param", zone_str, zone->name);
goto recover_error2;
}
}
zone->signconf->last_modified = lastmod;
zone->zoneconfigvalid = 1;
zone->default_ttl = (uint32_t) duration2time(zone->signconf->soa_min);
/* keys part */
zone->signconf->keys = keylist_create((void*) zone->signconf);
while (backup_read_str(fd, &token)) {
if (ods_strcmp(token, ";;Key:") == 0) {
if (!key_recover2(fd, zone->signconf->keys)) {
ods_log_error("[%s] corrupted backup file zone %s: read "
"key error", zone_str, zone->name);
goto recover_error2;
}
} else if (ods_strcmp(token, ";;") == 0) {
/* keylist done */
free((void*) token);
token = NULL;
break;
} else {
/* keylist corrupted */
goto recover_error2;
}
free((void*) token);
token = NULL;
}
/* publish dnskeys */
status = zone_publish_dnskeys(zone, 1);
if (status != ODS_STATUS_OK) {
ods_log_error("[%s] corrupted backup file zone %s: unable to "
"publish dnskeys (%s)", zone_str, zone->name,
ods_status2str(status));
goto recover_error2;
}
/* publish nsec3param */
if (!zone->signconf->passthrough)
status = zone_publish_nsec3param(zone);
if (status != ODS_STATUS_OK) {
ods_log_error("[%s] corrupted backup file zone %s: unable to "
"publish nsec3param (%s)", zone_str, zone->name,
ods_status2str(status));
goto recover_error2;
}
/* publish other records */
status = backup_read_namedb(fd, zone);
if (status != ODS_STATUS_OK) {
ods_log_error("[%s] corrupted backup file zone %s: unable to "
"read resource records (%s)", zone_str, zone->name,
ods_status2str(status));
goto recover_error2;
}
/* task */
schedule_scheduletask(engine->taskq, TASK_SIGN, zone->name, zone, &zone->zone_lock, schedule_PROMPTLY);
free((void*)filename);
ods_fclose(fd);
zone->db->is_initialized = 1;
zone->db->have_serial = 1;
/* journal */
filename = ods_build_path(zone->name, ".ixfr", 0, 1);
if (filename) {
fd = ods_fopen(filename, NULL, "r");
}
if (fd) {
status = backup_read_ixfr(fd, zone);
if (status != ODS_STATUS_OK) {
ods_log_warning("[%s] corrupted journal file zone %s, "
"skipping (%s)", zone_str, zone->name,
ods_status2str(status));
(void)unlink(filename);
ixfr_cleanup(zone->ixfr);
zone->ixfr = ixfr_create();
}
}
pthread_mutex_lock(&zone->ixfr->ixfr_lock);
ixfr_purge(zone->ixfr, zone->name);
pthread_mutex_unlock(&zone->ixfr->ixfr_lock);
/* all ok */
free((void*)filename);
if (fd) {
ods_fclose(fd);
}
if (zone->stats) {
pthread_mutex_lock(&zone->stats->stats_lock);
stats_clear(zone->stats);
pthread_mutex_unlock(&zone->stats->stats_lock);
}
return ODS_STATUS_OK;
}
free(filename);
return ODS_STATUS_UNCHANGED;
recover_error2:
free((void*)filename);
ods_fclose(fd);
/* signconf cleanup */
free((void*)salt);
salt = NULL;
signconf_cleanup(zone->signconf);
zone->signconf = signconf_create();
ods_log_assert(zone->signconf);
/* namedb cleanup */
namedb_cleanup(zone->db);
zone->db = namedb_create((void*)zone);
ods_log_assert(zone->db);
/* stats reset */
if (zone->stats) {
pthread_mutex_lock(&zone->stats->stats_lock);
stats_clear(zone->stats);
pthread_mutex_unlock(&zone->stats->stats_lock);
}
return ODS_STATUS_ERR;
}
ods_status
zone_backup2(zone_type* zone, time_t nextResign)
{
char* filename = NULL;
char* tmpfile = NULL;
FILE* fd = NULL;
int ret = 0;
ods_status status = ODS_STATUS_OK;
ods_log_assert(zone);
ods_log_assert(zone->name);
ods_log_assert(zone->db);
ods_log_assert(zone->signconf);
tmpfile = ods_build_path(zone->name, ".backup2.tmp", 0, 1);
filename = ods_build_path(zone->name, ".backup2", 0, 1);
if (!tmpfile || !filename) {
free(tmpfile);
free(filename);
return ODS_STATUS_MALLOC_ERR;
}
fd = ods_fopen(tmpfile, NULL, "w");
if (fd) {
fprintf(fd, "%s\n", ODS_SE_FILE_MAGIC_V3);
fprintf(fd, ";;Time: %u\n", (unsigned) nextResign);
fprintf(fd, ";;Zone: name %s class %i inbound %u internal %u "
"outbound %u\n", zone->name, (int) zone->klass,
(unsigned) zone->db->inbserial,
(unsigned) zone->db->intserial,
(unsigned) zone->db->outserial);
signconf_backup(fd, zone->signconf, ODS_SE_FILE_MAGIC_V3);
if (zone->signconf->nsec3params) {
nsec3params_backup(fd,
zone->signconf->nsec3_algo,
zone->signconf->nsec3_optout,
zone->signconf->nsec3_iterations,
zone->signconf->nsec3_salt,
zone->signconf->nsec3params->rr,
ODS_SE_FILE_MAGIC_V3);
}
keylist_backup(fd, zone->signconf->keys, ODS_SE_FILE_MAGIC_V3);
fprintf(fd, ";;\n");
namedb_backup2(fd, zone->db);
fprintf(fd, "%s\n", ODS_SE_FILE_MAGIC_V3);
ods_fclose(fd);
ret = rename(tmpfile, filename);
if (ret != 0) {
ods_log_error("[%s] unable to rename zone %s backup %s to %s: %s",
zone_str, zone->name, tmpfile, filename, strerror(errno));
status = ODS_STATUS_RENAME_ERR;
}
} else {
status = ODS_STATUS_FOPEN_ERR;
}
free((void*) tmpfile);
free((void*) filename);
return status;
}
signconf_create
signconf_type * signconf_create(void)
Definition: signconf.c:47
zone_del_nsec3params
ods_status zone_del_nsec3params(zone_type *zone)
Definition: zone.c:657
ixfr_cleanup
void ixfr_cleanup(ixfr_type *ixfr)
Definition: ixfr.c:279
signertasks.h
rrset_lookup_rr
rr_type * rrset_lookup_rr(rrset_type *rrset, ldns_rr *rr)
Definition: rrset.c:236
zone_struct::default_ttl
uint32_t default_ttl
Definition: zone.h:63
backup_read_str
int backup_read_str(FILE *in, const char **str)
Definition: backup.c:104
ixfr_struct::ixfr_lock
pthread_mutex_t ixfr_lock
Definition: ixfr.h:64
signconf_struct::nsec3_iterations
uint32_t nsec3_iterations
Definition: signconf.h:58
namedb_struct::intserial
uint32_t intserial
Definition: namedb.h:54
zone_cleanup
void zone_cleanup(zone_type *zone)
Definition: zone.c:761
signconf_struct::sig_inception_offset
duration_type * sig_inception_offset
Definition: signconf.h:52
ixfr_create
ixfr_type * ixfr_create()
Definition: ixfr.c:91
key_struct::publish
int publish
Definition: keys.h:57
zone_recover2
ods_status zone_recover2(engine_type *engine, zone_type *zone)
Definition: zone.c:794
rrset_lookup_ttl
uint32_t rrset_lookup_ttl(rrset_type *rrset, uint32_t default_ttl)
Definition: rrset.c:263
signconf_backup
void signconf_backup(FILE *fd, signconf_type *sc, const char *version)
Definition: signconf.c:214
rrset_struct::rr_count
size_t rr_count
Definition: rrset.h:65
adapter_compare
int adapter_compare(adapter_type *a1, adapter_type *a2)
Definition: adapter.c:212
domain_add_rrset
void domain_add_rrset(domain_type *domain, rrset_type *rrset)
Definition: domain.c:160
domain_lookup_rrset
rrset_type * domain_lookup_rrset(domain_type *domain, ldns_rr_type rrtype)
Definition: domain.c:141
signconf_struct::soa_min
duration_type * soa_min
Definition: signconf.h:67
backup_read_duration
int backup_read_duration(FILE *in, duration_type **v)
Definition: backup.c:138
zone_merge
void zone_merge(zone_type *z1, zone_type *z2)
Definition: zone.c:696
stats_create
stats_type * stats_create(void)
Definition: stats.c:40
key_struct::dnskey
ldns_rr * dnskey
Definition: keys.h:51
signconf_struct::nsec3_salt
const char * nsec3_salt
Definition: signconf.h:59
rrset_getliteralrr
ods_status rrset_getliteralrr(ldns_rr **dnskey, const char *resourcerecord, uint32_t ttl, ldns_rdf *apex)
Definition: rrset.c:848
signconf_struct::soa_serial
const char * soa_serial
Definition: signconf.h:68
signconf_struct::keys
keylist_type * keys
Definition: signconf.h:64
signconf_struct::soa_ttl
duration_type * soa_ttl
Definition: signconf.h:66
signconf_struct::sig_validity_default
duration_type * sig_validity_default
Definition: signconf.h:48
nsec3params_struct::algorithm
uint8_t algorithm
Definition: nsec3params.h:49
zone_struct::notify_command
char * notify_command
Definition: zone.h:65
nsec3params_struct::iterations
uint16_t iterations
Definition: nsec3params.h:51
signconf_cleanup
void signconf_cleanup(signconf_type *sc)
Definition: signconf.c:470
rr_struct
Definition: rrset.h:51
namedb_cleanup
void namedb_cleanup(namedb_type *db)
Definition: namedb.c:1131
zone_struct
Definition: zone.h:60
backup_read_rr_type
int backup_read_rr_type(FILE *in, ldns_rr_type *v)
Definition: backup.c:158
namedb_struct::have_serial
unsigned have_serial
Definition: namedb.h:60
signconf_struct::sig_validity_denial
duration_type * sig_validity_denial
Definition: signconf.h:49
signconf_struct::nsec3param_ttl
duration_type * nsec3param_ttl
Definition: signconf.h:54
backup_read_time_t
int backup_read_time_t(FILE *in, time_t *v)
Definition: backup.c:121
signconf_struct::passthrough
int passthrough
Definition: signconf.h:44
rrset_store_initialize
collection_class rrset_store_initialize()
Definition: rrset.c:223
signconf_struct
Definition: signconf.h:41
rrset_add_rr
rr_type * rrset_add_rr(rrset_type *rrset, ldns_rr *rr)
Definition: rrset.c:299
namedb_struct::outserial
uint32_t outserial
Definition: namedb.h:55
zone_struct::zoneconfigvalid
int zoneconfigvalid
Definition: zone.h:90
netio.h
namedb_update_serial
ods_status namedb_update_serial(namedb_type *db, const char *zone_name, const char *format, uint32_t inbound_serial)
Definition: namedb.c:193
zone_struct::zl_status
zone_zl_status zl_status
Definition: zone.h:72
keylist_create
keylist_type * keylist_create(signconf_type *signconf)
Definition: keys.c:48
ZONE_ZL_UPDATED
Definition: zone.h:36
backup_read_int
int backup_read_int(FILE *in, int *v)
Definition: backup.c:175
zone_create
zone_type * zone_create(char *name, ldns_rr_class klass)
Definition: zone.c:55
backup_read_ixfr
ods_status backup_read_ixfr(FILE *in, void *zone)
Definition: backup.c:499
signconf_struct::nsec_type
ldns_rr_type nsec_type
Definition: signconf.h:55
namedb_backup2
void namedb_backup2(FILE *fd, namedb_type *db)
Definition: namedb.c:1152
notify_cleanup
void notify_cleanup(notify_type *notify)
Definition: notify.c:600
nsec3params_backup
void nsec3params_backup(FILE *fd, uint8_t algo, uint8_t flags, uint16_t iter, const char *salt, ldns_rr *rr, const char *version)
Definition: nsec3params.c:141
zone_struct::adoutbound
adapter_type * adoutbound
Definition: zone.h:75
zone_struct::zone_lock
pthread_mutex_t zone_lock
Definition: zone.h:86
nsec3params_create
nsec3params_type * nsec3params_create(void *sc, uint8_t algo, uint8_t flags, uint16_t iter, const char *salt)
Definition: nsec3params.c:103
rr_struct::exists
unsigned exists
Definition: rrset.h:54
backup_read_namedb
ods_status backup_read_namedb(FILE *in, void *zone)
Definition: backup.c:304
zone_publish_nsec3param
ods_status zone_publish_nsec3param(zone_type *zone)
Definition: zone.c:307
signconf_struct::sig_refresh_interval
duration_type * sig_refresh_interval
Definition: signconf.h:47
nsec3params_struct::salt_data
uint8_t * salt_data
Definition: nsec3params.h:53
zone_struct::db
namedb_type * db
Definition: zone.h:79
rr_struct::is_removed
unsigned is_removed
Definition: rrset.h:56
signconf_struct::sig_validity_keyset
duration_type * sig_validity_keyset
Definition: signconf.h:50
zone_struct::ixfr
ixfr_type * ixfr
Definition: zone.h:80
namedb_struct::inbserial
uint32_t inbserial
Definition: namedb.h:53
key_struct::locator
const char * locator
Definition: keys.h:53
namedb_struct::serial_updated
unsigned serial_updated
Definition: namedb.h:58
namedb_struct::is_initialized
unsigned is_initialized
Definition: namedb.h:57
keylist_struct::keys
key_type * keys
Definition: keys.h:68
adapter.h
signconf_struct::dnskey_signature
const char ** dnskey_signature
Definition: signconf.h:63
namedb_domain_entize
ods_status namedb_domain_entize(namedb_type *db, domain_type *domain, ldns_rdf *apex)
Definition: namedb.c:281
zone_struct::signconf
signconf_type * signconf
Definition: zone.h:77
domain_struct
Definition: domain.h:52
zone_update_serial
ods_status zone_update_serial(zone_type *zone)
Definition: zone.c:436
zone_struct::adinbound
adapter_type * adinbound
Definition: zone.h:74
zone_add_rr
ods_status zone_add_rr(zone_type *zone, ldns_rr *rr, int do_stats)
Definition: zone.c:531
xfrd_cleanup
void xfrd_cleanup(xfrd_type *xfrd, int backup)
Definition: xfrd.c:2179
namedb_lookup_domain
domain_type * namedb_lookup_domain(namedb_type *db, ldns_rdf *dname)
Definition: namedb.c:338
domain_struct::is_apex
unsigned is_apex
Definition: domain.h:60
zone_struct::notify_args
char ** notify_args
Definition: zone.h:67
nsec3params_struct::salt_len
uint8_t salt_len
Definition: nsec3params.h:52
stats_cleanup
void stats_cleanup(stats_type *stats)
Definition: stats.c:106
nsec3params_struct::rr
ldns_rr * rr
Definition: nsec3params.h:54
key_struct::resourcerecord
const char * resourcerecord
Definition: keys.h:54
zone_struct::signconf_filename
const char * signconf_filename
Definition: zone.h:71
zone_rollback_dnskeys
void zone_rollback_dnskeys(zone_type *zone)
Definition: zone.c:279
namedb_create
namedb_type * namedb_create(void *zone)
Definition: namedb.c:121
zone_struct::notify_ns
const char * notify_ns
Definition: zone.h:66
domain_struct::zone
zone_type * zone
Definition: domain.h:54
zone_del_rr
ods_status zone_del_rr(zone_type *zone, ldns_rr *rr, int do_stats)
Definition: zone.c:613
backup.h
zone_rollback_nsec3param
void zone_rollback_nsec3param(zone_type *zone)
Definition: zone.c:370
rr_struct::rr
ldns_rr * rr
Definition: rrset.h:52
zone.h
signconf_struct::last_modified
time_t last_modified
Definition: signconf.h:72
zone_struct::klass
ldns_rr_class klass
Definition: zone.h:62
zone_struct::rrstore
collection_class rrstore
Definition: zone.h:89
zone_lookup_rrset
rrset_type * zone_lookup_rrset(zone_type *zone, ldns_rdf *owner, ldns_rr_type type)
Definition: zone.c:512
signconf_struct::nsec3_algo
uint32_t nsec3_algo
Definition: signconf.h:57
zone_publish_dnskeys
ods_status zone_publish_dnskeys(zone_type *zone, int skip_hsm_access)
Definition: zone.c:186
signconf_struct::nsec3params
nsec3params_type * nsec3params
Definition: signconf.h:60
adapter_struct
Definition: adapter.h:57
engine_struct
Definition: engine.h:51
keylist_struct::count
size_t count
Definition: keys.h:69
stats_struct::sort_count
uint32_t sort_count
Definition: stats.h:51
zone_struct::xfr_lock
pthread_mutex_t xfr_lock
Definition: zone.h:87
namedb_add_domain
domain_type * namedb_add_domain(namedb_type *db, ldns_rdf *dname)
Definition: namedb.c:352
signconf_struct::dnskey_ttl
duration_type * dnskey_ttl
Definition: signconf.h:62
zone_struct::name
const char * name
Definition: zone.h:69
engine_struct::taskq
schedule_type * taskq
Definition: engine.h:54
key_struct::ksk
int ksk
Definition: keys.h:58
rrset_struct
Definition: rrset.h:59
zone_prepare_keys
ods_status zone_prepare_keys(zone_type *zone)
Definition: zone.c:394
backup_read_check_str
int backup_read_check_str(FILE *in, const char *str)
Definition: backup.c:77
signconf_struct::sig_jitter
duration_type * sig_jitter
Definition: signconf.h:51
key_struct::params
hsm_sign_params_t * params
Definition: keys.h:52
signconf_struct::sig_resign_interval
duration_type * sig_resign_interval
Definition: signconf.h:46
ixfr_purge
void ixfr_purge(ixfr_type *ixfr, char const *zonename)
Definition: ixfr.c:239
zone_backup2
ods_status zone_backup2(zone_type *zone, time_t nextResign)
Definition: zone.c:1042
rrset_diff
void rrset_diff(rrset_type *rrset, unsigned is_ixfr, unsigned more_coming)
Definition: rrset.c:366
zone_struct::notify
notify_type * notify
Definition: zone.h:83
stats_struct::stats_lock
pthread_mutex_t stats_lock
Definition: stats.h:63
zone_struct::policy_name
const char * policy_name
Definition: zone.h:70
hsm.h
zone_load_signconf
ods_status zone_load_signconf(zone_type *zone, signconf_type **new_signconf)
Definition: zone.c:133
rrset_create
rrset_type * rrset_create(zone_type *zone, ldns_rr_type type)
Definition: rrset.c:199
adapter_cleanup
void adapter_cleanup(adapter_type *adapter)
Definition: adapter.c:234
zone_struct::xfrd
xfrd_type * xfrd
Definition: zone.h:82
rr_struct::is_added
unsigned is_added
Definition: rrset.h:55
key_recover2
key_type * key_recover2(FILE *fd, keylist_type *kl)
Definition: keys.c:223
keylist_backup
void keylist_backup(FILE *fd, keylist_type *kl, const char *version)
Definition: keys.c:268
zone_struct::apex
ldns_rdf * apex
Definition: zone.h:61
signconf_update
ods_status signconf_update(signconf_type **signconf, const char *scfile, time_t last_modified)
Definition: signconf.c:154
domain_struct::dname
ldns_rdf * dname
Definition: domain.h:56
zone_struct::stats
stats_type * stats
Definition: zone.h:85
backup_read_uint32_t
int backup_read_uint32_t(FILE *in, uint32_t *v)
Definition: backup.c:209
lhsm_get_key
ods_status lhsm_get_key(hsm_ctx_t *ctx, ldns_rdf *owner, key_type *key_id, int skip_hsm_access)
Definition: hsm.c:81
rrset_struct::rrs
rr_type * rrs
Definition: rrset.h:64
ZONE_ZL_OK
Definition: zone.h:34
stats_clear
void stats_clear(stats_type *stats)
Definition: stats.c:54
signconf_struct::nsec3_optout
int nsec3_optout
Definition: signconf.h:56