From 5dcc67a0fff89e7ebf051f64b6b987862c331a04 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Mon, 26 Feb 2007 00:27:09 +0000 Subject: [PATCH] 2141. [bug] dig/host should not be setting IDN_ASCCHECK (IDN equivalent of LDH checks). [RT #16609] --- CHANGES | 3 +++ bin/dig/dighost.c | 5 +++-- bin/dig/host.c | 27 ++++++++++++++++++++++++++- bin/dig/include/dig/dig.h | 5 ++++- 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 2cb620ebc3..60d21bd3b3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +2141. [bug] dig/host should not be setting IDN_ASCCHECK (IDN + equivalent of LDH checks). [RT #16609] + 2140. [bug] libbind: missing unlock on pthread_key_create() failures. [RT #16654] diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c index ee3a0a6ed2..b2139495cf 100644 --- a/bin/dig/dighost.c +++ b/bin/dig/dighost.c @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dighost.c,v 1.299 2007/02/14 23:45:44 marka Exp $ */ +/* $Id: dighost.c,v 1.300 2007/02/26 00:27:09 marka Exp $ */ /*! \file * \note @@ -144,6 +144,7 @@ static idn_result_t append_textname(char *name, const char *origin, static void idn_check_result(idn_result_t r, const char *msg); #define MAXDLEN 256 +int idnoptions = 0; #endif /*% @@ -1816,7 +1817,7 @@ setup_lookup(dig_lookup_t *lookup) { sizeof(utf8_textname)); idn_check_result(mr, "append origin to textname"); } - mr = idn_encodename(IDN_LOCALMAP | IDN_NAMEPREP | IDN_ASCCHECK | + mr = idn_encodename(idnoptions | IDN_LOCALMAP | IDN_NAMEPREP | IDN_IDNCONV | IDN_LENCHECK, utf8_textname, idn_textname, sizeof(idn_textname)); idn_check_result(mr, "convert UTF-8 textname to IDN encoding"); diff --git a/bin/dig/host.c b/bin/dig/host.c index ce92eb5ca2..2059eba4b7 100644 --- a/bin/dig/host.c +++ b/bin/dig/host.c @@ -15,13 +15,25 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: host.c,v 1.110 2006/05/23 04:38:28 marka Exp $ */ +/* $Id: host.c,v 1.111 2007/02/26 00:27:09 marka Exp $ */ /*! \file */ #include +#include #include +#ifdef HAVE_LOCALE_H +#include +#endif + +#ifdef WITH_IDN +#include +#include +#include +#include +#endif + #include #include #include @@ -664,6 +676,9 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { lookup->rdtype != dns_rdatatype_axfr) lookup->rdtype = rdtype; lookup->rdtypeset = ISC_TRUE; +#ifdef WITH_IDN + idnoptions = 0; +#endif if (rdtype == dns_rdatatype_axfr) { /* -l -t any -v */ list_type = dns_rdatatype_any; @@ -672,6 +687,13 @@ parse_args(isc_boolean_t is_batchfile, int argc, char **argv) { } else if (rdtype == dns_rdatatype_ixfr) { lookup->ixfr_serial = serial; list_type = rdtype; +#ifdef WITH_IDN + } else if (rdtype == dns_rdatatype_a || + rdtype == dns_rdatatype_aaaa || + rdtype == dns_rdatatype_mx) { + idnoptions = IDN_ASCCHECK; + list_type = rdtype; +#endif } else list_type = rdtype; list_addresses = ISC_FALSE; @@ -814,6 +836,9 @@ main(int argc, char **argv) { ISC_LIST_INIT(search_list); fatalexit = 1; +#ifdef WITH_IDN + idnoptions = IDN_ASCCHECK; +#endif debug("main()"); progname = argv[0]; diff --git a/bin/dig/include/dig/dig.h b/bin/dig/include/dig/dig.h index af2a1dac1c..ac14aece54 100644 --- a/bin/dig/include/dig/dig.h +++ b/bin/dig/include/dig/dig.h @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: dig.h,v 1.101 2006/12/07 05:52:16 marka Exp $ */ +/* $Id: dig.h,v 1.102 2007/02/26 00:27:09 marka Exp $ */ #ifndef DIG_H #define DIG_H @@ -277,6 +277,9 @@ extern isc_boolean_t debugging, memdebugging; extern char *progname; extern int tries; extern int fatalexit; +#ifdef WITH_IDN +extern int idnoptions; +#endif /* * Routines in dighost.c.