From 86deedd49598d89e4ae18be58c8b221ed986234f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Wed, 26 Apr 2017 11:57:36 +0200 Subject: [PATCH] Use libidn2 instead of libidn --- ...tation-and-IPv6-queries-with-libidn2.patch | 50 +++++++++++++++++++ whois.spec | 15 ++++-- 2 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 whois-5.2.15-Fix-CIDR-notation-and-IPv6-queries-with-libidn2.patch diff --git a/whois-5.2.15-Fix-CIDR-notation-and-IPv6-queries-with-libidn2.patch b/whois-5.2.15-Fix-CIDR-notation-and-IPv6-queries-with-libidn2.patch new file mode 100644 index 0000000..ce87a79 --- /dev/null +++ b/whois-5.2.15-Fix-CIDR-notation-and-IPv6-queries-with-libidn2.patch @@ -0,0 +1,50 @@ +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 + diff --git a/whois.spec b/whois.spec index 5a849e4..7d037ea 100644 --- a/whois.spec +++ b/whois.spec @@ -1,12 +1,11 @@ # Add IDN support %{bcond_without whois_enables_idn} -# Use libidn2 instead of libidn1, -# libidn2 support is broken -%{bcond_with whois_enables_libidn2} +# Use libidn2 instead of libidn +%{bcond_without whois_enables_libidn2} Name: whois Version: 5.2.15 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Improved WHOIS client Group: Applications/Internet License: GPLv2+ @@ -15,6 +14,10 @@ Source0: http://ftp.debian.org/debian/pool/main/w/%{name}/%{name}_%{version}. # Fix translating 6to4 addresses to IPv4 gatway addresses # , in upstream after 5.2.15 Patch0: whois-5.2.15-Fix-misspellings-in-IPv4-formatting-string.patch +# Do not pass non-domains to libidn2, +# , +# +Patch1: whois-5.2.15-Fix-CIDR-notation-and-IPv6-queries-with-libidn2.patch BuildRequires: coreutils BuildRequires: gcc BuildRequires: gettext @@ -48,6 +51,7 @@ addresses and network names. %prep %setup -q -n %{name}-%{version} %patch0 -p1 +%patch1 -p1 %build # libidn2 support is broken @@ -99,6 +103,9 @@ fi %{_mandir}/man5/%{cfgfile}.5.gz %changelog +* Wed Apr 26 2017 Petr Pisar - 5.2.15-2 +- Use libidn2 instead of libidn + * Mon Feb 27 2017 Petr Pisar - 5.2.15-1 - 5.2.15 bump