Squash libidn patches into one

Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
Tomas Hozza 2014-05-26 15:42:49 +02:00
parent 9f33a20115
commit 4ecbfd89d6
6 changed files with 156 additions and 382 deletions

View File

@ -1,221 +0,0 @@
diff -up bind-9.5.0b1/bin/dig/dighost.c.libidn2 bind-9.5.0b1/bin/dig/dighost.c
--- bind-9.5.0b1/bin/dig/dighost.c.libidn2 2007-12-10 13:12:26.000000000 +0100
+++ bind-9.5.0b1/bin/dig/dighost.c 2007-12-10 14:21:09.000000000 +0100
@@ -153,7 +153,7 @@ int idnoptions = 0;
#endif
#ifdef WITH_LIBIDN
-static isc_result_t libidn_locale_to_utf8 (const char* from, char **to);
+static isc_result_t libidn_locale_to_utf8 (const char* from, char *to);
static isc_result_t libidn_utf8_to_ascii (const char* from, char *to);
static isc_result_t output_filter (isc_buffer_t *buffer,
unsigned int used_org,
@@ -1764,17 +1764,13 @@ setup_lookup(dig_lookup_t *lookup) {
char utf8_textname[MXNAME], utf8_origin[MXNAME], idn_textname[MXNAME];
#endif
#ifdef WITH_LIBIDN
- char *utf8_str = NULL, utf8_name[MXNAME], ascii_name[MXNAME];
+ char utf8_str[MXNAME], utf8_name[MXNAME], ascii_name[MXNAME];
#endif
-#ifdef WITH_IDN
+#if defined (WITH_IDN) || defined (WITH_LIBIDN)
result = dns_name_settotextfilter(output_filter);
check_result(result, "dns_name_settotextfilter");
#endif
-#ifdef WITH_LIBIDN
- result = dns_name_settotextfilter (output_filter);
- check_result(result, "dns_name_settotextfilter");
-#endif
REQUIRE(lookup != NULL);
INSIST(!free_now);
@@ -1812,15 +1808,13 @@ setup_lookup(dig_lookup_t *lookup) {
utf8_textname, sizeof(utf8_textname));
idn_check_result(mr, "convert textname to UTF-8");
#elif defined (WITH_LIBIDN)
- result = libidn_locale_to_utf8 (lookup->textname, &utf8_str);
- check_result (result, "converting textname to UTF-8");
+ result = libidn_locale_to_utf8 (lookup->textname, utf8_str);
+ check_result (result, "convert textname to UTF-8");
len = strlen (utf8_str);
- if (len < MXNAME) {
+ if (len < MXNAME)
(void) strcpy (utf8_name, utf8_str);
- } else {
+ else
fatal ("Too long name");
- }
- isc_mem_free (mctx, utf8_str);
#endif
/*
@@ -1833,24 +1827,11 @@ setup_lookup(dig_lookup_t *lookup) {
if (lookup->new_search) {
#ifdef WITH_IDN
if ((count_dots(utf8_textname) >= ndots) || !usesearch) {
- lookup->origin = NULL; /* Force abs lookup */
- lookup->done_as_is = ISC_TRUE;
- lookup->need_search = usesearch;
- } else if (lookup->origin == NULL && usesearch) {
- lookup->origin = ISC_LIST_HEAD(search_list);
- lookup->need_search = ISC_FALSE;
- }
#elif defined (WITH_LIBIDN)
if ((count_dots(utf8_name) >= ndots) || !usesearch) {
- lookup->origin = NULL; /* Force abs lookup */
- lookup->done_as_is = ISC_TRUE;
- lookup->need_search = usesearch;
- } else if (lookup->origin == NULL && usesearch) {
- lookup->origin = ISC_LIST_HEAD(search_list);
- lookup->need_search = ISC_FALSE;
- }
#else
if ((count_dots(lookup->textname) >= ndots) || !usesearch) {
+#endif
lookup->origin = NULL; /* Force abs lookup */
lookup->done_as_is = ISC_TRUE;
lookup->need_search = usesearch;
@@ -1858,7 +1839,6 @@ setup_lookup(dig_lookup_t *lookup) {
lookup->origin = ISC_LIST_HEAD(search_list);
lookup->need_search = ISC_FALSE;
}
-#endif
}
#ifdef WITH_IDN
@@ -1877,15 +1857,12 @@ setup_lookup(dig_lookup_t *lookup) {
idn_check_result(mr, "convert UTF-8 textname to IDN encoding");
#elif defined (WITH_LIBIDN)
if (lookup->origin != NULL) {
- result = libidn_locale_to_utf8 (lookup->origin->origin, &utf8_str);
+ result = libidn_locale_to_utf8 (lookup->origin->origin, utf8_str);
check_result (result, "convert origin to UTF-8");
- if (len + strlen (utf8_str) + 1 < MXNAME) {
- utf8_name[len++] = '.';
+ if (len + strlen (utf8_str) < MXNAME)
(void) strcpy (utf8_name + len, utf8_str);
- } else {
+ else
fatal ("Too long name + origin");
- }
- isc_mem_free (mctx, utf8_str);
}
result = libidn_utf8_to_ascii (utf8_name, ascii_name);
@@ -3600,76 +3577,85 @@ idn_check_result(idn_result_t r, const c
}
#endif /* WITH_IDN */
#ifdef WITH_LIBIDN
-/* If stringprep_locale_to_utf8 fails simple copy string */
static isc_result_t
-libidn_locale_to_utf8 (const char *from, char **to) {
+libidn_locale_to_utf8 (const char *from, char *to) {
char *utf8_str;
+ debug ("libidn_locale_to_utf8");
utf8_str = stringprep_locale_to_utf8 (from);
- if (utf8_str == NULL) {
- *to = isc_mem_allocate (mctx, strlen (from) + 1);
- if (*to == NULL)
- return (ISC_R_NOMEMORY);
- (void) strcpy (*to, from);
- } else {
- *to = isc_mem_allocate (mctx, strlen (utf8_str) + 1);
- if (*to == NULL)
- return (ISC_R_NOMEMORY);
- (void) strcpy (*to, utf8_str);
+ if (utf8_str != NULL) {
+ (void) strcpy (to, utf8_str);
free (utf8_str);
+ return ISC_R_SUCCESS;
}
- return (ISC_R_SUCCESS);
+
+ debug ("libidn_locale_to_utf8: failure");
+ return ISC_R_FAILURE;
}
static isc_result_t
libidn_utf8_to_ascii (const char *from, char *to) {
char *ascii;
+ int iresult;
- if (idna_to_ascii_8z (from, &ascii, 0) != IDNA_SUCCESS)
- return (ISC_R_FAILURE);
+ debug ("libidn_utf8_to_ascii");
+ iresult = idna_to_ascii_8z (from, &ascii, 0);
+ if (iresult != IDNA_SUCCESS) {
+ debug ("idna_to_ascii_8z: %s", idna_strerror (iresult));
+ return ISC_R_FAILURE;
+ }
(void) strcpy (to, ascii);
free (ascii);
- return (ISC_R_SUCCESS);
+ return ISC_R_SUCCESS;
}
-/* based on idnkit's code*/
+
static isc_result_t
output_filter (isc_buffer_t *buffer, unsigned int used_org,
isc_boolean_t absolute) {
+
char tmp1[MXNAME], *tmp2;
size_t fromlen, tolen;
isc_boolean_t end_with_dot;
+ int iresult;
+
+ debug ("output_filter");
- fromlen = isc_buffer_usedlength(buffer) - used_org;
+ fromlen = isc_buffer_usedlength (buffer) - used_org;
if (fromlen >= MXNAME)
- return (ISC_R_SUCCESS);
- memcpy(tmp1, (char *)isc_buffer_base(buffer) + used_org, fromlen);
+ return ISC_R_SUCCESS;
+ memcpy (tmp1, (char *) isc_buffer_base (buffer) + used_org, fromlen);
end_with_dot = (tmp1[fromlen - 1] == '.') ? ISC_TRUE : ISC_FALSE;
if (absolute && !end_with_dot) {
fromlen++;
if (fromlen >= MXNAME)
- return (ISC_R_SUCCESS);
+ return ISC_R_SUCCESS;
tmp1[fromlen - 1] = '.';
}
tmp1[fromlen] = '\0';
- if (idna_to_unicode_lzlz (tmp1, &tmp2, 0) != IDNA_SUCCESS)
- return (ISC_R_SUCCESS);
+ iresult = idna_to_unicode_8z8z (tmp1, &tmp2, 0);
+ if (iresult != IDNA_SUCCESS) {
+ debug ("output_filter: %s", idna_strerror (iresult));
+ return ISC_R_SUCCESS;
+ }
(void) strcpy (tmp1, tmp2);
free (tmp2);
- tolen = strlen(tmp1);
+ tolen = strlen (tmp1);
if (absolute && !end_with_dot && tmp1[tolen - 1] == '.')
tolen--;
- if (isc_buffer_length(buffer) < used_org + tolen)
- return (ISC_R_NOSPACE);
+ if (isc_buffer_length (buffer) < used_org + tolen)
+ return ISC_R_NOSPACE;
+
+ debug ("%s", tmp1);
- isc_buffer_subtract(buffer, isc_buffer_usedlength(buffer) - used_org);
- memcpy(isc_buffer_used(buffer), tmp1, tolen);
- isc_buffer_add(buffer, tolen);
+ isc_buffer_subtract (buffer, isc_buffer_usedlength (buffer) - used_org);
+ memcpy (isc_buffer_used (buffer), tmp1, tolen);
+ isc_buffer_add (buffer, tolen);
- return (ISC_R_SUCCESS);
+ return ISC_R_SUCCESS;
}
#endif /* WITH_LIBIDN*/

View File

@ -1,21 +0,0 @@
diff -up bind-9.5.0b1/bin/dig/dighost.c.libidn3 bind-9.5.0b1/bin/dig/dighost.c
--- bind-9.5.0b1/bin/dig/dighost.c.libidn3 2007-12-20 13:24:27.000000000 +0100
+++ bind-9.5.0b1/bin/dig/dighost.c 2007-12-20 13:27:10.000000000 +0100
@@ -1859,10 +1859,13 @@ setup_lookup(dig_lookup_t *lookup) {
if (lookup->origin != NULL) {
result = libidn_locale_to_utf8 (lookup->origin->origin, utf8_str);
check_result (result, "convert origin to UTF-8");
- if (len + strlen (utf8_str) < MXNAME)
- (void) strcpy (utf8_name + len, utf8_str);
- else
- fatal ("Too long name + origin");
+ if (len > 0 && utf8_name[len - 1] != '.') {
+ utf8_name[len++] = '.';
+ if (len + strlen (utf8_str) < MXNAME)
+ (void) strcpy (utf8_name + len, utf8_str);
+ else
+ fatal ("Too long name + origin");
+ }
}
result = libidn_utf8_to_ascii (utf8_name, ascii_name);

View File

@ -1,6 +1,60 @@
diff -up bind-9.9.5b1/bin/dig/dighost.c.libidn bind-9.9.5b1/bin/dig/dighost.c
--- bind-9.9.5b1/bin/dig/dighost.c.libidn 2013-12-12 06:59:59.000000000 +0100
+++ bind-9.9.5b1/bin/dig/dighost.c 2014-01-06 13:48:34.591300772 +0100
From 19809fe6154ea0471a2c4fa3bd66787facf7704a Mon Sep 17 00:00:00 2001
From: Tomas Hozza <thozza@redhat.com>
Date: Mon, 26 May 2014 15:25:34 +0200
Subject: [PATCH] Use libidn instead of bundled idnkit
Signed-off-by: Tomas Hozza <thozza@redhat.com>
---
bin/dig/Makefile.in | 6 +-
bin/dig/dig.docbook | 4 +-
bin/dig/dighost.c | 168 ++++++++++++++++++++++++++++++++++++++++++++++++----
3 files changed, 162 insertions(+), 16 deletions(-)
diff --git a/bin/dig/Makefile.in b/bin/dig/Makefile.in
index 5bc4db0..3864e06 100644
--- a/bin/dig/Makefile.in
+++ b/bin/dig/Makefile.in
@@ -48,10 +48,10 @@ DEPLIBS = ${DNSDEPLIBS} ${BIND9DEPLIBS} ${ISCDEPLIBS} ${ISCCFGDEPLIBS} \
${LWRESDEPLIBS}
LIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} ${ISCCFGLIBS} \
- ${ISCLIBS} @IDNLIBS@ @LIBS@
+ ${ISCLIBS} @IDNLIBS@ @LIBS@ -lidn
NOSYMLIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} ${ISCCFGLIBS} \
- ${ISCNOSYMLIBS} @IDNLIBS@ @LIBS@
+ ${ISCNOSYMLIBS} @IDNLIBS@ @LIBS@ -lidn
SUBDIRS =
@@ -69,6 +69,8 @@ HTMLPAGES = dig.html host.html nslookup.html
MANOBJS = ${MANPAGES} ${HTMLPAGES}
+EXT_CFLAGS = -DWITH_LIBIDN
+
@BIND9_MAKE_RULES@
dig@EXEEXT@: dig.@O@ dighost.@O@ ${UOBJS} ${DEPLIBS}
diff --git a/bin/dig/dig.docbook b/bin/dig/dig.docbook
index 7a01ec0..c3a7976 100644
--- a/bin/dig/dig.docbook
+++ b/bin/dig/dig.docbook
@@ -970,8 +970,8 @@ dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr
<command>dig</command> appropriately converts character encoding of
domain name before sending a request to DNS server or displaying a
reply from the server.
- If you'd like to turn off the IDN support for some reason, defines
- the <envar>IDN_DISABLE</envar> environment variable.
+ If you'd like to turn off the IDN support for some reason, define
+ the <envar>CHARSET=ASCII</envar> environment variable.
The IDN support is disabled if the variable is set when
<command>dig</command> runs.
</para>
diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c
index 56d763c..5a40051 100644
--- a/bin/dig/dighost.c
+++ b/bin/dig/dighost.c
@@ -44,6 +44,11 @@
#include <idn/api.h>
#endif
@ -13,12 +67,12 @@ diff -up bind-9.9.5b1/bin/dig/dighost.c.libidn bind-9.9.5b1/bin/dig/dighost.c
#include <dns/byaddr.h>
#ifdef DIG_SIGCHASE
#include <dns/callbacks.h>
@@ -158,6 +163,14 @@ static void idn_check_result(idn_result
@@ -158,6 +163,14 @@ static void idn_check_result(idn_result_t r, const char *msg);
int idnoptions = 0;
#endif
+#ifdef WITH_LIBIDN
+static isc_result_t libidn_locale_to_utf8 (const char* from, char **to);
+static isc_result_t libidn_locale_to_utf8 (const char* from, char *to);
+static isc_result_t libidn_utf8_to_ascii (const char* from, char *to);
+static isc_result_t output_filter (isc_buffer_t *buffer,
+ unsigned int used_org,
@ -55,81 +109,87 @@ diff -up bind-9.9.5b1/bin/dig/dighost.c.libidn bind-9.9.5b1/bin/dig/dighost.c
if (keyfile[0] != 0)
setup_file_key();
else if (keysecret[0] != 0)
@@ -2028,12 +2051,18 @@ setup_lookup(dig_lookup_t *lookup) {
@@ -2028,12 +2051,14 @@ setup_lookup(dig_lookup_t *lookup) {
idn_result_t mr;
char utf8_textname[MXNAME], utf8_origin[MXNAME], idn_textname[MXNAME];
#endif
+#ifdef WITH_LIBIDN
+ char *utf8_str = NULL, utf8_name[MXNAME], ascii_name[MXNAME];
+ char utf8_str[MXNAME], utf8_name[MXNAME], ascii_name[MXNAME];
+#endif
#ifdef WITH_IDN
-#ifdef WITH_IDN
+#if defined (WITH_IDN) || defined (WITH_LIBIDN)
result = dns_name_settotextfilter(output_filter);
check_result(result, "dns_name_settotextfilter");
#endif
-
+#ifdef WITH_LIBIDN
+ result = dns_name_settotextfilter (output_filter);
+ check_result(result, "dns_name_settotextfilter");
+#endif
REQUIRE(lookup != NULL);
INSIST(!free_now);
@@ -2070,6 +2099,16 @@ setup_lookup(dig_lookup_t *lookup) {
@@ -2070,6 +2095,14 @@ setup_lookup(dig_lookup_t *lookup) {
mr = idn_encodename(IDN_LOCALCONV | IDN_DELIMMAP, lookup->textname,
utf8_textname, sizeof(utf8_textname));
idn_check_result(mr, "convert textname to UTF-8");
+#elif defined (WITH_LIBIDN)
+ result = libidn_locale_to_utf8 (lookup->textname, &utf8_str);
+ check_result (result, "converting textname to UTF-8");
+ result = libidn_locale_to_utf8 (lookup->textname, utf8_str);
+ check_result (result, "convert textname to UTF-8");
+ len = strlen (utf8_str);
+ if (len < MXNAME) {
+ if (len < MXNAME)
+ (void) strcpy (utf8_name, utf8_str);
+ } else {
+ else
+ fatal ("Too long name");
+ }
+ isc_mem_free (mctx, utf8_str);
#endif
/*
@@ -2089,6 +2128,15 @@ setup_lookup(dig_lookup_t *lookup) {
@@ -2082,15 +2115,11 @@ setup_lookup(dig_lookup_t *lookup) {
if (lookup->new_search) {
#ifdef WITH_IDN
if ((count_dots(utf8_textname) >= ndots) || !usesearch) {
- lookup->origin = NULL; /* Force abs lookup */
- lookup->done_as_is = ISC_TRUE;
- lookup->need_search = usesearch;
- } else if (lookup->origin == NULL && usesearch) {
- lookup->origin = ISC_LIST_HEAD(search_list);
- lookup->need_search = ISC_FALSE;
- }
+#elif defined (WITH_LIBIDN)
+ if ((count_dots(utf8_name) >= ndots) || !usesearch) {
#else
if ((count_dots(lookup->textname) >= ndots) || !usesearch) {
+#endif
lookup->origin = NULL; /* Force abs lookup */
lookup->done_as_is = ISC_TRUE;
lookup->need_search = usesearch;
@@ -2098,7 +2127,6 @@ setup_lookup(dig_lookup_t *lookup) {
lookup->origin = ISC_LIST_HEAD(search_list);
lookup->need_search = ISC_FALSE;
}
+#elif defined (WITH_LIBIDN)
+ if ((count_dots(utf8_name) >= ndots) || !usesearch) {
+ lookup->origin = NULL; /* Force abs lookup */
+ lookup->done_as_is = ISC_TRUE;
+ lookup->need_search = usesearch;
+ } else if (lookup->origin == NULL && usesearch) {
+ lookup->origin = ISC_LIST_HEAD(search_list);
+ lookup->need_search = ISC_FALSE;
+ }
#else
if ((count_dots(lookup->textname) >= ndots) || !usesearch) {
lookup->origin = NULL; /* Force abs lookup */
@@ -2115,6 +2163,20 @@ setup_lookup(dig_lookup_t *lookup) {
-#endif
}
#ifdef WITH_IDN
@@ -2115,6 +2143,20 @@ setup_lookup(dig_lookup_t *lookup) {
IDN_IDNCONV | IDN_LENCHECK, utf8_textname,
idn_textname, sizeof(idn_textname));
idn_check_result(mr, "convert UTF-8 textname to IDN encoding");
+#elif defined (WITH_LIBIDN)
+ if (lookup->origin != NULL) {
+ result = libidn_locale_to_utf8 (lookup->origin->origin, &utf8_str);
+ result = libidn_locale_to_utf8 (lookup->origin->origin, utf8_str);
+ check_result (result, "convert origin to UTF-8");
+ if (len + strlen (utf8_str) + 1 < MXNAME) {
+ if (len > 0 && utf8_name[len - 1] != '.') {
+ utf8_name[len++] = '.';
+ (void) strcpy (utf8_name + len, utf8_str);
+ } else {
+ fatal ("Too long name + origin");
+ if (len + strlen (utf8_str) < MXNAME)
+ (void) strcpy (utf8_name + len, utf8_str);
+ else
+ fatal ("Too long name + origin");
+ }
+ isc_mem_free (mctx, utf8_str);
+ }
+
+ result = libidn_utf8_to_ascii (utf8_name, ascii_name);
#else
if (lookup->origin != NULL) {
debug("trying origin %s", lookup->origin->origin);
@@ -2170,6 +2232,13 @@ setup_lookup(dig_lookup_t *lookup) {
@@ -2170,6 +2212,13 @@ setup_lookup(dig_lookup_t *lookup) {
result = dns_name_fromtext(lookup->name, &b,
dns_rootname, 0,
&lookup->namebuf);
@ -143,7 +203,7 @@ diff -up bind-9.9.5b1/bin/dig/dighost.c.libidn bind-9.9.5b1/bin/dig/dighost.c
#else
len = strlen(lookup->textname);
isc_buffer_init(&b, lookup->textname, len);
@@ -3784,7 +3853,7 @@ destroy_libs(void) {
@@ -3788,7 +3837,7 @@ destroy_libs(void) {
void * ptr;
dig_message_t *chase_msg;
#endif
@ -152,7 +212,7 @@ diff -up bind-9.9.5b1/bin/dig/dighost.c.libidn bind-9.9.5b1/bin/dig/dighost.c
isc_result_t result;
#endif
@@ -3825,6 +3894,10 @@ destroy_libs(void) {
@@ -3829,6 +3878,10 @@ destroy_libs(void) {
result = dns_name_settotextfilter(NULL);
check_result(result, "dns_name_settotextfilter");
#endif
@ -163,108 +223,104 @@ diff -up bind-9.9.5b1/bin/dig/dighost.c.libidn bind-9.9.5b1/bin/dig/dighost.c
dns_name_destroy();
if (commctx != NULL) {
@@ -4003,6 +4076,79 @@ idn_check_result(idn_result_t r, const c
@@ -4008,6 +4061,97 @@ idn_check_result(idn_result_t r, const char *msg) {
}
}
#endif /* WITH_IDN */
+#ifdef WITH_LIBIDN
+/* If stringprep_locale_to_utf8 fails simple copy string */
+static isc_result_t
+libidn_locale_to_utf8 (const char *from, char **to) {
+libidn_locale_to_utf8 (const char *from, char *to) {
+ char *utf8_str;
+
+ debug ("libidn_locale_to_utf8");
+ utf8_str = stringprep_locale_to_utf8 (from);
+ if (utf8_str == NULL) {
+ *to = isc_mem_allocate (mctx, strlen (from) + 1);
+ if (*to == NULL)
+ return (ISC_R_NOMEMORY);
+ (void) strcpy (*to, from);
+ } else {
+ *to = isc_mem_allocate (mctx, strlen (utf8_str) + 1);
+ if (*to == NULL)
+ return (ISC_R_NOMEMORY);
+ (void) strcpy (*to, utf8_str);
+ if (utf8_str != NULL) {
+ (void) strcpy (to, utf8_str);
+ free (utf8_str);
+ return ISC_R_SUCCESS;
+ }
+ return (ISC_R_SUCCESS);
+
+ debug ("libidn_locale_to_utf8: failure");
+ return ISC_R_FAILURE;
+}
+static isc_result_t
+libidn_utf8_to_ascii (const char *from, char *to) {
+ char *ascii;
+ int iresult;
+
+ if (idna_to_ascii_8z (from, &ascii, 0) != IDNA_SUCCESS)
+ return (ISC_R_FAILURE);
+ debug ("libidn_utf8_to_ascii");
+ iresult = idna_to_ascii_8z (from, &ascii, 0);
+ if (iresult != IDNA_SUCCESS) {
+ debug ("idna_to_ascii_8z: %s", idna_strerror (iresult));
+ return ISC_R_FAILURE;
+ }
+
+ (void) strcpy (to, ascii);
+ free (ascii);
+ return (ISC_R_SUCCESS);
+ return ISC_R_SUCCESS;
+}
+/* based on idnkit's code*/
+
+static isc_result_t
+output_filter (isc_buffer_t *buffer, unsigned int used_org,
+ isc_boolean_t absolute) {
+
+ char tmp1[MXNAME], *tmp2;
+ size_t fromlen, tolen;
+ isc_boolean_t end_with_dot;
+ int iresult;
+
+ fromlen = isc_buffer_usedlength(buffer) - used_org;
+ debug ("output_filter");
+
+ fromlen = isc_buffer_usedlength (buffer) - used_org;
+ if (fromlen >= MXNAME)
+ return (ISC_R_SUCCESS);
+ memcpy(tmp1, (char *)isc_buffer_base(buffer) + used_org, fromlen);
+ return ISC_R_SUCCESS;
+ memcpy (tmp1, (char *) isc_buffer_base (buffer) + used_org, fromlen);
+ end_with_dot = (tmp1[fromlen - 1] == '.') ? ISC_TRUE : ISC_FALSE;
+ if (absolute && !end_with_dot) {
+ fromlen++;
+ if (fromlen >= MXNAME)
+ return (ISC_R_SUCCESS);
+ return ISC_R_SUCCESS;
+ tmp1[fromlen - 1] = '.';
+ }
+ tmp1[fromlen] = '\0';
+
+ if (idna_to_unicode_lzlz (tmp1, &tmp2, 0) != IDNA_SUCCESS)
+ return (ISC_R_SUCCESS);
+ iresult = idna_to_unicode_8z8z (tmp1, &tmp2, 0);
+ if (iresult != IDNA_SUCCESS) {
+ debug ("output_filter: %s", idna_strerror (iresult));
+ return ISC_R_SUCCESS;
+ }
+
+ (void) strcpy (tmp1, tmp2);
+ free (tmp2);
+
+ tolen = strlen(tmp1);
+ tmp2 = stringprep_utf8_to_locale (tmp1);
+ if (tmp2 == NULL) {
+ debug ("output_filter: stringprep_utf8_to_locale failed");
+ return ISC_R_SUCCESS;
+ }
+
+ (void) strcpy (tmp1, tmp2);
+ free (tmp2);
+
+ tolen = strlen (tmp1);
+ if (absolute && !end_with_dot && tmp1[tolen - 1] == '.')
+ tolen--;
+
+ if (isc_buffer_length(buffer) < used_org + tolen)
+ return (ISC_R_NOSPACE);
+ if (isc_buffer_length (buffer) < used_org + tolen)
+ return ISC_R_NOSPACE;
+
+ isc_buffer_subtract(buffer, isc_buffer_usedlength(buffer) - used_org);
+ memcpy(isc_buffer_used(buffer), tmp1, tolen);
+ isc_buffer_add(buffer, tolen);
+ debug ("%s", tmp1);
+
+ return (ISC_R_SUCCESS);
+ isc_buffer_subtract (buffer, isc_buffer_usedlength (buffer) - used_org);
+ memcpy (isc_buffer_used (buffer), tmp1, tolen);
+ isc_buffer_add (buffer, tolen);
+
+ return ISC_R_SUCCESS;
+}
+#endif /* WITH_LIBIDN*/
#ifdef DIG_SIGCHASE
void
diff -up bind-9.9.5b1/bin/dig/Makefile.in.libidn bind-9.9.5b1/bin/dig/Makefile.in
--- bind-9.9.5b1/bin/dig/Makefile.in.libidn 2013-12-12 06:59:59.000000000 +0100
+++ bind-9.9.5b1/bin/dig/Makefile.in 2014-01-06 13:31:27.764809004 +0100
@@ -48,10 +48,10 @@ DEPLIBS = ${DNSDEPLIBS} ${BIND9DEPLIBS}
${LWRESDEPLIBS}
LIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} ${ISCCFGLIBS} \
- ${ISCLIBS} @IDNLIBS@ @LIBS@
+ ${ISCLIBS} @IDNLIBS@ @LIBS@ -lidn
NOSYMLIBS = ${LWRESLIBS} ${DNSLIBS} ${BIND9LIBS} ${ISCCFGLIBS} \
- ${ISCNOSYMLIBS} @IDNLIBS@ @LIBS@
+ ${ISCNOSYMLIBS} @IDNLIBS@ @LIBS@ -lidn
SUBDIRS =
@@ -69,6 +69,8 @@ HTMLPAGES = dig.html host.html nslookup.
MANOBJS = ${MANPAGES} ${HTMLPAGES}
+EXT_CFLAGS = -DWITH_LIBIDN
+
@BIND9_MAKE_RULES@
dig@EXEEXT@: dig.@O@ dighost.@O@ ${UOBJS} ${DEPLIBS}
--
1.9.0

View File

@ -104,11 +104,8 @@ Patch17: bind-9.3.2b1-fix_sdb_ldap.patch
Patch104: bind-99-dyndb.patch
# IDN paches
Patch73: bind-9.5-libidn.patch
Patch83: bind-9.5-libidn2.patch
Patch85: bind-9.5-libidn3.patch
Patch94: bind95-rh461409.patch
Patch135:bind99-libidn4.patch
# [ISC-Bugs #36101] IDN support in host/dig/nslookup using GNU libidn(2)
Patch73: bind-99-libidn.patch
#
Requires(preun): systemd
@ -283,10 +280,7 @@ Based on the code from Jan "Yenya" Kasprzak <kas@fi.muni.cz>
%patch72 -p1 -b .64bit
%endif
%patch73 -p1 -b .libidn
%patch83 -p1 -b .libidn2
%patch85 -p1 -b .libidn3
%patch87 -p1 -b .parallel
%patch94 -p1 -b .rh461409
%patch102 -p1 -b .rh452060
%patch106 -p0 -b .rh490837
@ -342,7 +336,6 @@ cp -fp contrib/sdb/sqlite/zone2sqlite.c bin/sdb_tools
%endif
%patch133 -p1 -b .rh640538
%patch134 -p1 -b .rh669163
%patch135 -p1 -b .libidn4
# Sparc and s390 arches need to use -fPIE
%ifarch sparcv9 sparc64 s390 s390x

View File

@ -1,19 +0,0 @@
diff -up bind-9.5.1b1/bin/dig/dighost.c.rh461409 bind-9.5.1b1/bin/dig/dighost.c
--- bind-9.5.1b1/bin/dig/dighost.c.rh461409 2008-09-16 14:04:03.000000000 +0200
+++ bind-9.5.1b1/bin/dig/dighost.c 2008-09-16 14:06:06.000000000 +0200
@@ -3665,6 +3665,15 @@ output_filter (isc_buffer_t *buffer, uns
(void) strcpy (tmp1, tmp2);
free (tmp2);
+ tmp2 = stringprep_utf8_to_locale (tmp1);
+ if (tmp2 == NULL) {
+ debug ("output_filter: stringprep_utf8_to_locale failed");
+ return ISC_R_SUCCESS;
+ }
+
+ (void) strcpy (tmp1, tmp2);
+ free (tmp2);
+
tolen = strlen (tmp1);
if (absolute && !end_with_dot && tmp1[tolen - 1] == '.')
tolen--;

View File

@ -1,14 +0,0 @@
diff -up bind-9.7.0-P2/bin/dig/dig.docbook.rh811566 bind-9.7.0-P2/bin/dig/dig.docbook
--- bind-9.7.0-P2/bin/dig/dig.docbook.rh811566 2012-06-20 15:50:03.206839118 +0200
+++ bind-9.7.0-P2/bin/dig/dig.docbook 2012-06-20 15:50:28.368558830 +0200
@@ -912,8 +912,8 @@ dig +qr www.isc.org any -x 127.0.0.1 isc
<command>dig</command> appropriately converts character encoding of
domain name before sending a request to DNS server or displaying a
reply from the server.
- If you'd like to turn off the IDN support for some reason, defines
- the <envar>IDN_DISABLE</envar> environment variable.
+ If you'd like to turn off the IDN support for some reason, define
+ the <envar>CHARSET=ASCII</envar> environment variable.
The IDN support is disabled if the variable is set when
<command>dig</command> runs.
</para>