1 /* Common code for AI_IDN/NI_IDN tests.
2 Copyright (C) 2018-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 /* Before including this file, TEST_USE_UTF8 must be defined to 1 or
20 0, depending on whether a UTF-8 locale is used or a Latin-1
26 #include <support/check.h>
27 #include <support/check_nss.h>
28 #include <support/resolv_test.h>
29 #include <support/support.h>
31 /* Name of the shared object for libidn2. */
32 #define LIBIDN2_SONAME "libidn2.so.0"
35 /* UTF-8 encoding of "nämchen" (German for “namelet”). */
36 # define NAEMCHEN "n\xC3\xA4mchen"
38 /* UTF-8 encoding of "שם" (Hebrew for “name”). */
39 # define SHEM "\xD7\xA9\xD7\x9D"
41 /* UTF-8 encoding of "buße" (German for “penance”). This used to be
42 encoded as "busse" (“busses”) in IDNA2003. */
43 # define BUSSE "bu\xC3\x9F""e"
46 /* Latin-1 encodings, as far as they are available. */
48 # define NAEMCHEN "n\xE4mchen"
49 # define BUSSE "bu\xDF""e"
53 /* IDNA encoding of NAEMCHEN. */
54 #define NAEMCHEN_IDNA "xn--nmchen-bua"
56 /* IDNA encoding of NAEMCHEN "_zwo". */
57 #define NAEMCHEN_ZWO_IDNA "xn--nmchen_zwo-q5a"
59 /* IDNA encoding of SHEM. */
60 #define SHEM_IDNA "xn--iebx"
62 /* IDNA encoding of BUSSE. */
63 #define BUSSE_IDNA "xn--bue-6ka"
65 /* IDNA encoding of "שם1". */
66 #define SHEM1_IDNA "xn--1-qic9a"
68 /* Another IDNA name. */
69 #define ANDERES_NAEMCHEN "anderes-" NAEMCHEN
70 #define ANDERES_NAEMCHEN_IDNA "xn--anderes-nmchen-eib"
72 /* Controls the kind of test data in a PTR lookup response. */
76 gni_non_idn_cname_to_non_idn_name
,
77 gni_non_idn_cname_to_idn_name
,
81 gni_idn_cname_to_non_idn_name
,
82 gni_idn_cname_to_idn_name
,
87 /* Called from response below. The LSB (first byte) controls what
88 goes into the response, see enum gni_test. */
90 response_ptr (const struct resolv_response_context
*ctx
,
91 struct resolv_response_builder
*b
, const char *qname
)
94 TEST_COMPARE (sscanf (qname
, "%d.%d.%d.%d.in-addr.arpa",
95 &comp
[0], &comp
[1], &comp
[2], &comp
[3]), 4);
96 const char *next_name
;
97 switch ((enum gni_test
) comp
[0])
99 /* First name in response is non-IDN name. */
100 case gni_non_idn_name
:
101 resolv_response_open_record (b
, qname
, C_IN
, T_PTR
, 0);
102 resolv_response_add_name (b
, "non-idn.example");
103 resolv_response_close_record (b
);
105 case gni_non_idn_cname_to_non_idn_name
:
106 resolv_response_open_record (b
, qname
, C_IN
, T_CNAME
, 0);
107 next_name
= "non-idn-cname.example";
108 resolv_response_add_name (b
, next_name
);
109 resolv_response_close_record (b
);
110 resolv_response_open_record (b
, next_name
, C_IN
, T_PTR
, 0);
111 resolv_response_add_name (b
, "non-idn-name.example");
112 resolv_response_close_record (b
);
114 case gni_non_idn_cname_to_idn_name
:
115 resolv_response_open_record (b
, qname
, C_IN
, T_CNAME
, 0);
116 next_name
= "non-idn-cname.example";
117 resolv_response_add_name (b
, next_name
);
118 resolv_response_close_record (b
);
119 resolv_response_open_record (b
, next_name
, C_IN
, T_PTR
, 0);
120 resolv_response_add_name (b
, NAEMCHEN_IDNA
".example");
121 resolv_response_close_record (b
);
124 /* First name in response is IDN name. */
126 resolv_response_open_record (b
, qname
, C_IN
, T_PTR
, 0);
127 resolv_response_add_name (b
, "xn--nmchen-bua.example");
128 resolv_response_close_record (b
);
131 resolv_response_open_record (b
, qname
, C_IN
, T_PTR
, 0);
132 resolv_response_add_name (b
, SHEM_IDNA
".example");
133 resolv_response_close_record (b
);
136 resolv_response_open_record (b
, qname
, C_IN
, T_PTR
, 0);
137 resolv_response_add_name (b
, SHEM1_IDNA
".example");
138 resolv_response_close_record (b
);
140 case gni_idn_cname_to_non_idn_name
:
141 resolv_response_open_record (b
, qname
, C_IN
, T_CNAME
, 0);
142 next_name
= NAEMCHEN_IDNA
".example";
143 resolv_response_add_name (b
, next_name
);
144 resolv_response_close_record (b
);
145 resolv_response_open_record (b
, next_name
, C_IN
, T_PTR
, 0);
146 resolv_response_add_name (b
, "non-idn-name.example");
147 resolv_response_close_record (b
);
149 case gni_idn_cname_to_idn_name
:
150 resolv_response_open_record (b
, qname
, C_IN
, T_CNAME
, 0);
151 next_name
= NAEMCHEN_IDNA
".example";
152 resolv_response_add_name (b
, next_name
);
153 resolv_response_close_record (b
);
154 resolv_response_open_record (b
, next_name
, C_IN
, T_PTR
, 0);
155 resolv_response_add_name (b
, ANDERES_NAEMCHEN_IDNA
".example");
156 resolv_response_close_record (b
);
159 /* Invalid IDN encodings. */
160 case gni_invalid_idn_1
:
161 resolv_response_open_record (b
, qname
, C_IN
, T_PTR
, 0);
162 resolv_response_add_name (b
, "xn---.example");
163 resolv_response_close_record (b
);
165 case gni_invalid_idn_2
:
166 resolv_response_open_record (b
, qname
, C_IN
, T_PTR
, 0);
167 resolv_response_add_name (b
, "xn--x.example");
168 resolv_response_close_record (b
);
171 FAIL_EXIT1 ("invalid PTR query: %s", qname
);
174 /* For PTR responses, see above. A/AAAA queries can request
175 additional CNAMEs in the response by include ".cname." and
176 ".idn-cname." in the query. The LSB in the address contains the
177 first byte of the QNAME. */
179 response (const struct resolv_response_context
*ctx
,
180 struct resolv_response_builder
*b
,
181 const char *qname
, uint16_t qclass
, uint16_t qtype
)
183 TEST_VERIFY_EXIT (qclass
== C_IN
);
185 for (const char *p
= qname
; *p
!= '\0'; ++p
)
186 if (!(('0' <= *p
&& *p
<= '9')
187 || ('a' <= *p
&& *p
<= 'z')
188 || ('A' <= *p
&& *p
<= 'Z')
189 || *p
== '.' || *p
== '-' || *p
== '_'))
191 /* Non-ASCII query. Reply with NXDOMAIN. */
192 struct resolv_response_flags flags
= { .rcode
= 3 };
193 resolv_response_init (b
, flags
);
194 resolv_response_add_question (b
, qname
, qclass
, qtype
);
198 struct resolv_response_flags flags
= { 0 };
199 resolv_response_init (b
, flags
);
200 resolv_response_add_question (b
, qname
, qclass
, qtype
);
201 resolv_response_section (b
, ns_s_an
);
205 response_ptr (ctx
, b
, qname
);
209 bool with_cname
= strstr (qname
, ".cname.") != NULL
;
210 bool with_idn_cname
= strstr (qname
, ".idn-cname.") != NULL
;
212 const char *next_name
= qname
;
215 next_name
= "non-idn-cname.example";
216 resolv_response_open_record (b
, qname
, C_IN
, T_CNAME
, 0);
217 resolv_response_add_name (b
, next_name
);
218 resolv_response_close_record (b
);
222 const char *previous_name
= next_name
;
223 next_name
= ANDERES_NAEMCHEN_IDNA
".example";
224 resolv_response_open_record (b
, previous_name
, C_IN
, T_CNAME
, 0);
225 resolv_response_add_name (b
, next_name
);
226 resolv_response_close_record (b
);
229 resolv_response_open_record (b
, next_name
, C_IN
, qtype
, 0);
234 char addr
[4] = { 192, 0, 2, qname
[0] };
235 resolv_response_add_data (b
, &addr
, sizeof (addr
));
241 = { 0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
243 resolv_response_add_data (b
, &addr
, sizeof (addr
));
247 FAIL_EXIT1 ("invalid qtype: %d", qtype
);
249 resolv_response_close_record (b
);
252 /* Check the result of a getaddrinfo call. */
254 check_ai (const char *name
, int ai_flags
, const char *expected
)
256 struct addrinfo hints
=
258 .ai_flags
= ai_flags
,
259 .ai_family
= AF_INET
,
260 .ai_socktype
= SOCK_STREAM
,
263 char *query
= xasprintf ("%s:80 AF_INET/0x%x", name
, ai_flags
);
264 int ret
= getaddrinfo (name
, "80", &hints
, &ai
);
265 check_addrinfo (query
, ai
, ret
, expected
);
271 /* Run one getnameinfo test. FLAGS is automatically augmented with
274 gni_test (enum gni_test code
, unsigned int flags
, const char *expected
)
276 struct sockaddr_in sin
=
278 .sin_family
= AF_INET
,
279 .sin_port
= htons (80),
280 .sin_addr
= { htonl (0xc0000200 | code
) }, /* 192.0.2.0/24 network. */
284 int ret
= getnameinfo ((const struct sockaddr
*) &sin
, sizeof (sin
),
285 host
, sizeof (host
), service
, sizeof (service
),
286 flags
| NI_NUMERICSERV
);
289 if (expected
== NULL
)
290 TEST_COMPARE (ret
, EAI_IDN_ENCODE
);
293 support_record_failure ();
294 printf ("error: getnameinfo failed (code %d, flags 0x%x): %s (%d)\n",
295 (int) code
, flags
, gai_strerror (ret
), ret
);
298 else if (ret
== 0 && expected
== NULL
)
300 support_record_failure ();
301 printf ("error: getnameinfo unexpected success (code %d, flags 0x%x)\n",
304 else if (strcmp (host
, expected
) != 0 || strcmp (service
, "80") != 0)
306 support_record_failure ();
307 printf ("error: getnameinfo test failure (code %d, flags 0x%x)\n"
308 " expected host: \"%s\"\n"
309 " expected service: \"80\"\n"
310 " actual host: \"%s\"\n"
311 " actual service: \"%s\"\n",
312 (int) code
, flags
, expected
, host
, service
);
316 /* Tests for getaddrinfo which assume a working libidn2 library. */
317 __attribute__ ((unused
))
319 gai_tests_with_libidn2 (void)
322 check_ai ("non-idn.example", 0,
323 "address: STREAM/TCP 192.0.2.110 80\n");
324 check_ai ("non-idn.example", AI_IDN
,
326 "address: STREAM/TCP 192.0.2.110 80\n");
327 check_ai ("non-idn.example", AI_IDN
| AI_CANONNAME
| AI_CANONIDN
,
328 "flags: AI_CANONNAME AI_IDN AI_CANONIDN\n"
329 "canonname: non-idn.example\n"
330 "address: STREAM/TCP 192.0.2.110 80\n");
332 check_ai (NAEMCHEN
".example", 0,
333 "error: Name or service not known\n");
334 check_ai (NAEMCHEN
".example", AI_IDN
,
336 "address: STREAM/TCP 192.0.2.120 80\n");
337 check_ai (NAEMCHEN
".example", AI_IDN
| AI_CANONNAME
| AI_CANONIDN
,
338 "flags: AI_CANONNAME AI_IDN AI_CANONIDN\n"
339 "canonname: " NAEMCHEN
".example\n"
340 "address: STREAM/TCP 192.0.2.120 80\n");
343 check_ai (SHEM
".example", 0,
344 "error: Name or service not known\n");
345 check_ai (SHEM
".example", AI_IDN
,
347 "address: STREAM/TCP 192.0.2.120 80\n");
348 check_ai (SHEM
".example", AI_IDN
| AI_CANONNAME
| AI_CANONIDN
,
349 "flags: AI_CANONNAME AI_IDN AI_CANONIDN\n"
350 "canonname: " SHEM
".example\n"
351 "address: STREAM/TCP 192.0.2.120 80\n");
352 check_ai (SHEM
".example", AI_IDN
| AI_CANONNAME
,
353 "flags: AI_CANONNAME AI_IDN\n"
354 "canonname: " SHEM_IDNA
".example\n"
355 "address: STREAM/TCP 192.0.2.120 80\n");
356 check_ai (SHEM
"1.example", AI_IDN
,
358 "address: STREAM/TCP 192.0.2.120 80\n");
359 check_ai (SHEM
"1.example", AI_IDN
| AI_CANONNAME
| AI_CANONIDN
,
360 "flags: AI_CANONNAME AI_IDN AI_CANONIDN\n"
361 "canonname: " SHEM
"1.example\n"
362 "address: STREAM/TCP 192.0.2.120 80\n");
363 check_ai (SHEM
"1.example", AI_IDN
| AI_CANONNAME
,
364 "flags: AI_CANONNAME AI_IDN\n"
365 "canonname: " SHEM1_IDNA
".example\n"
366 "address: STREAM/TCP 192.0.2.120 80\n");
369 /* Check that non-transitional mode is active. German sharp S
370 should not turn into SS. */
371 check_ai (BUSSE
".example", 0,
372 "error: Name or service not known\n");
373 check_ai (BUSSE
".example", AI_IDN
,
375 "address: STREAM/TCP 192.0.2.120 80\n");
376 check_ai (BUSSE
".example", AI_IDN
| AI_CANONNAME
,
377 "flags: AI_CANONNAME AI_IDN\n"
378 "canonname: " BUSSE_IDNA
".example\n"
379 "address: STREAM/TCP 192.0.2.120 80\n");
380 check_ai (BUSSE
".example", AI_IDN
| AI_CANONNAME
| AI_CANONIDN
,
381 "flags: AI_CANONNAME AI_IDN AI_CANONIDN\n"
382 "canonname: " BUSSE
".example\n"
383 "address: STREAM/TCP 192.0.2.120 80\n");
385 /* Check that Unicode TR 46 mode is active. Underscores should be
386 permitted in IDNA components. */
387 check_ai (NAEMCHEN
"_zwo.example", 0,
388 "error: Name or service not known\n");
389 check_ai (NAEMCHEN
"_zwo.example", AI_IDN
,
391 "address: STREAM/TCP 192.0.2.120 80\n");
392 check_ai (NAEMCHEN
"_zwo.example", AI_IDN
| AI_CANONNAME
,
393 "flags: AI_CANONNAME AI_IDN\n"
394 "canonname: " NAEMCHEN_ZWO_IDNA
".example\n"
395 "address: STREAM/TCP 192.0.2.120 80\n");
396 check_ai (NAEMCHEN
"_zwo.example", AI_IDN
| AI_CANONNAME
| AI_CANONIDN
,
397 "flags: AI_CANONNAME AI_IDN AI_CANONIDN\n"
398 "canonname: " NAEMCHEN
"_zwo.example\n"
399 "address: STREAM/TCP 192.0.2.120 80\n");
401 /* No CNAME, but already IDN-encoded. */
402 check_ai (NAEMCHEN_IDNA
".example", 0,
403 "address: STREAM/TCP 192.0.2.120 80\n");
404 check_ai (NAEMCHEN_IDNA
".example", AI_IDN
,
406 "address: STREAM/TCP 192.0.2.120 80\n");
407 check_ai (NAEMCHEN_IDNA
".example", AI_IDN
| AI_CANONNAME
,
408 "flags: AI_CANONNAME AI_IDN\n"
409 "canonname: " NAEMCHEN_IDNA
".example\n"
410 "address: STREAM/TCP 192.0.2.120 80\n");
411 check_ai (NAEMCHEN_IDNA
".example", AI_IDN
| AI_CANONNAME
| AI_CANONIDN
,
412 "flags: AI_CANONNAME AI_IDN AI_CANONIDN\n"
413 "canonname: " NAEMCHEN
".example\n"
414 "address: STREAM/TCP 192.0.2.120 80\n");
415 check_ai (SHEM_IDNA
".example", 0,
416 "address: STREAM/TCP 192.0.2.120 80\n");
417 check_ai (SHEM_IDNA
".example", AI_IDN
,
419 "address: STREAM/TCP 192.0.2.120 80\n");
420 check_ai (SHEM_IDNA
".example", AI_IDN
| AI_CANONNAME
,
421 "flags: AI_CANONNAME AI_IDN\n"
422 "canonname: " SHEM_IDNA
".example\n"
423 "address: STREAM/TCP 192.0.2.120 80\n");
425 check_ai (SHEM_IDNA
".example", AI_IDN
| AI_CANONNAME
| AI_CANONIDN
,
426 "flags: AI_CANONNAME AI_IDN AI_CANONIDN\n"
427 "canonname: " SHEM
".example\n"
428 "address: STREAM/TCP 192.0.2.120 80\n");
430 check_ai (SHEM_IDNA
".example", AI_IDN
| AI_CANONNAME
| AI_CANONIDN
,
431 "flags: AI_CANONNAME AI_IDN AI_CANONIDN\n"
432 "canonname: " SHEM_IDNA
".example\n"
433 "address: STREAM/TCP 192.0.2.120 80\n");
436 /* Invalid IDNA canonical name is returned as-is. */
437 check_ai ("xn---.example", AI_CANONNAME
| AI_CANONIDN
,
438 "flags: AI_CANONNAME AI_CANONIDN\n"
439 "canonname: xn---.example\n"
440 "address: STREAM/TCP 192.0.2.120 80\n");
443 check_ai ("with.cname.example", 0,
444 "address: STREAM/TCP 192.0.2.119 80\n");
445 check_ai ("with.cname.example", AI_IDN
,
447 "address: STREAM/TCP 192.0.2.119 80\n");
448 check_ai ("with.cname.example", AI_IDN
| AI_CANONNAME
| AI_CANONIDN
,
449 "flags: AI_CANONNAME AI_IDN AI_CANONIDN\n"
450 "canonname: non-idn-cname.example\n"
451 "address: STREAM/TCP 192.0.2.119 80\n");
453 check_ai ("with.cname." NAEMCHEN
".example", 0,
454 "error: Name or service not known\n");
455 check_ai ("with.cname." NAEMCHEN
".example", AI_IDN
,
457 "address: STREAM/TCP 192.0.2.119 80\n");
458 check_ai ("with.cname." NAEMCHEN
".example", AI_IDN
| AI_CANONNAME
,
459 "flags: AI_CANONNAME AI_IDN\n"
460 "canonname: non-idn-cname.example\n"
461 "address: STREAM/TCP 192.0.2.119 80\n");
462 check_ai ("with.cname." NAEMCHEN
".example",
463 AI_IDN
| AI_CANONNAME
| AI_CANONIDN
,
464 "flags: AI_CANONNAME AI_IDN AI_CANONIDN\n"
465 "canonname: non-idn-cname.example\n"
466 "address: STREAM/TCP 192.0.2.119 80\n");
469 check_ai ("With.idn-cname.example", 0,
470 "address: STREAM/TCP 192.0.2.87 80\n");
471 check_ai ("With.idn-cname.example", AI_IDN
,
473 "address: STREAM/TCP 192.0.2.87 80\n");
474 check_ai ("With.idn-cname.example", AI_IDN
| AI_CANONNAME
,
475 "flags: AI_CANONNAME AI_IDN\n"
476 "canonname: " ANDERES_NAEMCHEN_IDNA
".example\n"
477 "address: STREAM/TCP 192.0.2.87 80\n");
478 check_ai ("With.idn-cname.example",
479 AI_IDN
| AI_CANONNAME
| AI_CANONIDN
,
480 "flags: AI_CANONNAME AI_IDN AI_CANONIDN\n"
481 "canonname: " ANDERES_NAEMCHEN
".example\n"
482 "address: STREAM/TCP 192.0.2.87 80\n");
484 check_ai ("With.idn-cname." NAEMCHEN
".example", 0,
485 "error: Name or service not known\n");
486 check_ai ("With.idn-cname." NAEMCHEN
".example", AI_IDN
,
488 "address: STREAM/TCP 192.0.2.119 80\n");
489 check_ai ("With.idn-cname." NAEMCHEN
".example", AI_IDN
| AI_CANONNAME
,
490 "flags: AI_CANONNAME AI_IDN\n"
491 "canonname: " ANDERES_NAEMCHEN_IDNA
".example\n"
492 "address: STREAM/TCP 192.0.2.119 80\n");
493 check_ai ("With.idn-cname." NAEMCHEN
".example",
494 AI_IDN
| AI_CANONNAME
| AI_CANONIDN
,
495 "flags: AI_CANONNAME AI_IDN AI_CANONIDN\n"
496 "canonname: " ANDERES_NAEMCHEN
".example\n"
497 "address: STREAM/TCP 192.0.2.119 80\n");
499 /* Non-IDN to IDN CNAME chain. */
500 check_ai ("both.cname.idn-cname.example", 0,
501 "address: STREAM/TCP 192.0.2.98 80\n");
502 check_ai ("both.cname.idn-cname.example", AI_IDN
,
504 "address: STREAM/TCP 192.0.2.98 80\n");
505 check_ai ("both.cname.idn-cname.example", AI_IDN
| AI_CANONNAME
,
506 "flags: AI_CANONNAME AI_IDN\n"
507 "canonname: " ANDERES_NAEMCHEN_IDNA
".example\n"
508 "address: STREAM/TCP 192.0.2.98 80\n");
509 check_ai ("both.cname.idn-cname.example",
510 AI_IDN
| AI_CANONNAME
| AI_CANONIDN
,
511 "flags: AI_CANONNAME AI_IDN AI_CANONIDN\n"
512 "canonname: " ANDERES_NAEMCHEN
".example\n"
513 "address: STREAM/TCP 192.0.2.98 80\n");
515 check_ai ("both.cname.idn-cname." NAEMCHEN
".example", 0,
516 "error: Name or service not known\n");
517 check_ai ("both.cname.idn-cname." NAEMCHEN
".example", AI_IDN
,
519 "address: STREAM/TCP 192.0.2.98 80\n");
520 check_ai ("both.cname.idn-cname." NAEMCHEN
".example",
521 AI_IDN
| AI_CANONNAME
,
522 "flags: AI_CANONNAME AI_IDN\n"
523 "canonname: " ANDERES_NAEMCHEN_IDNA
".example\n"
524 "address: STREAM/TCP 192.0.2.98 80\n");
525 check_ai ("both.cname.idn-cname." NAEMCHEN
".example",
526 AI_IDN
| AI_CANONNAME
| AI_CANONIDN
,
527 "flags: AI_CANONNAME AI_IDN AI_CANONIDN\n"
528 "canonname: " ANDERES_NAEMCHEN
".example\n"
529 "address: STREAM/TCP 192.0.2.98 80\n");
532 /* Tests for getnameinfo which assume a working libidn2 library. */
533 __attribute__ ((unused
))
535 gni_tests_with_libidn2 (void)
537 gni_test (gni_non_idn_name
, 0, "non-idn.example");
538 gni_test (gni_non_idn_name
, NI_IDN
, "non-idn.example");
539 gni_test (gni_non_idn_name
, NI_NUMERICHOST
, "192.0.2.0");
540 gni_test (gni_non_idn_name
, NI_NUMERICHOST
| NI_IDN
, "192.0.2.0");
542 gni_test (gni_non_idn_cname_to_non_idn_name
, 0, "non-idn-name.example");
543 gni_test (gni_non_idn_cname_to_non_idn_name
, NI_IDN
, "non-idn-name.example");
545 gni_test (gni_non_idn_cname_to_idn_name
, 0, NAEMCHEN_IDNA
".example");
546 gni_test (gni_non_idn_cname_to_idn_name
, NI_IDN
, NAEMCHEN
".example");
548 gni_test (gni_idn_name
, 0, NAEMCHEN_IDNA
".example");
549 gni_test (gni_idn_name
, NI_IDN
, NAEMCHEN
".example");
550 gni_test (gni_idn_shem
, 0, SHEM_IDNA
".example");
551 gni_test (gni_idn_shem1
, 0, SHEM1_IDNA
".example");
553 gni_test (gni_idn_shem
, NI_IDN
, SHEM
".example");
554 gni_test (gni_idn_shem1
, NI_IDN
, SHEM
"1.example");
556 gni_test (gni_idn_shem
, NI_IDN
, SHEM_IDNA
".example");
557 gni_test (gni_idn_shem1
, NI_IDN
, SHEM1_IDNA
".example");
560 gni_test (gni_idn_cname_to_non_idn_name
, 0, "non-idn-name.example");
561 gni_test (gni_idn_cname_to_non_idn_name
, NI_IDN
, "non-idn-name.example");
563 gni_test (gni_idn_cname_to_idn_name
, 0, ANDERES_NAEMCHEN_IDNA
".example");
564 gni_test (gni_idn_cname_to_idn_name
, NI_IDN
, ANDERES_NAEMCHEN
".example");
566 /* Test encoding errors. */
567 gni_test (gni_invalid_idn_1
, 0, "xn---.example");
568 gni_test (gni_invalid_idn_1
, NI_IDN
, "xn---.example");
569 gni_test (gni_invalid_idn_2
, 0, "xn--x.example");
570 gni_test (gni_invalid_idn_2
, NI_IDN
, "xn--x.example");