]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: dns: unable to parse CNAMEs response
authorBaptiste Assmann <bedis9@gmail.com>
Wed, 28 Oct 2015 01:10:02 +0000 (02:10 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 30 Oct 2015 11:39:08 +0000 (12:39 +0100)
A bug lied in the parsing of DNS CNAME response, leading HAProxy to
think the CNAME was improperly resolved in the response.

This should be backported into 1.6 branch

src/dns.c

index 53b65ab8d912794301c5769d7de96e9637a7b321..1348be3d971c34f3bb3937114097abea45260661 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -628,8 +628,11 @@ int dns_get_ip_from_response(unsigned char *resp, unsigned char *resp_end,
                else
                        ptr = reader;
 
-               if (cname && memcmp(ptr, cname, cnamelen))
-                       return DNS_UPD_NAME_ERROR;
+               if (cname) {
+                       if (memcmp(ptr, cname, cnamelen)) {
+                               return DNS_UPD_NAME_ERROR;
+                       }
+               }
                else if (memcmp(ptr, dn_name, dn_name_len))
                        return DNS_UPD_NAME_ERROR;