diff options
author | Marco d'Itri <md@linux.it> | 2017-12-20 15:43:44 +0100 |
---|---|---|
committer | Marco d'Itri <md@linux.it> | 2017-12-27 03:09:58 +0100 |
commit | 4be183d651072d459295881d0ed09dba575d0687 (patch) | |
tree | aa6a8b92a2bd4ce34432305c3f58d0bb0b1cb8bd | |
parent | 8a4023b3152a55fcf0dcea26fe3d455fc99e3eae (diff) | |
download | whois-4be183d651072d459295881d0ed09dba575d0687.tar.gz |
Remove the inet_pton(3)-based parser
It has never worked and never will.
-rw-r--r-- | config.h | 4 | ||||
-rw-r--r-- | whois.c | 37 |
2 files changed, 0 insertions, 41 deletions
@@ -60,10 +60,6 @@ /* FIXME: which systems lack this? */ #define HAVE_GETTIMEOFDAY -/* FIXME: disabled because it does not parse addresses with a netmask length. - * The code using it needs to be either fixed or removed. -#define HAVE_INET_PTON -*/ /* * Please send patches to correctly ignore old releases which lack a RNG @@ -36,9 +36,6 @@ #elif defined HAVE_LIBIDN #include <idna.h> #endif -#ifdef HAVE_INET_PTON -#include <arpa/inet.h> -#endif /* Application-specific */ #include "version.h" @@ -541,12 +538,7 @@ char *guess_server(const char *s) return strdup(whereas32(as32)); /* smells like an IP? */ -#ifdef HAVE_INET_PTON - if (inet_pton(AF_INET, s, &ip) > 0) { - ip = ntohl(ip); -#else if ((ip = myinet_aton(s))) { -#endif for (i = 0; ip_assign[i].serv; i++) if ((ip & ip_assign[i].mask) == ip_assign[i].net) return strdup(ip_assign[i].serv); @@ -1260,18 +1252,6 @@ void split_server_port(const char *const input, char *convert_6to4(const char *s) { char *new; - -#ifdef HAVE_INET_PTON - struct in6_addr ipaddr; - unsigned char *ip; - - if (inet_pton(AF_INET6, s, &ipaddr) <= 0) - return strdup("0.0.0.0"); - - ip = (unsigned char *)&ipaddr; - new = malloc(sizeof("255.255.255.255")); - sprintf(new, "%d.%d.%d.%d", *(ip + 2), *(ip + 3), *(ip + 4), *(ip + 5)); -#else int items; unsigned int a, b; char c; @@ -1290,7 +1270,6 @@ char *convert_6to4(const char *s) new = malloc(sizeof("255.255.255.255")); sprintf(new, "%u.%u.%u.%u", a >> 8, a & 0xff, b >> 8, b & 0xff); -#endif return new; } @@ -1298,19 +1277,6 @@ char *convert_6to4(const char *s) char *convert_teredo(const char *s) { char *new; - -#ifdef HAVE_INET_PTON - struct in6_addr ipaddr; - unsigned char *ip; - - if (inet_pton(AF_INET6, s, &ipaddr) <= 0) - return strdup("0.0.0.0"); - - ip = (unsigned char *)&ipaddr; - new = malloc(sizeof("255.255.255.255")); - sprintf(new, "%d.%d.%d.%d", *(ip + 12) ^ 0xff, *(ip + 13) ^ 0xff, - *(ip + 14) ^ 0xff, *(ip + 15) ^ 0xff); -#else unsigned int a, b; if (sscanf(s, "2001:%*[^:]:%*[^:]:%*[^:]:%*[^:]:%*[^:]:%x:%x", &a, &b) != 2) @@ -1320,7 +1286,6 @@ char *convert_teredo(const char *s) b ^= 0xffff; new = malloc(sizeof("255.255.255.255")); sprintf(new, "%u.%u.%u.%u", a >> 8, a & 0xff, b >> 8, b & 0xff); -#endif return new; } @@ -1361,7 +1326,6 @@ char *convert_inaddr(const char *s) return new; } -#ifndef HAVE_INET_PTON unsigned long myinet_aton(const char *s) { unsigned long a, b, c, d; @@ -1377,7 +1341,6 @@ unsigned long myinet_aton(const char *s) return 0; return (a << 24) + (b << 16) + (c << 8) + d; } -#endif unsigned long asn32_to_long(const char *s) { |