]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/test/test-dns-domain.c
resolved: make sure idn2 conversions are roundtrippable
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 21 Jul 2017 11:51:07 +0000 (07:51 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 21 Jul 2017 12:00:23 +0000 (08:00 -0400)
commit0926f3489dbc93a2e91ec8607a0ceb5d4d8a53e3
tree218a128617036b873d1a9f70416bca88825cefd9
parent8ae12e733c5369a7e6360eaa5c942ea05fe44bde
resolved: make sure idn2 conversions are roundtrippable

While working on the gateway→_gateway conversion, I noticed that
libidn2 strips the leading underscore in some names.
https://gitlab.com/libidn/libidn2/issues/30 was resolved in
https://gitlab.com/libidn/libidn2/commit/05d753ea69e2308cd02436d0511f4b844071dc79,
which disabled "STD3 ASCII rules" by default, i.e. disabled stripping
of underscores. So the situation is that with previously released libidn2
versions we would get incorrect behaviour, and once new libidn2 is released,
we should be OK.

Let's implement a simple test which checks that the name survives the
roundtrip, and if it doesn't, skip IDN resolution. Under old libidn2 this will
fail in more cases, and under new libidn2 in fewer, but should be the right
thing to do also under new libidn2.
src/shared/dns-domain.c
src/test/test-dns-domain.c