From: Stephan Bosch Date: Tue, 22 Sep 2020 20:12:27 +0000 (+0200) Subject: lib-http: http-client-host - Make sure DNS lookup is performed when host has no IPs. X-Git-Tag: 2.3.13~130 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c701368bef2ab176e9c12ea25b0a700260ef40a7;p=thirdparty%2Fdovecot%2Fcore.git lib-http: http-client-host - Make sure DNS lookup is performed when host has no IPs. This fixes at least one panic: Panic: file ./http-client-private.h: line 679 (http_client_host_get_ip): assertion failed: (idx < host->shared->ips_count) --- diff --git a/src/lib-http/http-client-host.c b/src/lib-http/http-client-host.c index 27126eebdb..2168795b68 100644 --- a/src/lib-http/http-client-host.c +++ b/src/lib-http/http-client-host.c @@ -187,14 +187,15 @@ http_client_host_shared_refresh(struct http_client_host_shared *hshared) if (hshared->dns_lookup != NULL) return -1; - if (hshared->ips_count > 0 && - timeval_cmp(&hshared->ips_timeout, &ioloop_timeval) > 0) - return 0; - - if (hshared->to_idle != NULL) - return 0; + if (hshared->ips_count == 0) { + e_debug(hshared->event, "Need to perform DNS lookup"); + } else { + if (timeval_cmp(&hshared->ips_timeout, &ioloop_timeval) > 0) + return 0; - e_debug(hshared->event, "IPs have expired; need to refresh DNS lookup"); + e_debug(hshared->event, "IPs have expired; " + "need to refresh DNS lookup"); + } http_client_host_shared_lookup(hshared); if (hshared->dns_lookup != NULL)