From ad32ca18a753c264bb702e2b6f19e2d7f1de1612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Men=C5=A1=C3=ADk?= Date: Thu, 30 Sep 2021 22:15:39 +0200 Subject: [PATCH] Enable locale support for IDN at startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --address=/münchen.de/ is not accepted unless LOCALEDIR is defined on build. It is not by default. If LIBIDN1 or 2 is defined, call setlocale to initialize locale required to translate domains to ascii form. Signed-off-by: Petr Menšík --- src/dnsmasq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/dnsmasq.c b/src/dnsmasq.c index 9516680..d3f2c13 100644 --- a/src/dnsmasq.c +++ b/src/dnsmasq.c @@ -17,6 +17,9 @@ /* Declare static char *compiler_opts in config.h */ #define DNSMASQ_COMPILE_OPTS +#if defined(HAVE_IDN) || defined(HAVE_LIBIDN2) || defined(LOCALEDIR) +#include +#endif #include "dnsmasq.h" struct daemon *daemon; @@ -69,8 +72,10 @@ int main (int argc, char **argv) int tftp_prefix_missing = 0; #endif -#ifdef LOCALEDIR +#if defined(HAVE_IDN) || defined(HAVE_LIBIDN2) || defined(LOCALEDIR) setlocale(LC_ALL, ""); +#endif +#ifdef LOCALEDIR bindtextdomain("dnsmasq", LOCALEDIR); textdomain("dnsmasq"); #endif