mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
4496. [func] dig: add +idnout to control whether labels are
display in punycode or not. Requires idn support to be enabled at compile time. [RT #43398]
This commit is contained in:
4
CHANGES
4
CHANGES
@@ -1,3 +1,7 @@
|
||||
4496. [func] dig: add +idnout to control whether labels are
|
||||
display in punycode or not. Requires idn support
|
||||
to be enabled at compile time. [RT #43398]
|
||||
|
||||
4495. [bug] A isc_mutex_init call was it being checked. [RT #43391]
|
||||
|
||||
4494. [bug] Look for <editline/readline.h>. [RT #43429]
|
||||
|
@@ -189,6 +189,7 @@ help(void) {
|
||||
" +[no]fail (Don't try next server on SERVFAIL)\n"
|
||||
" +[no]header-only (Send query without a question section)\n"
|
||||
" +[no]identify (ID responders in short answers)\n"
|
||||
" +[no]idnout (convert IDN response)\n"
|
||||
" +[no]ignore (Don't revert to TCP for TC responses.)\n"
|
||||
" +[no]keepopen (Keep the TCP socket open between queries)\n"
|
||||
" +[no]mapped (Allow mapped IPv4 over IPv6)\n"
|
||||
@@ -1057,8 +1058,22 @@ plus_option(const char *option, isc_boolean_t is_batchfile,
|
||||
case 'i':
|
||||
switch (cmd[1]) {
|
||||
case 'd': /* identify */
|
||||
FULLCHECK("identify");
|
||||
lookup->identify = state;
|
||||
switch (cmd[2]) {
|
||||
case 'e':
|
||||
FULLCHECK("identify");
|
||||
lookup->identify = state;
|
||||
break;
|
||||
case 'n':
|
||||
FULLCHECK("idnout");
|
||||
#ifndef WITH_IDN
|
||||
fprintf(stderr, ";; IDN support not enabled\n");
|
||||
#else
|
||||
lookup->idnout = state;
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
goto invalid_option;
|
||||
}
|
||||
break;
|
||||
case 'g': /* ignore */
|
||||
default: /*
|
||||
|
@@ -758,6 +758,17 @@
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>+[no]idnout</option></term>
|
||||
<listitem>
|
||||
<para>
|
||||
Convert [do not convert] puny code on output.
|
||||
This requires IDN SUPPORT to have been enabled at
|
||||
compile time. The default is to convert output.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term><option>+[no]ignore</option></term>
|
||||
<listitem>
|
||||
|
@@ -789,6 +789,11 @@ make_empty_lookup(void) {
|
||||
looknew->ttlunits = ISC_FALSE;
|
||||
looknew->ttlunits = ISC_FALSE;
|
||||
looknew->qr = ISC_FALSE;
|
||||
#ifdef WITH_IDN
|
||||
looknew->idnout = ISC_TRUE;
|
||||
#else
|
||||
looknew->idnout = ISC_FALSE;
|
||||
#endif
|
||||
#ifdef DIG_SIGCHASE
|
||||
looknew->sigchase = ISC_FALSE;
|
||||
#if DIG_SIGCHASE_TD
|
||||
@@ -902,6 +907,7 @@ clone_lookup(dig_lookup_t *lookold, isc_boolean_t servers) {
|
||||
looknew->nocrypto = lookold->nocrypto;
|
||||
looknew->ttlunits = lookold->ttlunits;
|
||||
looknew->qr = lookold->qr;
|
||||
looknew->idnout = lookold->idnout;
|
||||
#ifdef DIG_SIGCHASE
|
||||
looknew->sigchase = lookold->sigchase;
|
||||
#if DIG_SIGCHASE_TD
|
||||
@@ -2246,7 +2252,8 @@ setup_lookup(dig_lookup_t *lookup) {
|
||||
#endif
|
||||
|
||||
#ifdef WITH_IDN
|
||||
result = dns_name_settotextfilter(output_filter);
|
||||
result = dns_name_settotextfilter(lookup->idnout ?
|
||||
output_filter : NULL);
|
||||
check_result(result, "dns_name_settotextfilter");
|
||||
#endif
|
||||
|
||||
|
@@ -137,6 +137,7 @@ struct dig_lookup {
|
||||
use_usec,
|
||||
nocrypto,
|
||||
ttlunits,
|
||||
idnout,
|
||||
qr;
|
||||
#ifdef DIG_SIGCHASE
|
||||
isc_boolean_t sigchase;
|
||||
|
@@ -8,14 +8,40 @@ srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
|
||||
VERSION=@BIND9_VERSION@
|
||||
|
||||
@BIND9_MAKE_INCLUDES@
|
||||
|
||||
SUBDIRS = builtin dlzexternal dyndb filter-aaaa geoip lwresd pipelined \
|
||||
resolver rndc rpz rsabigexponent statistics tkey tsiggss
|
||||
TARGETS =
|
||||
SUBDIRS = builtin dlzexternal dyndb filter-aaaa geoip lwresd \
|
||||
pipelined resolver rndc rpz rsabigexponent statistics tkey \
|
||||
tsiggss
|
||||
|
||||
CINCLUDES = ${ISC_INCLUDES}
|
||||
|
||||
CDEFINES = @USE_GSSAPI@
|
||||
CWARNINGS =
|
||||
|
||||
DNSLIBS =
|
||||
ISCLIBS = .
|
||||
|
||||
DNSDEPLIBS =
|
||||
ISCDEPLIBS =
|
||||
|
||||
DEPLIBS =
|
||||
|
||||
LIBS = @LIBS@
|
||||
|
||||
OBJS = feature-test.@O@
|
||||
SRCS = feature-test.c
|
||||
|
||||
TARGETS = feature-test@EXEEXT@
|
||||
|
||||
@BIND9_MAKE_RULES@
|
||||
|
||||
feature-test@EXEEXT@: feature-test.@O@
|
||||
${LIBTOOL_MODE_LINK} ${PURIFY} ${CC} ${CFLAGS} ${LDFLAGS} -o $@ feature-test.@O@ ${LIBS}
|
||||
|
||||
|
||||
# Running the scripts below is bypassed when a separate
|
||||
# build directory is used.
|
||||
|
||||
@@ -28,6 +54,8 @@ testclean clean distclean::
|
||||
if test -f ./cleanall.sh; then sh ./cleanall.sh; fi
|
||||
rm -f systests.output
|
||||
rm -f random.data
|
||||
rm -f ${TARGETS}
|
||||
rm -f ${OBJS}
|
||||
|
||||
distclean::
|
||||
rm -f conf.sh
|
||||
|
@@ -54,6 +54,7 @@ DNSTAPREAD=$TOP/bin/tools/dnstap-read
|
||||
MDIG=$TOP/bin/tools/mdig
|
||||
NZD2NZF=$TOP/bin/tools/named-nzd2nzf
|
||||
FSTRM_CAPTURE=@FSTRM_CAPTURE@
|
||||
FEATURETEST=$TOP/bin/tests/system/feature-test
|
||||
|
||||
RANDFILE=$TOP/bin/tests/system/random.data
|
||||
|
||||
@@ -138,9 +139,45 @@ NZD=@NZD_TOOLS@
|
||||
|
||||
. ${TOP}/version
|
||||
|
||||
export NAMED LWRESD DIG NSUPDATE KEYGEN KEYFRLAB SIGNER KEYSIGNER KEYSETTOOL \
|
||||
PERL SUBDIRS RNDC CHECKZONE PK11GEN PK11LIST PK11DEL TESTSOCK6 \
|
||||
JOURNALPRINT ARPANAME RESOLVE RRCHECKER NSLOOKUP DESCRIPTION PYTHON \
|
||||
MDIG FSTRM_CAPTURE NZD2NZF \
|
||||
RANDFILE BIGKEY DLOPEN EDNSVERSION FILTERAAAA GENCHECK GETHOSTNAME \
|
||||
KEYCREATE KEYDELETE LWTEST MAKEJOURNAL PIPEQUERIES RPZ XMLSTATS
|
||||
export ARPANAME
|
||||
export BIGKEY
|
||||
export CHECKZONE
|
||||
export DESCRIPTION
|
||||
export DIG
|
||||
export DLOPEN
|
||||
export EDNSVERSION
|
||||
export FEATURETEST
|
||||
export FILTERAAAA
|
||||
export FSTRM_CAPTURE
|
||||
export GENCHECK
|
||||
export GETHOSTNAME
|
||||
export JOURNALPRINT
|
||||
export KEYCREATE
|
||||
export KEYDELETE
|
||||
export KEYFRLAB
|
||||
export KEYGEN
|
||||
export KEYSETTOOL
|
||||
export KEYSIGNER
|
||||
export LWRESD
|
||||
export LWTEST
|
||||
export MAKEJOURNAL
|
||||
export MDIG
|
||||
export NAMED
|
||||
export NSLOOKUP
|
||||
export NSUPDATE
|
||||
export NZD2NZF
|
||||
export PERL
|
||||
export PIPEQUERIES
|
||||
export PK11DEL
|
||||
export PK11GEN
|
||||
export PK11LIST
|
||||
export PYTHON
|
||||
export RANDFILE
|
||||
export RESOLVE
|
||||
export RNDC
|
||||
export RPZ
|
||||
export RRCHECKER
|
||||
export SIGNER
|
||||
export SUBDIRS
|
||||
export TESTSOCK6
|
||||
export XMLSTATS
|
||||
|
@@ -26,6 +26,8 @@ b AAAA fd92:7065:b8e:ffff::2
|
||||
c A 10.0.0.3
|
||||
c AAAA fd92:7065:b8e:ffff::3
|
||||
|
||||
xn--caf-dma A 10.1.2.3
|
||||
|
||||
foo TXT "testing"
|
||||
foo A 10.0.1.0
|
||||
foo SSHFP 2 1 123456789abcdef67890123456789abcdef67890
|
||||
|
@@ -384,6 +384,23 @@ if [ -x ${DIG} ] ; then
|
||||
if [ $ret != 0 ]; then echo "I:failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
|
||||
n=`expr $n + 1`
|
||||
if $FEATURETEST --with-idn
|
||||
then
|
||||
echo "I:checking dig +idnout ($n)"
|
||||
ret=0
|
||||
$DIG $DIGOPTS @10.53.0.3 +noidnout xn--caf-dma.example. > dig.out.1.test$n 2>&1 || ret=1
|
||||
$DIG $DIGOPTS @10.53.0.3 +idnout xn--caf-dma.example. > dig.out.2.test$n 2>&1 || ret=1
|
||||
grep "^xn--caf-dma.example" dig.out.1.test$n > /dev/null || ret=1
|
||||
grep "^xn--caf-dma.example" dig.out.2.test$n > /dev/null && ret=1
|
||||
grep 10.1.2.3 dig.out.1.test$n > /dev/null || ret=1
|
||||
grep 10.1.2.3 dig.out.2.test$n > /dev/null || ret=1
|
||||
if [ $ret != 0 ]; then echo "I:failed"; fi
|
||||
status=`expr $status + $ret`
|
||||
else
|
||||
echo "I:skipping 'dig +idnout' as IDN support is not enabled ($n)"
|
||||
fi
|
||||
|
||||
else
|
||||
echo "$DIG is needed, so skipping these dig tests"
|
||||
fi
|
||||
|
139
bin/tests/system/feature-test.c
Normal file
139
bin/tests/system/feature-test.c
Normal file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <isc/print.h>
|
||||
#include <isc/util.h>
|
||||
|
||||
#ifndef MAXHOSTNAMELEN
|
||||
#ifdef HOST_NAME_MAX
|
||||
#define MAXHOSTNAMELEN HOST_NAME_MAX
|
||||
#else
|
||||
#define MAXHOSTNAMELEN 256
|
||||
#endif
|
||||
#endif
|
||||
|
||||
static void
|
||||
usage() {
|
||||
fprintf(stderr, "usage: feature-test <arg>\n");
|
||||
fprintf(stderr, "args:\n");
|
||||
fprintf(stderr, " --allow-filter-aaaa\n");
|
||||
fprintf(stderr, " --edns-version\n");
|
||||
fprintf(stderr, " --gethostname\n");
|
||||
fprintf(stderr, " --gssapi\n");
|
||||
fprintf(stderr, " --have-dlopen\n");
|
||||
fprintf(stderr, " --have-geoip\n");
|
||||
fprintf(stderr, " --have-libxml2\n");
|
||||
fprintf(stderr, " --rpz-nsip\n");
|
||||
fprintf(stderr, " --rpz-nsdname\n");
|
||||
fprintf(stderr, " --with-idn\n");
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv) {
|
||||
|
||||
if (argc != 2) {
|
||||
usage();
|
||||
return (1);
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "--allow-filter-aaaa") == 0) {
|
||||
#ifdef ALLOW_FILTER_AAAA
|
||||
return (0);
|
||||
#else
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "--edns-version") == 0) {
|
||||
#ifdef DNS_EDNS_VERSION
|
||||
printf("%d\n", DNS_EDNS_VERSION);
|
||||
#else
|
||||
printf("0\n");
|
||||
#endif
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "--gethostname") == 0) {
|
||||
char hostname[MAXHOSTNAMELEN];
|
||||
int n;
|
||||
n = gethostname(hostname, sizeof(hostname));
|
||||
if (n == -1) {
|
||||
perror("gethostname");
|
||||
return(1);
|
||||
}
|
||||
fprintf(stdout, "%s\n", hostname);
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "--gssapi") == 0) {
|
||||
#if defined(GSSAPI)
|
||||
return (0);
|
||||
#else
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "--have-dlopen") == 0) {
|
||||
#if defined(HAVE_DLOPEN) && defined(ISC_DLZ_DLOPEN)
|
||||
return (0);
|
||||
#else
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "--have-geoip") == 0) {
|
||||
#ifdef HAVE_GEOIP
|
||||
return (0);
|
||||
#else
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "--have-libxml2") == 0) {
|
||||
#ifdef HAVE_LIBXML2
|
||||
return (0);
|
||||
#else
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "--rpz-nsip") == 0) {
|
||||
#ifdef ENABLE_RPZ_NSIP
|
||||
return (0);
|
||||
#else
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "--rpz-nsdname") == 0) {
|
||||
#ifdef ENABLE_RPZ_NSDNAME
|
||||
return (0);
|
||||
#else
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (strcmp(argv[1], "--with-idn") == 0) {
|
||||
#ifdef WITH_IDN
|
||||
return (0);
|
||||
#else
|
||||
return (1);
|
||||
#endif
|
||||
}
|
||||
|
||||
fprintf(stderr, "unknown arg: %s\n", argv[1]);
|
||||
usage();
|
||||
return (1);
|
||||
}
|
@@ -2375,7 +2375,8 @@ dns_name_settotextfilter(dns_name_totextfilter_t proc) {
|
||||
return (ISC_R_SUCCESS);
|
||||
}
|
||||
if (proc == NULL) {
|
||||
isc_mem_put(thread_key_mctx, mem, sizeof(*mem));
|
||||
if (mem != NULL)
|
||||
isc_mem_put(thread_key_mctx, mem, sizeof(*mem));
|
||||
res = isc_thread_key_setspecific(totext_filter_proc_key, NULL);
|
||||
if (res != 0)
|
||||
result = ISC_R_UNEXPECTED;
|
||||
|
Reference in New Issue
Block a user