Fix UDP DNS queries in addns
authorTimur I. Bakeyev <timur@iXsystems.com>
Mon, 11 Jun 2018 20:38:00 +0000 (04:38 +0800)
committerJeremy Allison <jra@samba.org>
Wed, 13 Jun 2018 01:51:04 +0000 (03:51 +0200)
The addns code tries to use common approach for TCP and UDP queries,
calling connect() for both types of sockets. In case of UDP that
requires to use send() instead of sendto().

Signed-off-by: Timur I. Bakeyev <timur@iXsystems.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jun 13 03:51:04 CEST 2018 on sn-devel-144

lib/addns/dnssock.c

index ec42b7ca6892428d9efbb3320c338584fe0174ee..30b8fa2eaf44dbefd43d9745c0d675fb1f3753c7 100644 (file)
@@ -221,9 +221,7 @@ static DNS_ERROR dns_send_udp(struct dns_connection *conn,
        ssize_t ret;
 
        do {
-               ret = sendto(conn->s, buf->data, buf->offset, 0,
-                    (struct sockaddr *)&conn->RecvAddr,
-                    sizeof(conn->RecvAddr));
+               ret = send(conn->s, buf->data, buf->offset, 0);
        } while ((ret == -1) && (errno == EINTR));
 
        if (ret != buf->offset) {