mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 06:25:31 +00:00
DNS_R_NEWORIGIN could be accidently returned, clearnode's result was being ignored
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user