[Opendnssec-commits] [svn.opendnssec.org/svn/dnssec] r5436 - in branches/OpenDNSSEC-adapters/signer/src: adapter daemon signer

Matthijs Mekking matthijs at nlnetlabs.nl
Mon Aug 22 15:37:46 CEST 2011


Author: matthijs
Date: 2011-08-22 15:37:46 +0200 (Mon, 22 Aug 2011)
New Revision: 5436

Modified:
   branches/OpenDNSSEC-adapters/signer/src/adapter/adapi.c
   branches/OpenDNSSEC-adapters/signer/src/daemon/worker.c
   branches/OpenDNSSEC-adapters/signer/src/signer/tools.c
   branches/OpenDNSSEC-adapters/signer/src/signer/zone.c
   branches/OpenDNSSEC-adapters/signer/src/signer/zone.h
   branches/OpenDNSSEC-adapters/signer/src/signer/zonedata.c
   branches/OpenDNSSEC-adapters/signer/src/signer/zonedata.h
   branches/OpenDNSSEC-adapters/signer/src/signer/zonelist.c
Log:
rename zone->dname to zone->apex
move default ttl from zonedata struct to zone struct



Modified: branches/OpenDNSSEC-adapters/signer/src/adapter/adapi.c
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/adapter/adapi.c	2011-08-22 13:28:08 UTC (rev 5435)
+++ branches/OpenDNSSEC-adapters/signer/src/adapter/adapi.c	2011-08-22 13:37:46 UTC (rev 5436)
@@ -94,7 +94,7 @@
         return NULL;
     }
     ods_log_assert(zone);
-    return zone->dname;
+    return zone->apex;
 }
 
 
@@ -122,14 +122,13 @@
 uint32_t
 adapi_get_ttl(zone_type* zone)
 {
-    if (!zone || !zone->zonedata) {
+    if (!zone) {
         ods_log_error("[%s] unable to get ttl: "
             "no zone data", adapi_str);
         return 0;
     }
     ods_log_assert(zone);
-    ods_log_assert(zone->zonedata);
-    return zone->zonedata->default_ttl;
+    return zone->default_ttl;
 }
 
 

Modified: branches/OpenDNSSEC-adapters/signer/src/daemon/worker.c
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/daemon/worker.c	2011-08-22 13:28:08 UTC (rev 5435)
+++ branches/OpenDNSSEC-adapters/signer/src/daemon/worker.c	2011-08-22 13:37:46 UTC (rev 5436)
@@ -624,12 +624,12 @@
             if (zone && ctx) {
                 ods_log_assert(rrset);
                 ods_log_assert(zone);
-                ods_log_assert(zone->dname);
+                ods_log_assert(zone->apex);
                 ods_log_assert(zone->signconf);
                 ods_log_assert(ctx);
 
                 worker->clock_in = time(NULL);
-                status = rrset_sign(ctx, rrset, zone->dname, zone->signconf,
+                status = rrset_sign(ctx, rrset, zone->apex, zone->signconf,
                     chief->clock_in, zone->stats);
             } else {
                 status = ODS_STATUS_ASSERT_ERR;

Modified: branches/OpenDNSSEC-adapters/signer/src/signer/tools.c
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/signer/tools.c	2011-08-22 13:28:08 UTC (rev 5435)
+++ branches/OpenDNSSEC-adapters/signer/src/signer/tools.c	2011-08-22 13:37:46 UTC (rev 5436)
@@ -205,12 +205,12 @@
 
     start = time(NULL);
     /* determine denial ttl */
-    ttl = zone->zonedata->default_ttl;
+    ttl = zone->default_ttl;
     if (zone->signconf->soa_min) {
         ttl = (uint32_t) duration2time(zone->signconf->soa_min);
     }
     /* add missing empty non-terminals */
-    status = zonedata_entize(zone->zonedata, zone->dname);
+    status = zonedata_entize(zone->zonedata, zone->apex);
     if (status != ODS_STATUS_OK) {
         ods_log_error("[%s] unable to nsecify zone %s: failed to add empty ",
             "non-terminals", tools_str, zone->name);

Modified: branches/OpenDNSSEC-adapters/signer/src/signer/zone.c
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/signer/zone.c	2011-08-22 13:28:08 UTC (rev 5435)
+++ branches/OpenDNSSEC-adapters/signer/src/signer/zone.c	2011-08-22 13:37:46 UTC (rev 5436)
@@ -93,25 +93,24 @@
     }
     /* [end] PS 9218653 */
     zone->name = allocator_strdup(allocator, name);
+    /* check zone->name? */
     zone->klass = klass;
-
-    zone->dname = ldns_dname_new_frm_str(name);
-    ldns_dname2canonical(zone->dname);
+    zone->default_ttl = 3600; /* TODO: configure --default-ttl option? */
+    zone->apex = ldns_dname_new_frm_str(name);
+    /* check zone->apex? */
+    ldns_dname2canonical(zone->apex);
     zone->notify_ns = NULL;
     zone->policy_name = NULL;
     zone->signconf_filename = NULL;
-
     zone->adinbound = NULL;
     zone->adoutbound = NULL;
     zone->nsec3params = NULL;
-
     zone->just_added = 0;
     zone->just_updated = 0;
     zone->tobe_removed = 0;
     zone->processed = 0;
     zone->prepared = 0;
     zone->fetch = 0;
-
     zone->zonedata = zonedata_create(zone->allocator);
     if (!zone->zonedata) {
         ods_log_error("[%s] unable to create zone %s: create zonedata "
@@ -119,7 +118,6 @@
         zone_cleanup(zone);
         return NULL;
     }
-
     zone->signconf = signconf_create();
     if (!zone->signconf) {
         ods_log_error("[%s] unable to create zone %s: create signconf "
@@ -127,7 +125,6 @@
         zone_cleanup(zone);
         return NULL;
     }
-
     zone->stats = stats_create();
     zone->task = NULL;
     lock_basic_init(&zone->zone_lock);
@@ -168,8 +165,8 @@
     ods_log_assert(zone->signconf);
 
     /* in-zone? */
-    if (ldns_dname_compare(zone->dname, ldns_rr_owner(rr)) != 0 &&
-        !ldns_dname_is_subdomain(ldns_rr_owner(rr), zone->dname)) {
+    if (ldns_dname_compare(zone->apex, ldns_rr_owner(rr)) != 0 &&
+        !ldns_dname_is_subdomain(ldns_rr_owner(rr), zone->apex)) {
         ods_log_warning("[%s] zone %s contains out-of-zone data, skipping",
             zone_str, zone->name?zone->name:"(null)");
         /* ok, just filter */
@@ -224,7 +221,7 @@
                 zone_str);
             return ODS_STATUS_ERR;
         }
-        if (ldns_dname_compare(domain->dname, zone->dname) == 0) {
+        if (ldns_dname_compare(domain->dname, zone->apex) == 0) {
             domain->dstatus = DOMAIN_STATUS_APEX;
         }
     }
@@ -437,7 +434,7 @@
             zone->name);
         zone->signconf = signconf;
         signconf_log(zone->signconf, zone->name);
-        zone->zonedata->default_ttl =
+        zone->default_ttl =
             (uint32_t) duration2time(zone->signconf->soa_min);
     } else if (status == ODS_STATUS_UNCHANGED) {
         *tbs = TASK_READ;
@@ -500,7 +497,7 @@
     }
     ods_log_assert(zone->zonedata);
 
-    ttl = zone->zonedata->default_ttl;
+    ttl = zone->default_ttl;
     if (zone->signconf->dnskey_ttl) {
         ttl = (uint32_t) duration2time(zone->signconf->dnskey_ttl);
     }
@@ -520,7 +517,7 @@
                 do_publish = 1;
             }
 
-            status = lhsm_get_key(ctx, zone->dname, key);
+            status = lhsm_get_key(ctx, zone->apex, key);
             if (status != ODS_STATUS_OK) {
                 ods_log_error("[%s] unable to publish dnskeys zone %s: "
                     "error creating DNSKEY for key %s", zone_str,
@@ -622,8 +619,8 @@
         ods_log_assert(nsec3params_rr);
 
         ldns_rr_set_class(nsec3params_rr, zone->klass);
-        ldns_rr_set_ttl(nsec3params_rr, zone->zonedata->default_ttl);
-        ldns_rr_set_owner(nsec3params_rr, ldns_rdf_clone(zone->dname));
+        ldns_rr_set_ttl(nsec3params_rr, zone->default_ttl);
+        ldns_rr_set_owner(nsec3params_rr, ldns_rdf_clone(zone->apex));
         ldns_nsec3_add_param_rdfs(nsec3params_rr,
             zone->nsec3params->algorithm, 0,
             zone->nsec3params->iterations,
@@ -648,7 +645,7 @@
         ldns_rr_free(nsec3params_rr);
     } else if (!recover) {
         /* add ok, wipe out previous nsec3params */
-        apex = zonedata_lookup_domain(zone->zonedata, zone->dname);
+        apex = zonedata_lookup_domain(zone->zonedata, zone->apex);
         if (!apex) {
             ods_log_crit("[%s] unable to delete previous NSEC3PARAM RR "
             "from zone %s: apex undefined", zone_str, zone->name);
@@ -701,7 +698,7 @@
             "%u outbound %u\n",
             zone->name?zone->name:"(null)",
             (int) zone->klass,
-            (unsigned) zone->zonedata->default_ttl,
+            (unsigned) zone->default_ttl,
             (unsigned) zone->zonedata->inbound_serial,
             (unsigned) zone->zonedata->internal_serial,
             (unsigned) zone->zonedata->outbound_serial);
@@ -894,7 +891,7 @@
         }
 
         zone->klass = (ldns_rr_class) klass;
-        zone->zonedata->default_ttl = ttl;
+        zone->default_ttl = ttl;
         zone->zonedata->inbound_serial = inbound;
         zone->zonedata->internal_serial = internal;
         zone->zonedata->outbound_serial = outbound;
@@ -938,7 +935,7 @@
             zone->nsec3params = NULL;
             goto recover_error;
         }
-        status = zonedata_entize(zone->zonedata, zone->dname);
+        status = zonedata_entize(zone->zonedata, zone->apex);
         if (status != ODS_STATUS_OK) {
             zone->task = NULL;
             zone->nsec3params = NULL;
@@ -986,7 +983,7 @@
                 goto recover_error;
             }
             zone->klass = (ldns_rr_class) klass;
-            zone->zonedata->default_ttl = ttl;
+            zone->default_ttl = ttl;
             zone->zonedata->inbound_serial = inbound;
             zone->zonedata->internal_serial = internal;
             zone->zonedata->outbound_serial = outbound;
@@ -1152,7 +1149,7 @@
     }
 
     /* lookup domain */
-    domain = zonedata_lookup_domain(zone->zonedata, zone->dname);
+    domain = zonedata_lookup_domain(zone->zonedata, zone->apex);
     if (!domain) {
         ods_log_error("[%s] unable to update serial: apex not found",
             zone_str);
@@ -1212,7 +1209,7 @@
 zone_examine(zone_type* zone)
 {
     if (zone && zone->zonedata && zone->adinbound) {
-        return zonedata_examine(zone->zonedata, zone->dname,
+        return zonedata_examine(zone->zonedata, zone->apex,
             zone->adinbound->type);
     }
     return ODS_STATUS_ASSERT_ERR;
@@ -1236,7 +1233,7 @@
     allocator = zone->allocator;
     zone_lock = zone->zone_lock;
 
-    ldns_rdf_deep_free(zone->dname);
+    ldns_rdf_deep_free(zone->apex);
     adapter_cleanup(zone->adinbound);
     adapter_cleanup(zone->adoutbound);
     zonedata_cleanup(zone->zonedata);

Modified: branches/OpenDNSSEC-adapters/signer/src/signer/zone.h
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/signer/zone.h	2011-08-22 13:28:08 UTC (rev 5435)
+++ branches/OpenDNSSEC-adapters/signer/src/signer/zone.h	2011-08-22 13:37:46 UTC (rev 5436)
@@ -56,8 +56,9 @@
 typedef struct zone_struct zone_type;
 struct zone_struct {
     allocator_type* allocator; /* memory allocator */
-    ldns_rdf* dname; /* wire format zone name */
+    ldns_rdf* apex; /* wire format zone name */
     ldns_rr_class klass; /* class */
+    uint32_t default_ttl; /* ttl */
 
     /* from conf.xml */
     const char* notify_ns; /* master name server reload command */

Modified: branches/OpenDNSSEC-adapters/signer/src/signer/zonedata.c
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/signer/zonedata.c	2011-08-22 13:28:08 UTC (rev 5435)
+++ branches/OpenDNSSEC-adapters/signer/src/signer/zonedata.c	2011-08-22 13:37:46 UTC (rev 5436)
@@ -187,7 +187,6 @@
     zd->inbound_serial = 0;
     zd->internal_serial = 0;
     zd->outbound_serial = 0;
-    zd->default_ttl = 3600; /* TODO: configure --default-ttl option? */
     return zd;
 }
 

Modified: branches/OpenDNSSEC-adapters/signer/src/signer/zonedata.h
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/signer/zonedata.h	2011-08-22 13:28:08 UTC (rev 5435)
+++ branches/OpenDNSSEC-adapters/signer/src/signer/zonedata.h	2011-08-22 13:37:46 UTC (rev 5436)
@@ -61,7 +61,6 @@
     ldns_rbtree_t* domains;
     ldns_rbtree_t* denial_chain;
     int initialized;
-    uint32_t default_ttl; /* fallback ttl */
     uint32_t inbound_serial; /* last seen inbound soa serial */
     uint32_t internal_serial; /* latest internal soa serial */
     uint32_t outbound_serial; /* last written outbound soa serial */

Modified: branches/OpenDNSSEC-adapters/signer/src/signer/zonelist.c
===================================================================
--- branches/OpenDNSSEC-adapters/signer/src/signer/zonelist.c	2011-08-22 13:28:08 UTC (rev 5435)
+++ branches/OpenDNSSEC-adapters/signer/src/signer/zonelist.c	2011-08-22 13:37:46 UTC (rev 5436)
@@ -65,7 +65,7 @@
         }
         return 1;
     }
-    return ldns_dname_compare(x->dname, y->dname);
+    return ldns_dname_compare(x->apex, y->apex);
 }
 
 




More information about the Opendnssec-commits mailing list