1 |
From ec50eff97c259b5bfbfa4e050d69fe7b39b0f15a Mon Sep 17 00:00:00 2001 |
2 |
From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= <pemensik@redhat.com> |
3 |
Date: Tue, 25 Sep 2018 18:08:46 +0200 |
4 |
Subject: [PATCH] Disable IDN from environment as documented |
5 |
|
6 |
Manual page of host contained instructions to disable IDN processing |
7 |
when it was built with libidn2. When refactoring IDN support however, |
8 |
support for disabling IDN in host and nslookup was lost. Use also |
9 |
environment variable and document it for nslookup, host and dig. |
10 |
|
11 |
Support variable CHARSET=ASCII to disable IDN, supported in downstream |
12 |
RH patch since RHEL 5. |
13 |
--- |
14 |
bin/dig/dig.docbook | 4 +++- |
15 |
bin/dig/dighost.c | 5 +++++ |
16 |
bin/dig/host.docbook | 2 +- |
17 |
bin/dig/nslookup.docbook | 15 +++++++++++++++ |
18 |
4 files changed, 24 insertions(+), 2 deletions(-) |
19 |
|
20 |
diff --git a/bin/dig/dig.docbook b/bin/dig/dig.docbook |
21 |
index 5d19301..933af79 100644 |
22 |
--- a/bin/dig/dig.docbook |
23 |
+++ b/bin/dig/dig.docbook |
24 |
@@ -1312,7 +1312,9 @@ dig +qr www.isc.org any -x 127.0.0.1 isc.org ns +noqr |
25 |
reply from the server. |
26 |
If you'd like to turn off the IDN support for some reason, use |
27 |
parameters <parameter>+noidnin</parameter> and |
28 |
- <parameter>+noidnout</parameter>. |
29 |
+ <parameter>+noidnout</parameter> or define |
30 |
+ the <envar>IDN_DISABLE</envar> environment variable. |
31 |
+ |
32 |
</para> |
33 |
</refsection> |
34 |
|
35 |
diff --git a/bin/dig/dighost.c b/bin/dig/dighost.c |
36 |
index 5eabc1f..73aaab8 100644 |
37 |
--- a/bin/dig/dighost.c |
38 |
+++ b/bin/dig/dighost.c |
39 |
@@ -826,6 +826,11 @@ make_empty_lookup(void) { |
40 |
looknew->badcookie = true; |
41 |
#ifdef WITH_IDN_SUPPORT |
42 |
looknew->idnin = isatty(1)?(getenv("IDN_DISABLE") == NULL):false; |
43 |
+ if (looknew->idnin) { |
44 |
+ const char *charset = getenv("CHARSET"); |
45 |
+ if (charset && !strcmp(charset, "ASCII")) |
46 |
+ looknew->idnin = false; |
47 |
+ } |
48 |
#else |
49 |
looknew->idnin = false; |
50 |
#endif |
51 |
diff --git a/bin/dig/host.docbook b/bin/dig/host.docbook |
52 |
index da0f8fb..9689b5a 100644 |
53 |
--- a/bin/dig/host.docbook |
54 |
+++ b/bin/dig/host.docbook |
55 |
@@ -379,7 +379,7 @@ |
56 |
<command>host</command> appropriately converts character encoding of |
57 |
domain name before sending a request to DNS server or displaying a |
58 |
reply from the server. |
59 |
- If you'd like to turn off the IDN support for some reason, defines |
60 |
+ If you'd like to turn off the IDN support for some reason, define |
61 |
the <envar>IDN_DISABLE</envar> environment variable. |
62 |
The IDN support is disabled if the variable is set when |
63 |
<command>host</command> runs. |
64 |
diff --git a/bin/dig/nslookup.docbook b/bin/dig/nslookup.docbook |
65 |
index d46fc2d..6d7d181 100644 |
66 |
--- a/bin/dig/nslookup.docbook |
67 |
+++ b/bin/dig/nslookup.docbook |
68 |
@@ -495,6 +495,21 @@ nslookup -query=hinfo -timeout=10 |
69 |
</para> |
70 |
</refsection> |
71 |
|
72 |
+ <refsection><info><title>IDN SUPPORT</title></info> |
73 |
+ |
74 |
+ <para> |
75 |
+ If <command>nslookup</command> has been built with IDN (internationalized |
76 |
+ domain name) support, it can accept and display non-ASCII domain names. |
77 |
+ <command>nslookup</command> appropriately converts character encoding of |
78 |
+ domain name before sending a request to DNS server or displaying a |
79 |
+ reply from the server. |
80 |
+ If you'd like to turn off the IDN support for some reason, define |
81 |
+ the <envar>IDN_DISABLE</envar> environment variable. |
82 |
+ The IDN support is disabled if the variable is set when |
83 |
+ <command>nslookup</command> runs. |
84 |
+ </para> |
85 |
+ </refsection> |
86 |
+ |
87 |
<refsection><info><title>FILES</title></info> |
88 |
|
89 |
<para><filename>/etc/resolv.conf</filename> |
90 |
-- |
91 |
2.20.1 |
92 |
|