From: Christopher Faulet Date: Tue, 16 Mar 2021 10:21:04 +0000 (+0100) Subject: BUG/MINOR: resolvers: Add missing case-insensitive comparisons of DNS hostnames X-Git-Tag: v2.1.12~4 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=f9c7675a74623f68cc0315bed83aa0b32c2a20a0;p=haproxy-2.1.git BUG/MINOR: resolvers: Add missing case-insensitive comparisons of DNS hostnames DNS hostname comparisons were fixed to be case-insensitive (see b17b88487 "BUG/MEDIUM: dns: Consider the fact that dns answers are case-insensitive"). However 2 comparisons are still case-sensitive. This patch must be backported as far as 1.8. (cherry picked from commit 59b29257338f8e7fb6def6bddda45d08651ffe1c) Signed-off-by: Christopher Faulet (cherry picked from commit d31f6942249989e415bf9524ae2835180a32bbad) Signed-off-by: Christopher Faulet (cherry picked from commit e31b387c6955e792f1814b137e1593658fbc3c21) Signed-off-by: Christopher Faulet --- diff --git a/src/server.c b/src/server.c index 4f14d6b..d0fa86e 100644 --- a/src/server.c +++ b/src/server.c @@ -4294,7 +4294,7 @@ struct server *snr_check_ip_callback(struct server *srv, void *ip, unsigned char HA_SPIN_LOCK(SERVER_LOCK, &tmpsrv->lock); if ((tmpsrv->hostname_dn == NULL) || (srv->hostname_dn_len != tmpsrv->hostname_dn_len) || - (strcmp(srv->hostname_dn, tmpsrv->hostname_dn) != 0) || + (strcasecmp(srv->hostname_dn, tmpsrv->hostname_dn) != 0) || (srv->puid == tmpsrv->puid)) { HA_SPIN_UNLOCK(SERVER_LOCK, &tmpsrv->lock); continue; @@ -4373,7 +4373,8 @@ int srv_set_fqdn(struct server *srv, const char *hostname, int dns_locked) resolution = srv->dns_requester->resolution; if (resolution && resolution->hostname_dn && - !strcmp(resolution->hostname_dn, hostname_dn)) + resolution->hostname_dn_len == hostname_dn_len && + strcasecmp(resolution->hostname_dn, hostname_dn) == 0) goto end; dns_unlink_resolution(srv->dns_requester);