From: Mark Andrews Date: Fri, 26 Aug 2011 05:12:56 +0000 (+0000) Subject: DNS_R_NEWORIGIN could be accidently returned, clearnode's result was being ignored X-Git-Tag: v9.9.0a2~1^2~113 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1cf6fd20a9f56c6c31581480445dea96fc7ac60;p=thirdparty%2Fbind9.git DNS_R_NEWORIGIN could be accidently returned, clearnode's result was being ignored --- diff --git a/lib/dns/cache.c b/lib/dns/cache.c index a13a4aee52e..7ba944b7bc1 100644 --- a/lib/dns/cache.c +++ b/lib/dns/cache.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: cache.c,v 1.90 2011/08/02 20:36:12 each Exp $ */ +/* $Id: cache.c,v 1.91 2011/08/26 05:12:56 marka Exp $ */ /*! \file */ @@ -1186,7 +1186,7 @@ clearnode(dns_db_t *db, dns_dbnode_t *node) { static isc_result_t cleartree(dns_db_t *db, dns_name_t *name) { - isc_result_t result; + isc_result_t result, answer = ISC_R_SUCCESS; dns_dbiterator_t *iter = NULL; dns_dbnode_t *node = NULL; dns_fixedname_t fnodename; @@ -1205,12 +1205,22 @@ cleartree(dns_db_t *db, dns_name_t *name) { while (result == ISC_R_SUCCESS) { result = dns_dbiterator_current(iter, &node, nodename); - if (result != ISC_R_SUCCESS && result != DNS_R_NEWORIGIN) + if (result == DNS_R_NEWORIGIN) + result = ISC_R_SUCCESS; + if (result != ISC_R_SUCCESS) goto cleanup; + /* + * Are we done? + */ if (! dns_name_issubdomain(nodename, name)) goto cleanup; + /* + * If clearnode fails record and move onto the next node. + */ result = clearnode(db, node); + if (result != ISC_R_SUCCESS && answer == ISC_R_SUCCESS) + answer = result; dns_db_detachnode(db, &node); result = dns_dbiterator_next(iter); } @@ -1218,12 +1228,14 @@ cleartree(dns_db_t *db, dns_name_t *name) { cleanup: if (result == ISC_R_NOMORE || result == ISC_R_NOTFOUND) result = ISC_R_SUCCESS; + if (result != ISC_R_SUCCESS && answer == ISC_R_SUCCESS) + answer = result; if (node != NULL) dns_db_detachnode(db, &node); if (iter != NULL) dns_dbiterator_destroy(&iter); - return (result); + return (answer); } isc_result_t