From f416ed5cff91ff66dadfb4797562ec5c5a0adc21 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 5 Nov 2013 20:52:02 +0000 Subject: [PATCH] -fixing zkey resolution --- src/gns/gnunet-service-gns_resolver.c | 17 ++++------------- src/gns/test_gns_zkey_lookup.sh | 4 ++-- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 6ff4857f6..c881b6b83 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c @@ -1999,9 +1999,7 @@ static void start_resolver_lookup (struct GNS_ResolverHandle *rh) { struct AuthorityChain *ac; - char *x; char *y; - char *pkey; if ( ( (GNUNET_YES == is_canonical (rh->name)) && (0 != strcmp (GNUNET_GNS_TLD, rh->name)) ) || @@ -2038,26 +2036,19 @@ start_resolver_lookup (struct GNS_ResolverHandle *rh) /* Name ends with ".zkey", try to replace authority zone with zkey authority */ GNUNET_free (resolver_lookup_get_next_label (rh)); /* will return "zkey" */ - x = resolver_lookup_get_next_label (rh); /* will return 'x' coordinate */ y = resolver_lookup_get_next_label (rh); /* will return 'y' coordinate */ - GNUNET_asprintf (&pkey, - "%s%s", - x, y); - if ( (NULL == x) || - (NULL == y) || + if ( (NULL == y) || (GNUNET_OK != - GNUNET_CRYPTO_ecdsa_public_key_from_string (pkey, - strlen (pkey), - &rh->authority_zone)) ) + GNUNET_CRYPTO_ecdsa_public_key_from_string (y, + strlen (y), + &rh->authority_zone)) ) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, _("Hostname `%s' is not well-formed, resolution fails\n"), rh->name); rh->task_id = GNUNET_SCHEDULER_add_now (&fail_resolution, rh); } - GNUNET_free_non_null (x); GNUNET_free_non_null (y); - GNUNET_free (pkey); } else { diff --git a/src/gns/test_gns_zkey_lookup.sh b/src/gns/test_gns_zkey_lookup.sh index dbf4f1f12..79f5908a2 100755 --- a/src/gns/test_gns_zkey_lookup.sh +++ b/src/gns/test_gns_zkey_lookup.sh @@ -10,7 +10,7 @@ DELEGATED_PKEY=$(gnunet-identity -d -c test_gns_lookup.conf | grep delegatedego gnunet-identity -C testego -c test_gns_lookup.conf gnunet-namestore -p -z testego -a -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf gnunet-namestore -p -z delegatedego -a -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf -RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.$DELEGATED_PKEY'.zkey' -t A -c test_gns_lookup.conf` +RES_IP=`$DO_TIMEOUT gnunet-gns --raw -z testego -u www.${DELEGATED_PKEY}.zkey -t A -c test_gns_lookup.conf` gnunet-namestore -z testego -d -n b -t PKEY -V $DELEGATED_PKEY -e never -c test_gns_lookup.conf gnunet-namestore -z delegatedego -d -n www -t A -V $TEST_IP -e never -c test_gns_lookup.conf gnunet-arm -e -c test_gns_lookup.conf @@ -19,6 +19,6 @@ if [ "$RES_IP" == "$TEST_IP" ] then exit 0 else - echo "Failed to resolve to proper IP, got $RES_IP." + echo "Failed to resolve to proper IP, got $RES_IP, wanted $TEST_IP." exit 1 fi -- 2.25.1