From: Marco van Wieringen Date: Tue, 26 Jun 2012 19:11:17 +0000 (+0200) Subject: Real fix of bug #1897 X-Git-Tag: Release-7.0.0~166 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=d5c2d4e164b56acaffe61592b5a4880c8b50deea;p=bacula%2Fbacula Real fix of bug #1897 We are only interested in SOCK_STREAM and protocol IPPROTO_TCP as that is the way we communicate. When we don't specify that in the hints for getaddrinfo we also get SOCK_DGRAM/IPPROTO_UDP and on Linux SOCK_RAW. And possibly more on other platforms. So lets me more specific. The older fix to suppress duplicates is also useable as a user might specify two or more names that resolve to the same address and we want to suppress duplicates also. --- diff --git a/bacula/src/lib/bnet.c b/bacula/src/lib/bnet.c index 1e8b8f4d3e..a2b18370b3 100644 --- a/bacula/src/lib/bnet.c +++ b/bacula/src/lib/bnet.c @@ -418,8 +418,8 @@ const char *resolv_host(int family, const char *host, dlist *addr_list) memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = family; - hints.ai_socktype = 0; - hints.ai_protocol = 0; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; hints.ai_flags = 0; res = getaddrinfo(host, NULL, &hints, &ai);