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
Recast more internal string routines to use growable-strings
[exim.git]
/
src
/
src
/
host.c
diff --git
a/src/src/host.c
b/src/src/host.c
index 7118221771f64d3c52b5b41052eeca8c3685109c..c3694c047b4b399614f6994e1c0ac322979ec7ff 100644
(file)
--- a/
src/src/host.c
+++ b/
src/src/host.c
@@
-84,7
+84,7
@@
if (limit < 1)
return 0;
if (random_seed == 0)
{
return 0;
if (random_seed == 0)
{
- if (running_in_test_harness) random_seed = 42; else
+ if (
f.
running_in_test_harness) random_seed = 42; else
{
int p = (int)getpid();
random_seed = (int)time(NULL) ^ ((p << 16) | p);
{
int p = (int)getpid();
random_seed = (int)time(NULL) ^ ((p << 16) | p);
@@
-1674,7
+1674,7
@@
HDEBUG(D_host_lookup)
/* For testing the case when a lookup does not complete, we have a special
reserved IP address. */
/* For testing the case when a lookup does not complete, we have a special
reserved IP address. */
-if (running_in_test_harness &&
+if (
f.
running_in_test_harness &&
Ustrcmp(sender_host_address, "99.99.99.99") == 0)
{
HDEBUG(D_host_lookup)
Ustrcmp(sender_host_address, "99.99.99.99") == 0)
{
HDEBUG(D_host_lookup)
@@
-1796,9
+1796,9
@@
while ((ordername = string_nextinlist(&list, &sep, buffer, sizeof(buffer))))
/* If we have failed to find a name, return FAIL and log when required.
NB host_lookup_msg must be in permanent store. */
/* If we have failed to find a name, return FAIL and log when required.
NB host_lookup_msg must be in permanent store. */
-if (
sender_host_name == NULL
)
+if (
!sender_host_name
)
{
{
- if (host_checking || !log_testing_mode)
+ if (host_checking || !
f.
log_testing_mode)
log_write(L_host_lookup_failed, LOG_MAIN, "no host name found for IP "
"address %s", sender_host_address);
host_lookup_msg = US" (failed to find host name from IP address)";
log_write(L_host_lookup_failed, LOG_MAIN, "no host name found for IP "
"address %s", sender_host_address);
host_lookup_msg = US" (failed to find host name from IP address)";
@@
-1832,15
+1832,9
@@
for (hname = sender_host_name; hname; hname = *aliases++)
{
int rc;
BOOL ok = FALSE;
{
int rc;
BOOL ok = FALSE;
- host_item h;
- dnssec_domains d;
-
- h.next = NULL;
- h.name = hname;
- h.mx = MX_NONE;
- h.address = NULL;
- d.request = sender_host_dnssec ? US"*" : NULL;;
- d.require = NULL;
+ host_item h = { .next = NULL, .name = hname, .mx = MX_NONE, .address = NULL };
+ dnssec_domains d =
+ { .request = sender_host_dnssec ? US"*" : NULL, .require = NULL };
if ( (rc = host_find_bydns(&h, NULL, HOST_FIND_BY_A | HOST_FIND_BY_AAAA,
NULL, NULL, NULL, &d, NULL, NULL)) == HOST_FOUND
if ( (rc = host_find_bydns(&h, NULL, HOST_FIND_BY_A | HOST_FIND_BY_AAAA,
NULL, NULL, NULL, &d, NULL, NULL)) == HOST_FOUND
@@
-2011,7
+2005,7
@@
lookups here (except when testing standalone). */
/* Initialize the flag that gets set for DNS syntax check errors, so that the
interface to this function can be similar to host_find_bydns. */
/* Initialize the flag that gets set for DNS syntax check errors, so that the
interface to this function can be similar to host_find_bydns. */
-host_find_failed_syntax = FALSE;
+
f.
host_find_failed_syntax = FALSE;
/* Loop to look up both kinds of address in an IPv6 world */
/* Loop to look up both kinds of address in an IPv6 world */
@@
-2033,7
+2027,7
@@
for (i = 1; i <= times;
if (slow_lookup_log) time_msec = get_time_in_ms();
#if HAVE_IPV6
if (slow_lookup_log) time_msec = get_time_in_ms();
#if HAVE_IPV6
- if (running_in_test_harness)
+ if (
f.
running_in_test_harness)
hostdata = host_fake_gethostbyname(host->name, af, &error_num);
else
{
hostdata = host_fake_gethostbyname(host->name, af, &error_num);
else
{
@@
-2046,7
+2040,7
@@
for (i = 1; i <= times;
}
#else /* not HAVE_IPV6 */
}
#else /* not HAVE_IPV6 */
- if (running_in_test_harness)
+ if (
f.
running_in_test_harness)
hostdata = host_fake_gethostbyname(host->name, AF_INET, &error_num);
else
{
hostdata = host_fake_gethostbyname(host->name, AF_INET, &error_num);
else
{
@@
-2171,7
+2165,7
@@
if (host->address == NULL)
HDEBUG(D_host_lookup) debug_printf("%s\n", msg);
if (temp_error) goto RETURN_AGAIN;
HDEBUG(D_host_lookup) debug_printf("%s\n", msg);
if (temp_error) goto RETURN_AGAIN;
- if (host_checking || !log_testing_mode)
+ if (host_checking || !
f.
log_testing_mode)
log_write(L_host_lookup_failed, LOG_MAIN, "%s", msg);
return HOST_FIND_FAILED;
}
log_write(L_host_lookup_failed, LOG_MAIN, "%s", msg);
return HOST_FIND_FAILED;
}
@@
-2592,20
+2586,21
@@
if (fully_qualified_name != NULL) *fully_qualified_name = host->name;
dns_init((whichrrs & HOST_FIND_QUALIFY_SINGLE) != 0,
(whichrrs & HOST_FIND_SEARCH_PARENTS) != 0,
dnssec_request);
dns_init((whichrrs & HOST_FIND_QUALIFY_SINGLE) != 0,
(whichrrs & HOST_FIND_SEARCH_PARENTS) != 0,
dnssec_request);
-host_find_failed_syntax = FALSE;
+
f.
host_find_failed_syntax = FALSE;
/* First, if requested, look for SRV records. The service name is given; we
assume TCP protocol. DNS domain names are constrained to a maximum of 256
characters, so the code below should be safe. */
/* First, if requested, look for SRV records. The service name is given; we
assume TCP protocol. DNS domain names are constrained to a maximum of 256
characters, so the code below should be safe. */
-if (
(whichrrs & HOST_FIND_BY_SRV) != 0
)
+if (
whichrrs & HOST_FIND_BY_SRV
)
{
{
-
uschar buffer[300]
;
- uschar *
temp_fully_qualified_name = buffer
;
+
gstring * g
;
+ uschar *
temp_fully_qualified_name
;
int prefix_length;
int prefix_length;
- (void)sprintf(CS buffer, "_%s._tcp.%n%.256s", srv_service, &prefix_length,
- host->name);
+ g = string_fmt_append(NULL, "_%s._tcp.%n%.256s",
+ srv_service, &prefix_length, host->name);
+ temp_fully_qualified_name = string_from_gstring(g);
ind_type = T_SRV;
/* Search for SRV records. If the fully qualified name is different to
ind_type = T_SRV;
/* Search for SRV records. If the fully qualified name is different to
@@
-2614,7
+2609,8
@@
if ((whichrrs & HOST_FIND_BY_SRV) != 0)
dnssec = DS_UNK;
lookup_dnssec_authenticated = NULL;
dnssec = DS_UNK;
lookup_dnssec_authenticated = NULL;
- rc = dns_lookup_timerwrap(&dnsa, buffer, ind_type, CUSS &temp_fully_qualified_name);
+ rc = dns_lookup_timerwrap(&dnsa, temp_fully_qualified_name, ind_type,
+ CUSS &temp_fully_qualified_name);
DEBUG(D_dns)
if ((dnssec_request || dnssec_require)
DEBUG(D_dns)
if ((dnssec_request || dnssec_require)
@@
-2630,7
+2626,7
@@
if ((whichrrs & HOST_FIND_BY_SRV) != 0)
{ dnssec = DS_NO; lookup_dnssec_authenticated = US"no"; }
}
{ dnssec = DS_NO; lookup_dnssec_authenticated = US"no"; }
}
- if (temp_fully_qualified_name !=
buffer
&& fully_qualified_name != NULL)
+ if (temp_fully_qualified_name !=
g->s
&& fully_qualified_name != NULL)
*fully_qualified_name = temp_fully_qualified_name + prefix_length;
/* On DNS failures, we give the "try again" error unless the domain is
*fully_qualified_name = temp_fully_qualified_name + prefix_length;
/* On DNS failures, we give the "try again" error unless the domain is
@@
-3268,7
+3264,7
@@
while (Ufgets(buffer, 256, stdin) != NULL)
else if (Ustrcmp(buffer, "require_dnssec") == 0) require_dnssec = TRUE;
else if (Ustrcmp(buffer, "no_require_dnssec") == 0) require_dnssec = FALSE;
else if (Ustrcmp(buffer, "test_harness") == 0)
else if (Ustrcmp(buffer, "require_dnssec") == 0) require_dnssec = TRUE;
else if (Ustrcmp(buffer, "no_require_dnssec") == 0) require_dnssec = FALSE;
else if (Ustrcmp(buffer, "test_harness") == 0)
-
running_in_test_harness = !
running_in_test_harness;
+
f.running_in_test_harness = !f.
running_in_test_harness;
else if (Ustrcmp(buffer, "ipv6") == 0) disable_ipv6 = !disable_ipv6;
else if (Ustrcmp(buffer, "res_debug") == 0)
{
else if (Ustrcmp(buffer, "ipv6") == 0) disable_ipv6 = !disable_ipv6;
else if (Ustrcmp(buffer, "res_debug") == 0)
{