Skip to content

Commit

Permalink
Fix CIDR notation and IPv6 queries with libidn2
Browse files Browse the repository at this point in the history
Fixes #50
Fixes https://bugzilla.opensuse.org/show_bug.cgi?id=1026831
Signed-off-by: Andreas Stieger <astieger@suse.com>
  • Loading branch information
Andreas Stieger committed Apr 9, 2017
1 parent ea7ba79 commit d6e33ff
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions whois.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit d6e33ff

Please sign in to comment.