openbsd-ports/www/dillo/patches/patch-src_dns_c
couderc 3e7a42eed0 some fixes :
- use native SUN_LEN macro
- sweet fix for threaded name resolution from dhartmei@
2003-02-22 17:11:05 +00:00

65 lines
1.9 KiB
Plaintext

$OpenBSD: patch-src_dns_c,v 1.4 2003/02/22 17:11:05 couderc Exp $
--- src/dns.c.orig Thu Dec 26 13:39:57 2002
+++ src/dns.c Sat Feb 22 18:47:04 2003
@@ -30,14 +30,13 @@
#include "dns.h"
#include "list.h"
-#define DEBUG_LEVEL 5
#include "debug.h"
/*
* Note: comment the following line for debugging or gprof profiling.
*/
-#define G_DNS_THREADED
+/* #define G_DNS_THREADED */
/*
* Uncomment the following line for libc5 optimization
@@ -304,7 +303,7 @@ static void *Dns_server(void *data)
*/
static void Dns_blocking_server(void)
{
- struct hostent *host;
+ struct hostent *host = NULL;
gint index;
GSList *hosts = NULL;
@@ -313,18 +312,28 @@ static void Dns_blocking_server(void)
DEBUG_MSG(3, "Dns_blocking_server: dns_server[%d].hostname = %s\n",
index, dns_server[index].hostname);
- host = gethostbyname(dns_server[index].hostname);
- if (host == NULL) {
- DEBUG_MSG(3, "--> Dns_blocking_server: gethostbyname NULL return\n");
- } else {
- DEBUG_MSG(3, "--> Dns_blocking_server - good return\n");
- hosts = Dns_note_hosts(hosts, AF_INET, host);
+#ifdef ENABLE_IPV6
+ if (ipv6_enabled) {
+ host = gethostbyname2(dns_server[index].hostname, AF_INET6);
+ if (host)
+ hosts = Dns_note_hosts(hosts, AF_INET6, host);
+ }
+#endif
+
+ if (!host) {
+ host = gethostbyname(dns_server[index].hostname);
+ if (host == NULL) {
+ DEBUG_MSG(3, "--> Dns_blocking_server: gethostbyname NULL return\n");
+ } else {
+ DEBUG_MSG(3, "--> Dns_blocking_server - good return\n");
+ hosts = Dns_note_hosts(hosts, AF_INET, host);
+ }
}
/* write IP to server data channel */
DEBUG_MSG(3, "Dns_blocking_server: IP of %s is %p\n",
dns_server[index].hostname, hosts);
- dns_server[index].ip_addr = hosts;
+ dns_server[index].addr_list = hosts;
dns_server[index].ip_ready = TRUE;
DEBUG_MSG(3, "Dns_blocking_server: leaving...\n");