From c44d8b51ffb5a413f8bbdbd9991bbc573853e397 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henryk=20Pl=C3=B6tz?= Date: Fri, 3 Oct 2014 20:04:14 +0200 Subject: Apply patch djbdns-1.05-test27.diff.bz2 Source was http://www.fefe.de/dns/djbdns-1.05-test27.diff.bz2, SHA1 f0380ec1866f49c0bcf6369a923ac0a4a5095da8 --- dns_rcip.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'dns_rcip.c') diff --git a/dns_rcip.c b/dns_rcip.c index 97bd8f5..efd1b21 100644 --- a/dns_rcip.c +++ b/dns_rcip.c @@ -2,12 +2,13 @@ #include "openreadclose.h" #include "byte.h" #include "ip4.h" +#include "ip6.h" #include "env.h" #include "dns.h" static stralloc data = {0}; -static int init(char ip[64]) +static int init(char ip[256]) { int i; int j; @@ -20,10 +21,10 @@ static int init(char ip[64]) if (*x == '.') ++x; else { - i = ip4_scan(x,ip + iplen); + i = ip6_scan(x,ip + iplen); if (!i) break; x += i; - iplen += 4; + iplen += 16; } } @@ -40,10 +41,8 @@ static int init(char ip[64]) while ((data.s[i] == ' ') || (data.s[i] == '\t')) ++i; if (iplen <= 60) - if (ip4_scan(data.s + i,ip + iplen)) { - if (byte_equal(ip + iplen,4,"\0\0\0\0")) - byte_copy(ip + iplen,4,"\177\0\0\1"); - iplen += 4; + if (ip6_scan(data.s + i,ip + iplen)) { + iplen += 16; } } i = j + 1; @@ -52,19 +51,19 @@ static int init(char ip[64]) } if (!iplen) { - byte_copy(ip,4,"\177\0\0\1"); - iplen = 4; + byte_copy(ip,16,"\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1"); + iplen = 16; } - byte_zero(ip + iplen,64 - iplen); + byte_zero(ip + iplen,256 - iplen); return 0; } static int ok = 0; static unsigned int uses; static struct taia deadline; -static char ip[64]; /* defined if ok */ +static char ip[256]; /* defined if ok */ -int dns_resolvconfip(char s[64]) +int dns_resolvconfip(char s[256]) { struct taia now; @@ -81,6 +80,6 @@ int dns_resolvconfip(char s[64]) } --uses; - byte_copy(s,64,ip); + byte_copy(s,256,ip); return 0; } -- cgit v1.2.3