int fake_mx = MX_NONE; /* This value is actually -1 */
uschar *name;
-if (list == NULL) return;
+if (!list) return;
if (randomize) fake_mx--; /* Start at -2 for randomizing */
*anchor = NULL;
-while ((name = string_nextinlist(&list, &sep, NULL, 0)) != NULL)
+while ((name = string_nextinlist(&list, &sep, NULL, 0)))
{
host_item *h;
h->why = hwhy_unknown;
h->last_try = 0;
- if (*anchor == NULL)
+ if (!*anchor)
{
h->next = NULL;
*anchor = h;
}
else
{
- while (hh->next != NULL && h->sort_key >= (hh->next)->sort_key)
+ while (hh->next && h->sort_key >= hh->next->sort_key)
hh = hh->next;
h->next = hh->next;
hh->next = h;
uschar *
host_and_ident(BOOL useflag)
{
-if (sender_fullhost == NULL)
- {
- (void)string_format(big_buffer, big_buffer_size, "%s%s", useflag? "U=" : "",
- (sender_ident == NULL)? US"unknown" : sender_ident);
- }
+if (!sender_fullhost)
+ (void)string_format(big_buffer, big_buffer_size, "%s%s", useflag ? "U=" : "",
+ sender_ident ? sender_ident : US"unknown");
else
{
- uschar *flag = useflag? US"H=" : US"";
- uschar *iface = US"";
- if (LOGGING(incoming_interface) && interface_address != NULL)
+ uschar * flag = useflag ? US"H=" : US"";
+ uschar * iface = US"";
+ if (LOGGING(incoming_interface) && interface_address)
iface = string_sprintf(" I=[%s]:%d", interface_address, interface_port);
- if (sender_ident == NULL)
- (void)string_format(big_buffer, big_buffer_size, "%s%s%s",
- flag, sender_fullhost, iface);
- else
+ if (sender_ident)
(void)string_format(big_buffer, big_buffer_size, "%s%s%s U=%s",
flag, sender_fullhost, iface, sender_ident);
+ else
+ (void)string_format(big_buffer, big_buffer_size, "%s%s%s",
+ flag, sender_fullhost, iface);
}
return big_buffer;
}
if (!(route_item = rf_expand_data(addr, ob->route_data, &rc)))
return rc;
(void) parse_route_item(route_item, NULL, &hostlist, &options);
- if (hostlist[0] == 0) return DECLINE;
+ if (!hostlist[0]) return DECLINE;
}
/* Expand the hostlist item. It may then pointing to an empty string, or to a
single host or a list of hosts; options is pointing to the rest of the
routelist item, which is either empty or contains various option words. */
-DEBUG(D_route) debug_printf("original list of hosts = \"%s\" options = %s\n",
+DEBUG(D_route) debug_printf("original list of hosts = '%s' options = '%s'\n",
hostlist, options);
newhostlist = expand_string_copy(hostlist);
/* If the expansion was forced to fail, just decline. Otherwise there is a
configuration problem. */
-if (newhostlist == NULL)
+if (!newhostlist)
{
if (f.expand_string_forcedfail) return DECLINE;
addr->message = string_sprintf("%s router: failed to expand \"%s\": %s",
}
else hostlist = newhostlist;
-DEBUG(D_route) debug_printf("expanded list of hosts = \"%s\" options = %s\n",
+DEBUG(D_route) debug_printf("expanded list of hosts = '%s' options = '%s'\n",
hostlist, options);
/* Set default lookup type and scan the options */
lookup_type = LK_DEFAULT;
-while (*options != 0)
+while (*options)
{
unsigned n;
const uschar *s = options;
if (transport && transport->info->local)
{
- if (hostlist[0] != 0)
+ if (hostlist[0])
{
host_item *h;
addr->host_list = h = store_get(sizeof(host_item));
list is mandatory in either case, except when verifying, in which case the
address is just accepted. */
-if (hostlist[0] == 0)
+if (!hostlist[0])
{
if (verify != v_none) goto ROUTED;
addr->message = string_sprintf("error in %s router: no host(s) specified "
/* Otherwise we finish the routing here by building a chain of host items
for the list of configured hosts, and then finding their addresses. */
-host_build_hostlist(&(addr->host_list), hostlist, randomize);
+host_build_hostlist(&addr->host_list, hostlist, randomize);
rc = rf_lookup_hostlist(rblock, addr, rblock->ignore_target_hosts, lookup_type,
ob->hff_code, addr_new);
if (rc != OK) return rc;
const uschar *s = *listptr;
BOOL sep_is_special;
-if (s == NULL) return NULL;
+if (!s) return NULL;
/* This allows for a fixed specified separator to be an iscntrl() character,
but at the time of implementation, this is never the case. However, it's best
while (isspace(*s) && *s != sep) s++;
}
else
- {
- sep = (sep == 0)? ':' : -sep;
- }
+ sep = sep ? -sep : ':';
*separator = sep;
}
/* An empty string has no list elements */
-if (*s == 0) return NULL;
+if (!*s) return NULL;
/* Note whether whether or not the separator is an iscntrl() character. */
if (buffer)
{
int p = 0;
- for (; *s != 0; s++)
+ for (; *s; s++)
{
if (*s == sep && (*(++s) != sep || sep_is_special)) break;
if (p < buflen - 1) buffer[p++] = *s;
}
while (p > 0 && isspace(buffer[p-1])) p--;
- buffer[p] = 0;
+ buffer[p] = '\0';
}
/* Handle the case when a buffer is not provided. */
for (;;)
{
- for (ss = s + 1; *ss != 0 && *ss != sep; ss++) ;
+ for (ss = s + 1; *ss && *ss != sep; ss++) ;
g = string_catn(g, s, ss-s);
s = ss;
- if (*s == 0 || *(++s) != sep || sep_is_special) break;
+ if (!*s || *++s != sep || sep_is_special) break;
}
while (g->ptr > 0 && isspace(g->s[g->ptr-1])) g->ptr--;
buffer = string_from_gstring(g);
incl_ip, &retry_host_key, &retry_message_key);
DEBUG(D_transport) debug_printf("%s [%s]%s retry-status = %s\n", host->name,
- (host->address == NULL)? US"" : host->address, pistring,
- (host->status == hstatus_usable)? "usable" :
- (host->status == hstatus_unusable)? "unusable" :
- (host->status == hstatus_unusable_expired)? "unusable (expired)" : "?");
+ host->address ? host->address : US"", pistring,
+ host->status == hstatus_usable ? "usable"
+ : host->status == hstatus_unusable ? "unusable"
+ : host->status == hstatus_unusable_expired ? "unusable (expired)" : "?");
/* Skip this address if not usable at this time, noting if it wasn't
actually expired, both locally and in the address. */
self router called for myhost.test.ex@mxt1.test.ex
domain = mxt1.test.ex
route_item = * $local_part byname
-original list of hosts = "$local_part" options = byname
-expanded list of hosts = "myhost.test.ex" options = byname
+original list of hosts = '$local_part' options = 'byname'
+expanded list of hosts = 'myhost.test.ex' options = 'byname'
set transport remote_smtp
finding IP address for myhost.test.ex
calling host_find_byname
self router called for xx@mxt1.test.ex
domain = mxt1.test.ex
route_item = * $local_part byname
-original list of hosts = "$local_part" options = byname
-expanded list of hosts = "xx" options = byname
+original list of hosts = '$local_part' options = 'byname'
+expanded list of hosts = 'xx' options = 'byname'
set transport remote_smtp
finding IP address for xx
calling host_find_byname
self2 router called for xx@mxt1.test.ex
domain = mxt1.test.ex
route_item = * myhost.test.ex byname
-original list of hosts = "myhost.test.ex" options = byname
-expanded list of hosts = "myhost.test.ex" options = byname
+original list of hosts = 'myhost.test.ex' options = 'byname'
+expanded list of hosts = 'myhost.test.ex' options = 'byname'
set transport remote_smtp
finding IP address for myhost.test.ex
calling host_find_byname
domain = smart.domain
route_item = *
smart.domain in "*"? yes (matched "*")
-original list of hosts = "" options =
-expanded list of hosts = "" options =
+original list of hosts = '' options = ''
+expanded list of hosts = '' options = ''
queued for <unset> transport: local_part = x
domain = smart.domain
errors_to=NULL
domainlist1 router called for x@ten
domain = ten
route_item = ten <+V4NET.0.0.0+V4NET.0.0.1 byname
-original list of hosts = "<+V4NET.0.0.0+V4NET.0.0.1" options = byname
-expanded list of hosts = "<+V4NET.0.0.0+V4NET.0.0.1" options = byname
+original list of hosts = '<+V4NET.0.0.0+V4NET.0.0.1' options = 'byname'
+expanded list of hosts = '<+V4NET.0.0.0+V4NET.0.0.1' options = 'byname'
finding IP address for V4NET.0.0.0
calling host_find_byname
finding IP address for V4NET.0.0.1
domain = two
route_item = ten <+V4NET.0.0.0+V4NET.0.0.1 byname
route_item = two V4NET.0.0.2:V4NET.0.0.4 byname
-original list of hosts = "V4NET.0.0.2:V4NET.0.0.4" options = byname
-expanded list of hosts = "V4NET.0.0.2:V4NET.0.0.4" options = byname
+original list of hosts = 'V4NET.0.0.2:V4NET.0.0.4' options = 'byname'
+expanded list of hosts = 'V4NET.0.0.2:V4NET.0.0.4' options = 'byname'
finding IP address for V4NET.0.0.2
calling host_find_byname
finding IP address for V4NET.0.0.4
domain = one
route_item = six <+V4NET.0.0.6+V4NET.0.0.7 byname
route_item = one V4NET.0.0.2:V4NET.0.0.4 byname
-original list of hosts = "V4NET.0.0.2:V4NET.0.0.4" options = byname
-expanded list of hosts = "V4NET.0.0.2:V4NET.0.0.4" options = byname
+original list of hosts = 'V4NET.0.0.2:V4NET.0.0.4' options = 'byname'
+expanded list of hosts = 'V4NET.0.0.2:V4NET.0.0.4' options = 'byname'
finding IP address for V4NET.0.0.2
calling host_find_byname
finding IP address for V4NET.0.0.4
domainlist2 router called for x@six
domain = six
route_item = six <+V4NET.0.0.6+V4NET.0.0.7 byname
-original list of hosts = "<+V4NET.0.0.6+V4NET.0.0.7" options = byname
-expanded list of hosts = "<+V4NET.0.0.6+V4NET.0.0.7" options = byname
+original list of hosts = '<+V4NET.0.0.6+V4NET.0.0.7' options = 'byname'
+expanded list of hosts = '<+V4NET.0.0.6+V4NET.0.0.7' options = 'byname'
finding IP address for V4NET.0.0.6
calling host_find_byname
finding IP address for V4NET.0.0.7
self router called for myhost.test.ex@mxt1.test.ex
domain = mxt1.test.ex
route_item = * $local_part byname
-original list of hosts = "$local_part" options = byname
-expanded list of hosts = "myhost.test.ex" options = byname
+original list of hosts = '$local_part' options = 'byname'
+expanded list of hosts = 'myhost.test.ex' options = 'byname'
set transport remote_smtp
finding IP address for myhost.test.ex
calling host_find_byname
self router called for xx@mxt1.test.ex
domain = mxt1.test.ex
route_item = * $local_part byname
-original list of hosts = "$local_part" options = byname
-expanded list of hosts = "xx" options = byname
+original list of hosts = '$local_part' options = 'byname'
+expanded list of hosts = 'xx' options = 'byname'
set transport remote_smtp
finding IP address for xx
calling host_find_byname
self2 router called for xx@mxt1.test.ex
domain = mxt1.test.ex
route_item = * myhost.test.ex byname
-original list of hosts = "myhost.test.ex" options = byname
-expanded list of hosts = "myhost.test.ex" options = byname
+original list of hosts = 'myhost.test.ex' options = 'byname'
+expanded list of hosts = 'myhost.test.ex' options = 'byname'
set transport remote_smtp
finding IP address for myhost.test.ex
calling host_find_byname
fail router called for fff@mxt1.test.ex
domain = mxt1.test.ex
route_item = * $local_part byname
-original list of hosts = "$local_part" options = byname
-expanded list of hosts = "fff" options = byname
+original list of hosts = '$local_part' options = 'byname'
+expanded list of hosts = 'fff' options = 'byname'
set transport remote_smtp
finding IP address for fff
calling host_find_byname
domain = test.again.dns
route_item = * $domain bydns
test.again.dns in "*"? yes (matched "*")
-original list of hosts = "$domain" options = bydns
-expanded list of hosts = "test.again.dns" options = bydns
+original list of hosts = '$domain' options = 'bydns'
+expanded list of hosts = 'test.again.dns' options = 'bydns'
set transport smtp
finding IP address for test.again.dns
doing DNS lookup
domain = test.again.dns
route_item = * $domain bydns
test.again.dns in "*"? yes (matched "*")
-original list of hosts = "$domain" options = bydns
-expanded list of hosts = "test.again.dns" options = bydns
+original list of hosts = '$domain' options = 'bydns'
+expanded list of hosts = 'test.again.dns' options = 'bydns'
finding IP address for test.again.dns
doing DNS lookup
DNS lookup of test.again.dns-A: using cached value DNS_AGAIN
domain = test.fail.dns
route_item = * $domain bydns
test.fail.dns in "*"? yes (matched "*")
-original list of hosts = "$domain" options = bydns
-expanded list of hosts = "test.fail.dns" options = bydns
+original list of hosts = '$domain' options = 'bydns'
+expanded list of hosts = 'test.fail.dns' options = 'bydns'
set transport smtp
finding IP address for test.fail.dns
doing DNS lookup
domain = test.fail.dns
route_item = * $domain bydns
test.fail.dns in "*"? yes (matched "*")
-original list of hosts = "$domain" options = bydns
-expanded list of hosts = "test.fail.dns" options = bydns
+original list of hosts = '$domain' options = 'bydns'
+expanded list of hosts = 'test.fail.dns' options = 'bydns'
finding IP address for test.fail.dns
doing DNS lookup
DNS lookup of test.fail.dns-A: using cached value DNS_FAIL
domain = nonexist.test.ex
route_item = * $domain bydns
nonexist.test.ex in "*"? yes (matched "*")
-original list of hosts = "$domain" options = bydns
-expanded list of hosts = "nonexist.test.ex" options = bydns
+original list of hosts = '$domain' options = 'bydns'
+expanded list of hosts = 'nonexist.test.ex' options = 'bydns'
set transport smtp
finding IP address for nonexist.test.ex
doing DNS lookup
domain = nonexist.test.ex
route_item = * $domain bydns
nonexist.test.ex in "*"? yes (matched "*")
-original list of hosts = "$domain" options = bydns
-expanded list of hosts = "nonexist.test.ex" options = bydns
+original list of hosts = '$domain' options = 'bydns'
+expanded list of hosts = 'nonexist.test.ex' options = 'bydns'
finding IP address for nonexist.test.ex
doing DNS lookup
DNS lookup of nonexist.test.ex-A: using cached value DNS_NOMATCH
domain = y
route_item = * "127.0.0.1 : V4NET.0.0.0"
y in "*"? yes (matched "*")
-original list of hosts = "127.0.0.1 : V4NET.0.0.0" options =
-expanded list of hosts = "127.0.0.1 : V4NET.0.0.0" options =
+original list of hosts = '127.0.0.1 : V4NET.0.0.0' options = ''
+expanded list of hosts = '127.0.0.1 : V4NET.0.0.0' options = ''
set transport smtp
finding IP address for 127.0.0.1
calling host_find_byname
domain = remote
route_item = * 127.0.0.1
remote in "*"? yes (matched "*")
-original list of hosts = "127.0.0.1" options =
-expanded list of hosts = "127.0.0.1" options =
+original list of hosts = '127.0.0.1' options = ''
+expanded list of hosts = '127.0.0.1' options = ''
set transport t2
finding IP address for 127.0.0.1
calling host_find_byname
domain = remote
route_item = * 127.0.0.1
remote in "*"? yes (matched "*")
-original list of hosts = "127.0.0.1" options =
-expanded list of hosts = "127.0.0.1" options =
+original list of hosts = '127.0.0.1' options = ''
+expanded list of hosts = '127.0.0.1' options = ''
finding IP address for 127.0.0.1
calling host_find_byname
using host_fake_gethostbyname for 127.0.0.1 (IPv4)
domain = remote
route_item = * 127.0.0.1
remote in "*"? yes (matched "*")
-original list of hosts = "127.0.0.1" options =
-expanded list of hosts = "127.0.0.1" options =
+original list of hosts = '127.0.0.1' options = ''
+expanded list of hosts = '127.0.0.1' options = ''
finding IP address for 127.0.0.1
calling host_find_byname
using host_fake_gethostbyname for 127.0.0.1 (IPv4)
s router called for PASS@some.host
domain = some.host
route_item = * 127.0.0.1 byname
-original list of hosts = "127.0.0.1" options = byname
-expanded list of hosts = "127.0.0.1" options = byname
+original list of hosts = '127.0.0.1' options = 'byname'
+expanded list of hosts = '127.0.0.1' options = 'byname'
set transport smtp
finding IP address for 127.0.0.1
calling host_find_byname