-fixing zkey resolution
authorChristian Grothoff <christian@grothoff.org>
Tue, 5 Nov 2013 20:52:02 +0000 (20:52 +0000)
committerChristian Grothoff <christian@grothoff.org>
Tue, 5 Nov 2013 20:52:02 +0000 (20:52 +0000)
src/gns/gnunet-service-gns_resolver.c
src/gns/test_gns_zkey_lookup.sh

index 6ff4857f650c6a93af4d976a5953c864a0b13072..c881b6b83cbee2ba9c930d41e65913d305b7d3b1 100644 (file)
@@ -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
   {
index dbf4f1f1264a3d8f04430d0d2c6a74fe63ec67a1..79f5908a2905300c5bf5cbafaee145541cb16422 100755 (executable)
@@ -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