aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-service-gns_resolver.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-11-30 12:34:17 +0100
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-11-30 12:34:17 +0100
commit61efbfb56dde7db7ede7478817d5dbb0ae1f95c1 (patch)
tree08e02aec853d38233fff0867cf2743624eac5005 /src/gns/gnunet-service-gns_resolver.c
parent6495b7d3b6f83aa8c00dbdfde05c8609c22eb92b (diff)
downloadgnunet-61efbfb56dde7db7ede7478817d5dbb0ae1f95c1.tar.gz
gnunet-61efbfb56dde7db7ede7478817d5dbb0ae1f95c1.zip
correctly convert to IDNA when transitioning to DNS
Diffstat (limited to 'src/gns/gnunet-service-gns_resolver.c')
-rw-r--r--src/gns/gnunet-service-gns_resolver.c27
1 files changed, 27 insertions, 0 deletions
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 @@
25 * @author Christian Grothoff 25 * @author Christian Grothoff
26 */ 26 */
27#include "platform.h" 27#include "platform.h"
28#if HAVE_LIBIDN2
29#if HAVE_IDN2_H
30#include <idn2.h>
31#elif HAVE_IDN2_IDN2_H
32#include <idn2/idn2.h>
33#endif
34#elif HAVE_LIBIDN
35#if HAVE_IDNA_H
36#include <idna.h>
37#elif HAVE_IDN_IDNA_H
38#include <idn/idna.h>
39#endif
40#endif
28#include "gnunet_util_lib.h" 41#include "gnunet_util_lib.h"
29#include "gnunet_dnsstub_lib.h" 42#include "gnunet_dnsstub_lib.h"
30#include "gnunet_dht_service.h" 43#include "gnunet_dht_service.h"
@@ -1824,6 +1837,20 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh,
1824 (0 != rh->name_resolution_pos) ? "." : "", 1837 (0 != rh->name_resolution_pos) ? "." : "",
1825 ns); 1838 ns);
1826 GNUNET_free (ns); 1839 GNUNET_free (ns);
1840#ifndef LSD001
1841 /* the GNS name is UTF-8 and may include multibyte chars.
1842 * We have to convert the combined name to a DNS-compatible IDNA.
1843 */
1844 char *tmp = ac->label;
1845 if (IDNA_SUCCESS != idna_to_ascii_8z (tmp, &ac->label, IDNA_ALLOW_UNASSIGNED))
1846 {
1847 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1848 _("Name `%s' cannot be converted to IDNA."), tmp);
1849 return GNUNET_SYSERR;
1850 }
1851 GNUNET_free (tmp);
1852#endif
1853
1827 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, 1854 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
1828 rh->ac_tail, 1855 rh->ac_tail,
1829 ac); 1856 ac);