forked from pool/whois
77 lines
2.3 KiB
Diff
77 lines
2.3 KiB
Diff
|
From d6e33ff64742f48f2022980fd4889ec36662cc30 Mon Sep 17 00:00:00 2001
|
||
|
From: Andreas Stieger <astieger@suse.com>
|
||
|
Date: Tue, 4 Apr 2017 18:27:37 +0200
|
||
|
Subject: [PATCH 1/2] Fix CIDR notation and IPv6 queries with libidn2
|
||
|
|
||
|
Fixes #50
|
||
|
Fixes https://bugzilla.opensuse.org/show_bug.cgi?id=1026831
|
||
|
Signed-off-by: Andreas Stieger <astieger@suse.com>
|
||
|
---
|
||
|
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
|
||
|
|
||
|
From 1e6a7b3f0d585768f7136abda2db797c64159157 Mon Sep 17 00:00:00 2001
|
||
|
From: Andreas Stieger <astieger@suse.com>
|
||
|
Date: Tue, 23 May 2017 23:30:11 +0200
|
||
|
Subject: [PATCH 2/2] When using libidn2, also try IDNA 2008 transitional
|
||
|
|
||
|
---
|
||
|
whois.c | 6 ++++--
|
||
|
1 file changed, 4 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/whois.c b/whois.c
|
||
|
index 7259c7f..00ca962 100644
|
||
|
--- a/whois.c
|
||
|
+++ b/whois.c
|
||
|
@@ -1179,7 +1179,8 @@ char *normalize_domain(const char *dom)
|
||
|
if (NULL != strchr(domain_start, ':'))
|
||
|
return ret;
|
||
|
if (idn2_lookup_ul(domain_start, &q, IDN2_NONTRANSITIONAL) != IDN2_OK)
|
||
|
- return ret;
|
||
|
+ if (idn2_lookup_ul(domain_start, &q, IDN2_TRANSITIONAL) != IDN2_OK)
|
||
|
+ return ret;
|
||
|
#else
|
||
|
if (idna_to_ascii_lz(domain_start, &q, 0) != IDNA_SUCCESS)
|
||
|
return ret;
|
||
|
@@ -1206,7 +1207,8 @@ char *normalize_domain(const char *dom)
|
||
|
if (NULL != strchr(ret, ':'))
|
||
|
return ret;
|
||
|
if (idn2_lookup_ul(ret, &q, IDN2_NONTRANSITIONAL) != IDN2_OK)
|
||
|
- return ret;
|
||
|
+ if (idn2_lookup_ul(ret, &q, IDN2_TRANSITIONAL) != IDN2_OK)
|
||
|
+ return ret;
|
||
|
#else
|
||
|
if (idna_to_ascii_lz(ret, &q, 0) != IDNA_SUCCESS)
|
||
|
return ret;
|