X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/8768d5483a5894400ae1f70cda1beb44ed9b087c..d12746bc15d83ab821be36975da0179672708bc1:/src/src/host.c diff --git a/src/src/host.c b/src/src/host.c index 0da99334a..c3694c047 100644 --- a/src/src/host.c +++ b/src/src/host.c @@ -1796,7 +1796,7 @@ 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 (sender_host_name == NULL) +if (!sender_host_name) { if (host_checking || !f.log_testing_mode) log_write(L_host_lookup_failed, LOG_MAIN, "no host name found for IP " @@ -1832,15 +1832,9 @@ for (hname = sender_host_name; hname; hname = *aliases++) { 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 @@ -2598,14 +2592,15 @@ f.host_find_failed_syntax = FALSE; 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; - (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 @@ -2614,7 +2609,8 @@ if ((whichrrs & HOST_FIND_BY_SRV) != 0) 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) @@ -2630,7 +2626,7 @@ if ((whichrrs & HOST_FIND_BY_SRV) != 0) { 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