[Opendnssec-commits] [keihatsu.kirei.se/svn/dnssec] r4083 - trunk/OpenDNSSEC/signer/src/signer

Matthijs Mekking matthijs at nlnetlabs.nl
Tue Oct 12 12:17:54 CEST 2010


Author: matthijs
Date: 2010-10-12 12:17:54 +0200 (Tue, 12 Oct 2010)
New Revision: 4083

Modified:
   trunk/OpenDNSSEC/signer/src/signer/rrset.c
Log:
don't try to sign empty RRsets



Modified: trunk/OpenDNSSEC/signer/src/signer/rrset.c
===================================================================
--- trunk/OpenDNSSEC/signer/src/signer/rrset.c	2010-10-12 10:06:08 UTC (rev 4082)
+++ trunk/OpenDNSSEC/signer/src/signer/rrset.c	2010-10-12 10:17:54 UTC (rev 4083)
@@ -689,12 +689,12 @@
 rrset2rrlist(rrset_type* rrset)
 {
     ldns_dnssec_rrs* rrs = NULL;
-    ldns_rr_list* rr_list;
+    ldns_rr_list* rr_list = NULL;
     int error = 0;
 
     rr_list = ldns_rr_list_new();
     rrs = rrset->rrs;
-    while (rrs) {
+    while (rrs && rrs->rr) {
         error = (int) ldns_rr_list_push_rr(rr_list, rrs->rr);
         if (!error) {
             ldns_rr_list_free(rr_list);
@@ -739,17 +739,24 @@
         /* drop unrecyclable signatures */
         error = rrset_recycle_rrsigs(rrset, sc, signtime, &reusedsigs);
 
+        /* convert the RRset */
+        rr_list = rrset2rrlist(rrset);
+        if (!rr_list) {
+            se_log_error("error signing RRset[%i], cannot convert to rr "
+                "list", rrset->rr_type);
+            return 1;
+        }
+        if (ldns_rr_list_rr_count(rr_list) <= 0) {
+            /* empty RRset, no signatures needed */
+            ldns_rr_list_free(rr_list);
+            return 0;
+        }
+
         /* prepare for signing */
         new_rrsigs = rrsigs_create();
         if (!rrset->rrsigs) {
             rrset->rrsigs = rrsigs_create();
         }
-        rr_list = rrset2rrlist(rrset);
-        if (!rr_list) {
-            se_log_error("error signing rrset[%i], cannot convert to rr "
-                "list", rrset->rr_type);
-            return 1;
-        }
         rrset_sign_set_timers(sc, rrset->rr_type, signtime,
              &inception, &expiration);
 




More information about the Opendnssec-commits mailing list