summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Menšík <pemensik@redhat.com>2021-09-30 22:15:39 +0200
committerSimon Kelley <simon@thekelleys.org.uk>2021-10-06 23:23:51 +0100
commitad32ca18a753c264bb702e2b6f19e2d7f1de1612 (patch)
tree613b16042bc491dd9f15f4acc977c40407a87da1
parentefea28239689537e61e56c83de3b876900425b18 (diff)
downloaddnsmasq-ad32ca18a753c264bb702e2b6f19e2d7f1de1612.tar.gz
Enable locale support for IDN at startup
--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 <pemensik@redhat.com>
-rw-r--r--src/dnsmasq.c7
1 files changed, 6 insertions, 1 deletions
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 <locale.h>
+#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