$NetBSD: patch-ad,v 1.5 2003/12/25 14:05:02 wiz Exp $

ftp://ftp.kame.net/pub/kame/misc/gnupg-1.2.2-IPv6.diff.gz

--- util/http.c.orig	Tue Dec 23 18:33:34 2003
+++ util/http.c
@@ -751,6 +751,28 @@ connect_server( const char *server, usho
         sock_close (sd);
         return -1;
     }
+#elif defined(HAVE_GETADDRINFO)
+    struct addrinfo hints, *res0, *res;
+    char portstr[20];
+
+    memset(&hints, 0, sizeof(hints));
+    hints.ai_socktype = SOCK_STREAM;
+    snprintf(portstr, sizeof(portstr), "%u", port);
+    if (getaddrinfo(server, portstr, &hints, &res0) != 0)
+	return -1;
+    for (res = res0; res; res = res->ai_next) {
+	sd = socket(res->ai_family, res->ai_socktype, res->ai_protocol);
+	if (sd < 0)
+	    continue;
+	if (connect(sd, res->ai_addr, res->ai_addrlen) < 0) {
+	    close(sd);
+	    sd = -1;
+	    continue;
+	}
+	break;
+    }
+    freeaddrinfo(res0);
+    return sd;
 #else
     struct sockaddr_in addr;
     struct hostent *host;
