[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24384 - in gnunet: . src/dns src/include
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24384 - in gnunet: . src/dns src/include |
Date: |
Wed, 17 Oct 2012 23:00:59 +0200 |
Author: grothoff
Date: 2012-10-17 23:00:58 +0200 (Wed, 17 Oct 2012)
New Revision: 24384
Modified:
gnunet/configure.ac
gnunet/src/dns/Makefile.am
gnunet/src/dns/dnsparser.c
gnunet/src/include/gnunet_dnsparser_lib.h
gnunet/src/include/gnunet_gns_service.h
Log:
-adding libidn--towards fixing #2475
Modified: gnunet/configure.ac
===================================================================
--- gnunet/configure.ac 2012-10-17 20:17:45 UTC (rev 24383)
+++ gnunet/configure.ac 2012-10-17 21:00:58 UTC (rev 24384)
@@ -370,6 +370,32 @@
else
AM_CONDITIONAL(HAVE_LIBCURL, false)
fi
+
+
+# libidn
+AC_MSG_CHECKING([if Libidn can be used])
+AC_ARG_WITH(libidn, AC_HELP_STRING([--with-libidn=[DIR]],
+ [Support IDN (needs GNU Libidn)]),
+libidn=$withval, libidn=yes)
+if test "$libidn" != "no"; then
+ if test "$libidn" != "yes"; then
+ LDFLAGS="${LDFLAGS} -L$libidn/lib"
+ CPPFLAGS="${CPPFLAGS} -I$libidn/include"
+ fi
+ AC_CHECK_HEADER(idna.h,
+ AC_CHECK_LIB(idn, stringprep_check_version,
+ [libidn=yes LIBS="${LIBS} -lidn"], libidn=no),
+ libidn=no)
+fi
+if test "$libidn" != "no" ; then
+ AC_DEFINE(LIBIDN, 1, [Define to 1 if you want IDN support.])
+ else
+ AC_MSG_FAILURE([Libidn not found])
+fi
+AC_MSG_RESULT($libidn)
+
+
+
# restore LIBS
LIBS=$SAVE_LIBS
Modified: gnunet/src/dns/Makefile.am
===================================================================
--- gnunet/src/dns/Makefile.am 2012-10-17 20:17:45 UTC (rev 24383)
+++ gnunet/src/dns/Makefile.am 2012-10-17 21:00:58 UTC (rev 24384)
@@ -83,7 +83,8 @@
libgnunetdnsparser_la_SOURCES = \
dnsparser.c
libgnunetdnsparser_la_LIBADD = \
- $(top_builddir)/src/util/libgnunetutil.la $(XLIB)
+ $(top_builddir)/src/util/libgnunetutil.la $(XLIB) \
+ -lidn
libgnunetdnsparser_la_LDFLAGS = \
$(GN_LIB_LDFLAGS) \
-version-info 0:0:0
Modified: gnunet/src/dns/dnsparser.c
===================================================================
--- gnunet/src/dns/dnsparser.c 2012-10-17 20:17:45 UTC (rev 24383)
+++ gnunet/src/dns/dnsparser.c 2012-10-17 21:00:58 UTC (rev 24384)
@@ -25,12 +25,40 @@
* @author Christian Grothoff
*/
#include "platform.h"
+#include <idna.h>
+#if WINDOWS
+#include <idn-free.h>
+#endif
#include "gnunet_util_lib.h"
#include "gnunet_dnsparser_lib.h"
#include "dnsparser.h"
+/**
+ * Check if a label in UTF-8 format can be coded into valid IDNA.
+ * This can fail if the ASCII-conversion becomes longer than 63 characters.
+ *
+ * @param label label to check (UTF-8 string)
+ * @return GNUNET_OK if the label can be converted to IDNA,
+ * GNUNET_SYSERR if the label is not valid for DNS names
+ */
+int
+GNUNET_DNSPARSER_check_label (const char *label)
+{
+ char *output;
+
+ if (IDNA_SUCCESS !=
+ idna_to_ascii_8z (label, &output, IDNA_USE_STD3_ASCII_RULES))
+ return GNUNET_SYSERR;
+#if WINDOWS
+ idn_free (output);
+#else
+ free (output);
+#endif
+ return GNUNET_OK;
+}
+
/**
* Parse name inside of a DNS query or record.
*
Modified: gnunet/src/include/gnunet_dnsparser_lib.h
===================================================================
--- gnunet/src/include/gnunet_dnsparser_lib.h 2012-10-17 20:17:45 UTC (rev
24383)
+++ gnunet/src/include/gnunet_dnsparser_lib.h 2012-10-17 21:00:58 UTC (rev
24384)
@@ -479,6 +479,18 @@
/**
+ * Check if a label in UTF-8 format can be coded into valid IDNA.
+ * This can fail if the ASCII-conversion becomes longer than 63 characters.
+ *
+ * @param label label to check (UTF-8 string)
+ * @return GNUNET_OK if the label can be converted to IDNA,
+ * GNUNET_SYSERR if the label is not valid for DNS names
+ */
+int
+GNUNET_DNSPARSER_check_label (const char *label);
+
+
+/**
* Parse a UDP payload of a DNS packet in to a nice struct for further
* processing and manipulation.
*
Modified: gnunet/src/include/gnunet_gns_service.h
===================================================================
--- gnunet/src/include/gnunet_gns_service.h 2012-10-17 20:17:45 UTC (rev
24383)
+++ gnunet/src/include/gnunet_gns_service.h 2012-10-17 21:00:58 UTC (rev
24384)
@@ -109,6 +109,8 @@
/* struct vpn_data */
GNUNET_GNS_RECORD_VPN = GNUNET_NAMESTORE_TYPE_VPN,
+
+ /* revocation */
GNUNET_GNS_RECORD_REV = GNUNET_NAMESTORE_TYPE_REV
};
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24384 - in gnunet: . src/dns src/include,
gnunet <=