]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add failure handling when iterators don't end with ISC_R_NOMORE
authorOndřej Surý <ondrej@isc.org>
Wed, 18 Dec 2019 09:54:01 +0000 (10:54 +0100)
committerMark Andrews <marka@isc.org>
Fri, 20 Dec 2019 11:02:32 +0000 (22:02 +1100)
(cherry picked from commit bff83b9480c9efe88dfde41f664a5bb7c1cad94c)

lib/dns/zone.c

index f6c854183c484554a113f8ed5e1873b21ad53b72..c9dd8025c54a274ab16865c32f3e902fe8c82cc8 100644 (file)
@@ -15298,6 +15298,7 @@ restore_nsec3param(dns_zone_t *zone, dns_db_t *db, dns_dbversion_t *version,
 static void
 receive_secure_db(isc_task_t *task, isc_event_t *event) {
        isc_result_t result;
+       isc_result_t iter_result;
        dns_zone_t *zone;
        dns_db_t *rawdb, *db = NULL;
        dns_fixedname_t fname;
@@ -15374,6 +15375,7 @@ receive_secure_db(isc_task_t *task, isc_event_t *event) {
        {
                dns_dbnode_t *rawnode = NULL, *node = NULL;
                dns_rdatasetiter_t *rdsit = NULL;
+               isc_result_t rdsit_result;
 
                result = dns_dbiterator_current(dbiterator, &rawnode, name);
                if (result != ISC_R_SUCCESS) {
@@ -15390,7 +15392,7 @@ receive_secure_db(isc_task_t *task, isc_event_t *event) {
                        goto iter_cleanup;
                }
 
-               for (isc_result_t rdsit_result = dns_rdatasetiter_first(rdsit);
+               for (rdsit_result = dns_rdatasetiter_first(rdsit);
                     rdsit_result == ISC_R_SUCCESS;
                     rdsit_result = dns_rdatasetiter_next(rdsit))
                {
@@ -15417,6 +15419,11 @@ receive_secure_db(isc_task_t *task, isc_event_t *event) {
                                break;
                        }
                }
+               if (rdsit_result != ISC_R_SUCCESS &&
+                   rdsit_result != ISC_R_NOMORE)
+               {
+                       result = rdsit_result;
+               }
                dns_rdatasetiter_destroy(&rdsit);
 iter_cleanup:
                if (rawnode) {
@@ -15429,6 +15436,10 @@ iter_cleanup:
                        break;
                }
        }
+       if (iter_result != ISC_R_SUCCESS &&
+           iter_result != ISC_R_NOMORE) {
+               result = iter_result;
+       }
        dns_dbiterator_destroy(&dbiterator);
 
        if (result != ISC_R_SUCCESS) {