diff --git a/whois-5.2.15-fix-CIDR-with-libidn2.patch b/whois-5.2.15-fix-CIDR-with-libidn2.patch new file mode 100644 index 0000000..8d34089 --- /dev/null +++ b/whois-5.2.15-fix-CIDR-with-libidn2.patch @@ -0,0 +1,76 @@ +From d6e33ff64742f48f2022980fd4889ec36662cc30 Mon Sep 17 00:00:00 2001 +From: Andreas Stieger +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 +--- + 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 +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; diff --git a/whois.changes b/whois.changes index 6287ebe..861d470 100644 --- a/whois.changes +++ b/whois.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Tue May 23 21:45:35 UTC 2017 - astieger@suse.com + +- build with libidn2 for IDNA 2008 support FATE#321897 +- fix CIDR notation and also convert using IDNA 2008 transitional + bsc#1026831, add whois-5.2.15-fix-CIDR-with-libidn2.patch + ------------------------------------------------------------------- Mon Feb 27 10:00:11 UTC 2017 - astieger@suse.com diff --git a/whois.spec b/whois.spec index b0617ee..91c403c 100644 --- a/whois.spec +++ b/whois.spec @@ -30,8 +30,10 @@ Source2: %{name}.keyring # rename .dsc to not build the package in OBS Source3: http://ftp.debian.org/debian/pool/main/w/whois/%{name}_%{version}.dsc#/%{name}.asc Patch0: whois-nobsdsource.patch -BuildRequires: libidn-devel +Patch1: whois-5.2.15-fix-CIDR-with-libidn2.patch +BuildRequires: pkgconfig BuildRequires: xz +BuildRequires: pkgconfig(libidn2) Provides: ripe-whois-tools BuildRoot: %{_tmppath}/%{name}-%{version}-build %if 0%{?suse_version} != 1310 @@ -63,9 +65,10 @@ echo "`grep -A1 "Checksums-Sha256" %{SOURCE3} | grep %{name}_%{version}.tar.xz | %setup -q %patch0 -p1 +%patch1 -p1 %build -make all mkpasswd HAVE_LIBIDN=1 HAVE_ICONV=1 %{?_smp_mflags} \ +make all mkpasswd HAVE_LIBIDN2=1 HAVE_ICONV=1 %{?_smp_mflags} \ %if 0%{?suse_version} <= 1140 HAVE_XCRYPT=1 \ %else