From 2f152dc3bd8c71adbc74e26e762c89345c8eb3db Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Fri, 23 Mar 2012 18:15:43 +0000 Subject: [PATCH] -fix, will failon werrorr --- src/gns/Makefile.am | 1 + src/gns/gnunet-service-gns_resolver.c | 27 ++++++++++++++++++++++++--- src/gns/proxy/proxy.py | 2 +- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/gns/Makefile.am b/src/gns/Makefile.am index 2b62cec53..2d47353ba 100644 --- a/src/gns/Makefile.am +++ b/src/gns/Makefile.am @@ -207,6 +207,7 @@ gnunet_service_gns_LDADD = \ $(top_builddir)/src/dns/libgnunetdnsparser.la \ $(top_builddir)/src/dht/libgnunetdht.la \ $(top_builddir)/src/namestore/libgnunetnamestore.la \ + -lunistring \ $(GN_LIBINTL) gnunet_service_gns_DEPENDENCIES = \ $(top_builddir)/src/tun/libgnunettun.la \ diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 407dc54df..acf876993 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c @@ -26,6 +26,7 @@ * @author Martin Schanzenbach */ #include "platform.h" +#include #include "gnunet_util_lib.h" #include "gnunet_transport_service.h" #include "gnunet_dns_service.h" @@ -1910,6 +1911,9 @@ gns_resolver_lookup_record(struct GNUNET_CRYPTO_ShortHashCode zone, struct ResolverHandle *rh; struct RecordLookupHandle* rlh; char string_hash[MAX_DNS_LABEL_LENGTH]; + char* normalized_zkey; + char nzkey[MAX_DNS_LABEL_LENGTH]; + size_t normal_len; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting resolution for %s (type=%d)!\n", @@ -1977,8 +1981,15 @@ gns_resolver_lookup_record(struct GNUNET_CRYPTO_ShortHashCode zone, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ZKEY is %s!\n", string_hash); + + normalized_zkey = u8_toupper ((uint8_t*)string_hash, strlen ((char *) string_hash), + NULL, UNINORM_NFD, NULL, &normal_len); - if (GNUNET_OK != GNUNET_CRYPTO_short_hash_from_string(string_hash, + memcpy(nzkey, normalized_zkey, normal_len); + nzkey[normal_len] = '\0'; + free(normalized_zkey); + + if (GNUNET_OK != GNUNET_CRYPTO_short_hash_from_string(nzkey, &rh->authority)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -2275,6 +2286,9 @@ gns_resolver_shorten_name(struct GNUNET_CRYPTO_ShortHashCode zone, struct NameShortenHandle *nsh; char string_hash[MAX_DNS_LABEL_LENGTH]; struct GNUNET_CRYPTO_ShortHashCode zkey; + char* normalized_zkey; + size_t normal_len; + char nzkey[MAX_DNS_LABEL_LENGTH]; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -2318,11 +2332,18 @@ gns_resolver_shorten_name(struct GNUNET_CRYPTO_ShortHashCode zone, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "ZKEY is %s!\n", string_hash); - if (GNUNET_OK != GNUNET_CRYPTO_short_hash_from_string(string_hash, + normalized_zkey = u8_toupper ((uint8_t*)string_hash, strlen ((char *) string_hash), + NULL, UNINORM_NFD, NULL, &normal_len); + + memcpy(nzkey, normalized_zkey, normal_len); + nzkey[normal_len] = '\0'; + free(normalized_zkey); + + if (GNUNET_OK != GNUNET_CRYPTO_short_hash_from_string(nzkey, &zkey)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, - "Cannot convert ZKEY %s to hash!\n", string_hash); + "Cannot convert ZKEY %s to hash!\n", nzkey); GNUNET_free(rh); GNUNET_free(nsh); proc(proc_cls, name); diff --git a/src/gns/proxy/proxy.py b/src/gns/proxy/proxy.py index 9191c1b4e..e2c0a5baf 100644 --- a/src/gns/proxy/proxy.py +++ b/src/gns/proxy/proxy.py @@ -135,7 +135,7 @@ class ProxyHandler (BaseHTTPServer.BaseHTTPRequestHandler): out = soc data = i.recv(8192) if data: - if (re.match("(\w+\.)*gnunet", self.host_port[0])): + if (re.match("(\w+\.)*gnunet", self.host_port[0]) or 1): arr = self.host_port[0].split('.') arr.pop(0) data = re.sub('(a href="http://(\w+\.)*)(\+)', -- 2.25.1