git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SPDX: license tags (mostly by guesswork)
[exim.git]
/
src
/
src
/
routers
/
rf_lookup_hostlist.c
diff --git
a/src/src/routers/rf_lookup_hostlist.c
b/src/src/routers/rf_lookup_hostlist.c
index acf976f672e5c5dfc921a4516f7e5801cab4ed9a..affd70b6efbc47d2300c3853249a12d92263a0d1 100644
(file)
--- a/
src/src/routers/rf_lookup_hostlist.c
+++ b/
src/src/routers/rf_lookup_hostlist.c
@@
-3,7
+3,9
@@
*************************************************/
/* Copyright (c) University of Cambridge 1995 - 2015 */
*************************************************/
/* Copyright (c) University of Cambridge 1995 - 2015 */
+/* Copyright (c) The Exim Maintainers 2020 */
/* See the file NOTICE for conditions of use and distribution. */
/* See the file NOTICE for conditions of use and distribution. */
+/* SPDX-License-Identifier: GPL-2.0-only */
#include "../exim.h"
#include "../exim.h"
@@
-53,7
+55,6
@@
rf_lookup_hostlist(router_instance *rblock, address_item *addr,
address_item **addr_new)
{
BOOL self_send = FALSE;
address_item **addr_new)
{
BOOL self_send = FALSE;
-host_item *h, *next_h, *prev;
/* Look up each host address. A lookup may add additional items into the chain
if there are multiple addresses. Hence the use of next_h to start each cycle of
/* Look up each host address. A lookup may add additional items into the chain
if there are multiple addresses. Hence the use of next_h to start each cycle of
@@
-62,7
+63,7
@@
host, omit it and any subsequent hosts - i.e. treat the list like an ordered
list of MX hosts. If the first host is the local host, act according to the
"self" option in the configuration. */
list of MX hosts. If the first host is the local host, act according to the
"self" option in the configuration. */
-for (
prev = NULL, h = addr->host_list
; h; h = next_h)
+for (
host_item * prev = NULL, * h = addr->host_list, *next_h
; h; h = next_h)
{
const uschar *canonical_name;
int rc, len, port, mx, sort_key;
{
const uschar *canonical_name;
int rc, len, port, mx, sort_key;
@@
-149,7
+150,9
@@
for (prev = NULL, h = addr->host_list; h; h = next_h)
if (lookup_type & LK_DEFAULT)
{
DEBUG(D_route|D_host_lookup)
if (lookup_type & LK_DEFAULT)
{
DEBUG(D_route|D_host_lookup)
- debug_printf("DNS lookup failed: trying getipnodebyname\n");
+ debug_printf("DNS lookup failed: trying %s\n",
+ f.running_in_test_harness
+ ? "host_fake_gethostbyname" : "getipnodebyname");
rc = host_find_byname(h, ignore_target_hosts, HOST_FIND_QUALIFY_SINGLE,
&canonical_name, TRUE);
}
rc = host_find_byname(h, ignore_target_hosts, HOST_FIND_QUALIFY_SINGLE,
&canonical_name, TRUE);
}
@@
-197,7
+200,7
@@
for (prev = NULL, h = addr->host_list; h; h = next_h)
addr->message =
string_sprintf("lookup of host \"%s\" failed in %s router%s",
h->name, rblock->name,
addr->message =
string_sprintf("lookup of host \"%s\" failed in %s router%s",
h->name, rblock->name,
- host_find_failed_syntax? ": syntax error in name" : "");
+
f.
host_find_failed_syntax? ": syntax error in name" : "");
if (hff_code == hff_defer) return DEFER;
if (hff_code == hff_fail) return FAIL;
if (hff_code == hff_defer) return DEFER;
if (hff_code == hff_fail) return FAIL;
@@
-210,20
+213,15
@@
for (prev = NULL, h = addr->host_list; h; h = next_h)
port, mx and sort_key. */
if (port != PORT_NONE)
port, mx and sort_key. */
if (port != PORT_NONE)
- {
- host_item *hh;
- for (hh = h; hh != next_h; hh = hh->next) hh->port = port;
- }
+ for (host_item * hh = h; hh != next_h; hh = hh->next)
+ hh->port = port;
if (mx != MX_NONE)
if (mx != MX_NONE)
- {
- host_item *hh;
- for (hh = h; hh != next_h; hh = hh->next)
+ for (host_item * hh = h; hh != next_h; hh = hh->next)
{
hh->mx = mx;
hh->sort_key = sort_key;
}
{
hh->mx = mx;
hh->sort_key = sort_key;
}
- }
/* A local host gets chopped, with its successors, if there are previous
hosts. Otherwise the self option is used. If it is set to "send", any
/* A local host gets chopped, with its successors, if there are previous
hosts. Otherwise the self option is used. If it is set to "send", any
@@
-236,7
+234,7
@@
for (prev = NULL, h = addr->host_list; h; h = next_h)
DEBUG(D_route)
{
debug_printf("Removed from host list:\n");
DEBUG(D_route)
{
debug_printf("Removed from host list:\n");
- for (; h
!= NULL
; h = h->next) debug_printf(" %s\n", h->name);
+ for (; h; h = h->next) debug_printf(" %s\n", h->name);
}
prev->next = NULL;
setflag(addr, af_local_host_removed);
}
prev->next = NULL;
setflag(addr, af_local_host_removed);