]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: dns: dns_connect_server must return -1 unsupported nameserver's type
authorEmeric Brun <ebrun@haproxy.com>
Mon, 15 Feb 2021 13:28:27 +0000 (14:28 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 15 Feb 2021 14:12:58 +0000 (15:12 +0100)
This patch fix returns code in case of dns_connect_server is called
on unsupported type (which should not happen). Doing this we have
the warranty that after a return 0 the fd is never -1.

This patch should fix github issues #1127, #1128 and #1130

src/dns.c

index bc40b29e808042f32333b2f11969685116b1be6e..e1f9539e997c11ecadcaea26b2d9dc23e2ca295e 100644 (file)
--- a/src/dns.c
+++ b/src/dns.c
@@ -75,8 +75,10 @@ static int dns_connect_nameserver(struct dns_nameserver *ns)
                dgram->t.sock.fd = fd;
                fd_insert(fd, dgram, dgram_fd_handler, MAX_THREADS_MASK);
                fd_want_recv(fd);
+               return 0;
        }
-       return 0;
+
+       return -1;
 }
 
 /* Sends a message to a name server