Use libidn2 instead of libidn

This commit is contained in:
Petr Písař 2017-04-26 11:57:36 +02:00
parent 231243bbf0
commit 86deedd495
2 changed files with 61 additions and 4 deletions

View File

@ -0,0 +1,50 @@
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] 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 <astieger@suse.com>
Signed-off-by: Petr Písař <ppisar@redhat.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
--
2.7.4

View File

@ -1,12 +1,11 @@
# Add IDN support
%{bcond_without whois_enables_idn}
# Use libidn2 instead of libidn1,
# libidn2 support is broken <https://github.com/rfc1036/whois/issues/50>
%{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
# <https://github.com/rfc1036/whois/pull/51>, 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,
# <https://github.com/rfc1036/whois/issues/50>,
# <https://github.com/rfc1036/whois/pull/53>
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 <https://github.com/rfc1036/whois/issues/50>
@ -99,6 +103,9 @@ fi
%{_mandir}/man5/%{cfgfile}.5.gz
%changelog
* Wed Apr 26 2017 Petr Pisar <ppisar@redhat.com> - 5.2.15-2
- Use libidn2 instead of libidn
* Mon Feb 27 2017 Petr Pisar <ppisar@redhat.com> - 5.2.15-1
- 5.2.15 bump