mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 13:21:29 +02:00
BUG/MEDIUM: resolvers: Accept to create resolution without hostname
A regression was introduced by commit 6cf2401ed ("BUG/MEDIUM: resolvers: Make resolution owns its hostname_dn value"). In fact, it is possible (an allowed ?!) to create a resolution without hostname (hostname_dn == NULL). It only happens on startup for a server relying on a resolver but defined with an IP address and not a hostname Because of the patch above, an error is triggered during the configuration parsing when this happens, while it should be accepted. This patch must be backported with the commit above.
This commit is contained in:
parent
6cf2401eda
commit
e6a9192af6
@ -1943,7 +1943,7 @@ static struct resolv_resolution *resolv_pick_resolution(struct resolvers *resolv
|
|||||||
struct resolv_resolution *res = NULL;
|
struct resolv_resolution *res = NULL;
|
||||||
|
|
||||||
if (!*hostname_dn)
|
if (!*hostname_dn)
|
||||||
goto err;
|
goto from_pool;
|
||||||
|
|
||||||
/* Search for same hostname and query type in resolutions.curr */
|
/* Search for same hostname and query type in resolutions.curr */
|
||||||
list_for_each_entry(res, &resolvers->resolutions.curr, list) {
|
list_for_each_entry(res, &resolvers->resolutions.curr, list) {
|
||||||
@ -1981,9 +1981,11 @@ static struct resolv_resolution *resolv_pick_resolution(struct resolvers *resolv
|
|||||||
|
|
||||||
res->prefered_query_type = query_type;
|
res->prefered_query_type = query_type;
|
||||||
res->query_type = query_type;
|
res->query_type = query_type;
|
||||||
res->hostname_dn = strdup(*hostname_dn);
|
if (*hostname_dn) {
|
||||||
if (res->hostname_dn == NULL)
|
res->hostname_dn = strdup(*hostname_dn);
|
||||||
goto err;
|
if (res->hostname_dn == NULL)
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
res->hostname_dn_len = hostname_dn_len;
|
res->hostname_dn_len = hostname_dn_len;
|
||||||
|
|
||||||
++resolution_uuid;
|
++resolution_uuid;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user