From d6e33ff64742f48f2022980fd4889ec36662cc30 Mon Sep 17 00:00:00 2001 From: Andreas Stieger Date: Tue, 4 Apr 2017 18:27:37 +0200 Subject: [PATCH] Fix CIDR notation and IPv6 queries with libidn2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #50 Fixes https://bugzilla.opensuse.org/show_bug.cgi?id=1026831 Signed-off-by: Andreas Stieger Signed-off-by: Petr Písař --- whois.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/whois.c b/whois.c index 8f5f1f1..7259c7f 100644 --- a/whois.c +++ b/whois.c @@ -1172,6 +1172,12 @@ char *normalize_domain(const char *dom) int prefix_len; #ifdef HAVE_LIBIDN2 + /* skip CIDR notation */ + if (NULL != strchr(domain_start, '/')) + return ret; + /* skip IPv6 */ + if (NULL != strchr(domain_start, ':')) + return ret; if (idn2_lookup_ul(domain_start, &q, IDN2_NONTRANSITIONAL) != IDN2_OK) return ret; #else @@ -1193,6 +1199,12 @@ char *normalize_domain(const char *dom) char *q; #ifdef HAVE_LIBIDN2 + /* skip CIDR notation */ + if (NULL != strchr(ret, '/')) + return ret; + /* skip IPv6 */ + if (NULL != strchr(ret, ':')) + return ret; if (idn2_lookup_ul(ret, &q, IDN2_NONTRANSITIONAL) != IDN2_OK) return ret; #else -- 2.7.4