[Opendnssec-commits] [keihatsu.kirei.se/svn/dnssec] r3824 - in trunk/OpenDNSSEC/signer/src: adapter signer

Matthijs Mekking matthijs at nlnetlabs.nl
Mon Aug 30 10:21:25 CEST 2010


Author: matthijs
Date: 2010-08-30 10:21:25 +0200 (Mon, 30 Aug 2010)
New Revision: 3824

Modified:
   trunk/OpenDNSSEC/signer/src/adapter/adfile.c
   trunk/OpenDNSSEC/signer/src/signer/domain.c
   trunk/OpenDNSSEC/signer/src/signer/zonedata.c
Log:
fix duplicate pending errors

http://www.pivotaltracker.com/story/show/4922858



Modified: trunk/OpenDNSSEC/signer/src/adapter/adfile.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/adapter/adfile.c	2010-08-27 14:10:01 UTC (rev 3823)
+++ trunk/OpenDNSSEC/signer/src/adapter/adfile.c	2010-08-30 08:21:25 UTC (rev 3824)
@@ -380,8 +380,8 @@
     unsigned int l = 0;
 
     se_log_assert(fd);
-    se_log_assert(zone);
-    se_log_assert(zone->stats);
+    se_log_assert(zone_in);
+    se_log_assert(zone_in->stats);
 
     if (!include) {
         rr = adfile_lookup_soa_rr(fd);
@@ -392,16 +392,26 @@
             soa_min = ldns_rdf2native_int32(ldns_rr_rdf(rr,
                 SE_SOA_RDATA_MINIMUM));
         }
-        zone->zonedata->default_ttl = soa_min;
+        zone_in->zonedata->default_ttl = soa_min;
         /* serial */
         if (rr) {
-            zone->zonedata->inbound_serial =
+            zone_in->zonedata->inbound_serial =
                 ldns_rdf2native_int32(ldns_rr_rdf(rr, SE_SOA_RDATA_SERIAL));
             ldns_rr_free(rr);
         }
         rewind(fd);
-   }
 
+        if (se_strcmp(zone_in->signconf->soa_serial, "keep") == 0) {
+            if (zone_in->zonedata->inbound_serial <=
+                zone_in->zonedata->outbound_serial) {
+                se_log_error("cannot read zone %s: SOA SERIAL is set to keep "
+                    "but serial %u in input zone is not incremental",
+                    zone_in->name, zone_in->zonedata->inbound_serial);
+                return 1;
+            }
+        }
+    }
+
     /* $ORIGIN <zone name> */
     orig = ldns_rdf_clone(zone_in->dname);
 
@@ -454,7 +464,7 @@
     }
 
     /* reset the default ttl (directives only affect the zone file) */
-    zone->zonedata->default_ttl = soa_min;
+    zone_in->zonedata->default_ttl = soa_min;
 
     return result;
 }
@@ -477,14 +487,6 @@
     se_log_debug("read zone %s from file %s",
         zone_in->name?zone_in->name:"(null)", filename?filename:"(null)");
 
-    /* remove current rrs */
-    error = zonedata_del_rrs(zone_in->zonedata);
-    if (error) {
-        se_log_error("error removing current RRs in zone %s",
-            zone_in->name?zone_in->name:"(null)");
-        return error;
-    }
-
     /* read the zonefile */
     fd = se_fopen(filename, NULL, "r");
     if (fd) {
@@ -497,6 +499,13 @@
         se_log_error("error reading zone %s from file %s",
             zone_in->name?zone_in->name:"(null)",
             filename?filename:"(null)");
+    } else {
+        /* remove current rrs */
+        error = zonedata_del_rrs(zone_in->zonedata);
+        if (error) {
+            se_log_error("error removing current RRs in zone %s",
+                zone_in->name?zone_in->name:"(null)");
+        }
     }
     return error;
 }

Modified: trunk/OpenDNSSEC/signer/src/signer/domain.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/domain.c	2010-08-27 14:10:01 UTC (rev 3823)
+++ trunk/OpenDNSSEC/signer/src/signer/domain.c	2010-08-30 08:21:25 UTC (rev 3824)
@@ -617,8 +617,7 @@
            continue;
         }
 
-        if (rrset->rr_type == LDNS_RR_TYPE_SOA &&
-            strncmp(sc->soa_serial, "keep", 4) != 0 && rrset->rrs &&
+        if (rrset->rr_type == LDNS_RR_TYPE_SOA && rrset->rrs &&
             rrset->rrs->rr) {
             soa_serial = ldns_rr_set_rdf(rrset->rrs->rr,
                 ldns_native2rdf_int32(LDNS_RDF_TYPE_INT32, serial),

Modified: trunk/OpenDNSSEC/signer/src/signer/zonedata.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/zonedata.c	2010-08-27 14:10:01 UTC (rev 3823)
+++ trunk/OpenDNSSEC/signer/src/signer/zonedata.c	2010-08-30 08:21:25 UTC (rev 3824)
@@ -768,7 +768,7 @@
     }
     zd->outbound_serial = zd->internal_serial;
     if (error || !zd->outbound_serial) {
-        se_log_error("unable to update zonedata: failed to update serial");
+        se_log_error("unable to sign zone data: failed to update serial");
         return 1;
     }
 
@@ -819,6 +819,10 @@
     error = zonedata_update_serial(zd, sc);
     if (error || !zd->internal_serial) {
         se_log_error("unable to update zonedata: failed to update serial");
+        /**
+         * If this happens, the next read task will error alot on duplicate
+         * pending rrs. Should be high unlikely to occur.
+         */
         return 1;
     }
 




More information about the Opendnssec-commits mailing list