]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Change ISC_R_EXISTS to ISC_R_SUCCESS in dns/rbtdb.c:findnodeintree()
authorOndřej Surý <ondrej@isc.org>
Mon, 9 Jan 2023 11:48:19 +0000 (12:48 +0100)
committerOndřej Surý <ondrej@isc.org>
Mon, 9 Jan 2023 11:48:19 +0000 (12:48 +0100)
In the previous refactoring, the findnodeintree() function could return
ISC_R_EXISTS (from dns_db_addnode() call) instead of ISC_R_SUCCESS
leading to node being attached, but never detached.

Change the ISC_R_EXISTS result code returned from dns_rbt_addnode() to
the ISC_R_SUCCESS in the findnodeintree() function (called internally by
dns_db_findnode() and dns_db_findnsec3node()).

lib/dns/rbtdb.c

index 4850bc148dad500e6519f8a4a91dc670b4ee5c13..eea89880d455b04949c9f6df341fbbf50b0dff8d 100644 (file)
@@ -2818,7 +2818,9 @@ findnodeintree(dns_rbtdb_t *rbtdb, dns_rbt_t *tree, const dns_name_t *name,
                        if (tree == rbtdb->nsec3) {
                                node->nsec = DNS_RBT_NSEC_NSEC3;
                        }
-               } else if (result != ISC_R_EXISTS) {
+               } else if (result == ISC_R_EXISTS) {
+                       result = ISC_R_SUCCESS;
+               } else {
                        goto unlock;
                }
        }
@@ -2830,7 +2832,6 @@ findnodeintree(dns_rbtdb_t *rbtdb, dns_rbt_t *tree, const dns_name_t *name,
        reactivate_node(rbtdb, node, tlocktype);
 
        *nodep = (dns_dbnode_t *)node;
-
 unlock:
        TREE_UNLOCK(&rbtdb->tree_lock, &tlocktype);