From 753e93e3e206e694d778fb07297759d41320a207 Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Mon, 11 Jun 2012 16:07:12 +0000 Subject: [PATCH] -test fixed, modified shorten --- src/gns/gnunet-service-gns_resolver.c | 52 +++++++++++----------- src/gns/test_gns_dht_delegated_lookup.c | 1 + src/gns/test_gns_dht_threepeer.c | 1 + src/gns/test_gns_max_queries.c | 2 + src/gns/test_gns_pseu_shorten.c | 1 + src/gns/test_gns_simple_delegated_lookup.c | 1 + src/gns/test_gns_simple_lookup.c | 1 + src/gns/test_gns_simple_mx_lookup.c | 1 + src/gns/test_gns_simple_zkey_lookup.c | 1 + 9 files changed, 36 insertions(+), 25 deletions(-) diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 9883f7c45..15b959fc0 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c @@ -80,6 +80,31 @@ static struct GNUNET_CRYPTO_ShortHashCode local_zone; */ static unsigned long long rid = 0; + +/** + * Determine if this name is canonical. + * i.e. + * a.b.gnunet = not canonical + * a = canonical + * + * @param name the name to test + * @return 1 if canonical + */ +static int +is_canonical(char* name) +{ + uint32_t len = strlen(name); + int i; + + for (i=0; ipriv_key) + if (rh->priv_key && is_canonical (rh->name)) process_discovered_authority(name, auth->zone, rh->authority_chain_tail->zone, rh->priv_key); @@ -1535,29 +1560,6 @@ handle_record_ns(void* cls, struct ResolverHandle *rh, } -/** - * Determine if this name is canonical. - * i.e. - * a.b.gnunet = not canonical - * a = canonical - * - * @param name the name to test - * @return 1 if canonical - */ -static int -is_canonical(char* name) -{ - uint32_t len = strlen(name); - int i; - - for (i=0; ipriv_key && (name != NULL)) + if (rh->priv_key && (name != NULL) && is_canonical (rh->name)) process_discovered_authority((char*)name, auth->zone, rh->authority_chain_tail->zone, rh->priv_key); diff --git a/src/gns/test_gns_dht_delegated_lookup.c b/src/gns/test_gns_dht_delegated_lookup.c index 882bb7e5e..0ab1c1ecb 100644 --- a/src/gns/test_gns_dht_delegated_lookup.c +++ b/src/gns/test_gns_dht_delegated_lookup.c @@ -163,6 +163,7 @@ commence_testing (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) } GNUNET_GNS_lookup(gns_handle, TEST_DOMAIN, GNUNET_GNS_RECORD_TYPE_A, + GNUNET_NO, &on_lookup_result, TEST_DOMAIN); } diff --git a/src/gns/test_gns_dht_threepeer.c b/src/gns/test_gns_dht_threepeer.c index ed9600f5e..c001d54e2 100644 --- a/src/gns/test_gns_dht_threepeer.c +++ b/src/gns/test_gns_dht_threepeer.c @@ -204,6 +204,7 @@ commence_testing(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) gh = GNUNET_GNS_connect(alice_cfg); GNUNET_GNS_lookup(gh, TEST_DOMAIN, GNUNET_GNS_RECORD_TYPE_A, + GNUNET_NO, &on_lookup_result, TEST_DOMAIN); die_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, &end_badly, "from lookup"); diff --git a/src/gns/test_gns_max_queries.c b/src/gns/test_gns_max_queries.c index ad1743c67..88d43dd78 100644 --- a/src/gns/test_gns_max_queries.c +++ b/src/gns/test_gns_max_queries.c @@ -179,10 +179,12 @@ commence_testing (void *cls, int32_t success, const char *emsg) MAX_DNS_NAME_LENGTH, "www.doesnotexist-%d.bob.gnunet", i); GNUNET_GNS_lookup(gns_handle, lookup_name, GNUNET_GNS_RECORD_TYPE_A, + GNUNET_NO, &on_lookup_result_dummy, NULL); } GNUNET_GNS_lookup(gns_handle, TEST_DOMAIN, GNUNET_GNS_RECORD_TYPE_A, + GNUNET_NO, &on_lookup_result, TEST_DOMAIN); } diff --git a/src/gns/test_gns_pseu_shorten.c b/src/gns/test_gns_pseu_shorten.c index c6fd28884..d5e0cee78 100644 --- a/src/gns/test_gns_pseu_shorten.c +++ b/src/gns/test_gns_pseu_shorten.c @@ -237,6 +237,7 @@ commence_testing (void *cls, int success) GNUNET_GNS_lookup_zone (gns_handle, TEST_DOMAIN, &our_zone, &our_zone, GNUNET_GNS_RECORD_TYPE_A, + GNUNET_NO, &on_lookup_result, TEST_DOMAIN); } diff --git a/src/gns/test_gns_simple_delegated_lookup.c b/src/gns/test_gns_simple_delegated_lookup.c index 36fb96915..3f89b7d91 100644 --- a/src/gns/test_gns_simple_delegated_lookup.c +++ b/src/gns/test_gns_simple_delegated_lookup.c @@ -164,6 +164,7 @@ commence_testing (void *cls, int32_t success, const char *emsg) } GNUNET_GNS_lookup(gns_handle, TEST_DOMAIN, GNUNET_GNS_RECORD_TYPE_A, + GNUNET_NO, &on_lookup_result, TEST_DOMAIN); } diff --git a/src/gns/test_gns_simple_lookup.c b/src/gns/test_gns_simple_lookup.c index 89a9aefee..46ce3084e 100644 --- a/src/gns/test_gns_simple_lookup.c +++ b/src/gns/test_gns_simple_lookup.c @@ -149,6 +149,7 @@ commence_testing (void *cls, int32_t success, const char *emsg) } GNUNET_GNS_lookup(gns_handle, TEST_DOMAIN, GNUNET_GNS_RECORD_TYPE_A, + GNUNET_YES, &on_lookup_result, TEST_DOMAIN); } diff --git a/src/gns/test_gns_simple_mx_lookup.c b/src/gns/test_gns_simple_mx_lookup.c index fdc639a72..57531c4eb 100644 --- a/src/gns/test_gns_simple_mx_lookup.c +++ b/src/gns/test_gns_simple_mx_lookup.c @@ -181,6 +181,7 @@ commence_testing (void *cls, int32_t success, const char *emsg) } GNUNET_GNS_lookup(gns_handle, TEST_DOMAIN, GNUNET_GNS_RECORD_MX, + GNUNET_NO, &on_lookup_result, TEST_DOMAIN); } diff --git a/src/gns/test_gns_simple_zkey_lookup.c b/src/gns/test_gns_simple_zkey_lookup.c index 8b9b78bef..66bca0917 100644 --- a/src/gns/test_gns_simple_zkey_lookup.c +++ b/src/gns/test_gns_simple_zkey_lookup.c @@ -168,6 +168,7 @@ commence_testing (void *cls, int32_t success, const char *emsg) strcpy(pos, GNUNET_GNS_TLD_ZKEY); GNUNET_GNS_lookup(gns_handle, name, GNUNET_GNS_RECORD_TYPE_A, + GNUNET_NO, &on_lookup_result, NULL); } -- 2.25.1