Ticket #832: patch-za

File patch-za, 853 bytes (added by bz, 3 years ago)

Fix relative to 2.1.4 (should equally apply to trunk)

Line 
1Index: lib/libvcl/vcc_backend.c
2===================================================================
3--- lib/libvcl/vcc_backend.c    (revision 5641)
4+++ lib/libvcl/vcc_backend.c    (working copy)
5@@ -132,10 +132,14 @@ Emit_Sockaddr(struct vcc *tl, const struct token *
6                vcc_ErrWhere(tl, t_host);
7                return;
8        }
9-       if (pop != NULL)
10-               error = getaddrinfo(hop, pop, &hint, &res0);
11-       else
12-               error = getaddrinfo(t_host->dec, port, &hint, &res0);
13+       /*
14+        * With IPv6 we cannot directly pass t_host->dec to getaddrinfo()
15+        * in case we do not have a port as it would still have the [] around
16+        * the address.  Thus prefer whatever host or port part VSS_parse()
17+        * has identified rather than all or nothing.
18+        */
19+       error = getaddrinfo((hop != NULL) ? hop : t_host->dec,
20+           (pop != NULL) ? pop : port, &hint, &res0);
21        free(hop);
22        free(pop);
23        if (error) {