[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnunet] 03/05: correctly convert to IDNA when transitioning to DNS
From: |
gnunet |
Subject: |
[gnunet] 03/05: correctly convert to IDNA when transitioning to DNS |
Date: |
Sat, 30 Nov 2019 15:33:09 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit 61efbfb56dde7db7ede7478817d5dbb0ae1f95c1
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Sat Nov 30 12:34:17 2019 +0100
correctly convert to IDNA when transitioning to DNS
---
src/gns/Makefile.am | 1 +
src/gns/gnunet-service-gns_resolver.c | 27 +++++++++++++++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am
index bb319ce6e..764590589 100644
--- a/src/gns/Makefile.am
+++ b/src/gns/Makefile.am
@@ -237,6 +237,7 @@ gnunet_service_gns_LDADD = \
$(top_builddir)/src/dns/libgnunetdns.la \
$(top_builddir)/src/dht/libgnunetdht.la \
$(top_builddir)/src/namecache/libgnunetnamecache.la \
+ $(LIBIDN) $(LIBIDN2) \
$(USE_VPN) \
$(GN_LIBINTL)
diff --git a/src/gns/gnunet-service-gns_resolver.c
b/src/gns/gnunet-service-gns_resolver.c
index fda2e69e0..bb319633a 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -25,6 +25,19 @@
* @author Christian Grothoff
*/
#include "platform.h"
+#if HAVE_LIBIDN2
+#if HAVE_IDN2_H
+#include <idn2.h>
+#elif HAVE_IDN2_IDN2_H
+#include <idn2/idn2.h>
+#endif
+#elif HAVE_LIBIDN
+#if HAVE_IDNA_H
+#include <idna.h>
+#elif HAVE_IDN_IDNA_H
+#include <idn/idna.h>
+#endif
+#endif
#include "gnunet_util_lib.h"
#include "gnunet_dnsstub_lib.h"
#include "gnunet_dht_service.h"
@@ -1824,6 +1837,20 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle
*rh,
(0 != rh->name_resolution_pos) ? "." : "",
ns);
GNUNET_free (ns);
+#ifndef LSD001
+ /* the GNS name is UTF-8 and may include multibyte chars.
+ * We have to convert the combined name to a DNS-compatible IDNA.
+ */
+ char *tmp = ac->label;
+ if (IDNA_SUCCESS != idna_to_ascii_8z (tmp, &ac->label,
IDNA_ALLOW_UNASSIGNED))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+ _("Name `%s' cannot be converted to IDNA."), tmp);
+ return GNUNET_SYSERR;
+ }
+ GNUNET_free (tmp);
+#endif
+
GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
rh->ac_tail,
ac);
--
To stop receiving notification emails like this one, please contact
address@hidden.