Retries: rework DB keys, and fix exinext IPv6. Bug 3086
[exim.git] / src / src / tree.c
index e340d986a0d2ad1f7679116e0805c26f00d0d767..2c703583e1d9a4347edac8ddd3e54871c9a651a4 100644 (file)
@@ -2,10 +2,10 @@
 *     Exim - an Internet mail transport agent    *
 *************************************************/
 
-/* Copyright (c) The Exim Maintainers 2021 - 2022 */
+/* Copyright (c) The Exim Maintainers 2021 - 2023 */
 /* Copyright (c) University of Cambridge 1995 - 2015 */
 /* See the file NOTICE for conditions of use and distribution. */
-/* SPDX-License-Identifier: GPL-2.0-only */
+/* SPDX-License-Identifier: GPL-2.0-or-later */
 
 /* Functions for maintaining binary balanced trees and some associated
 functions as well. */
@@ -48,7 +48,7 @@ if (!tree_insertnode(&tree_nonrecipients, node)) store_reset(rpoint);
 
 Argument:
   s       string to add
-  addr    the address is is a duplicate of
+  addr    the address it is a duplicate of
 
 Returns:  nothing
 */
@@ -65,6 +65,7 @@ if (!tree_insertnode(&tree_duplicates, node)) store_reset(rpoint);
 
 
 
+#ifndef COMPILE_UTILITY
 /*************************************************
 *    Add entry to unusable addresses tree        *
 *************************************************/
@@ -76,12 +77,11 @@ Returns:     nothing
 */
 
 void
-tree_add_unusable(const host_item *h)
+tree_add_unusable(const host_item * h)
 {
 rmark rpoint = store_mark();
-tree_node *node;
-uschar s[256];
-sprintf(CS s, "T:%.200s:%s", h->name, h->address);
+tree_node * node;
+const uschar * s = retry_host_key_build(h, TRUE, NULL);
 node = store_get(sizeof(tree_node) + Ustrlen(s),
            is_tainted(h->name) || is_tainted(h->address) ? GET_TAINTED : GET_UNTAINTED);
 Ustrcpy(node->name, s);
@@ -89,7 +89,7 @@ node->data.val = h->why;
 if (h->status == hstatus_unusable_expired) node->data.val += 256;
 if (!tree_insertnode(&tree_unusable, node)) store_reset(rpoint);
 }
-
+#endif
 
 
 /*************************************************