From 2364b11771c64de0fb120d44f7cf41290f503cbc Mon Sep 17 00:00:00 2001 From: Martin Schanzenbach Date: Fri, 16 Mar 2012 09:16:58 +0000 Subject: [PATCH] -fixes --- src/gns/gns_api.c | 6 ++++++ src/gns/gnunet-service-gns_resolver.c | 16 ++++++++++++++++ src/gns/test_gns_simple_delegated_lookup.c | 4 +++- src/gns/test_gns_simple_lookup.c | 5 +++++ src/gns/test_gns_simple_shorten.c | 17 ++++++++++++----- 5 files changed, 42 insertions(+), 6 deletions(-) diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index 26870cdfd..5733e1cf3 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c @@ -362,6 +362,7 @@ process_shorten_reply (struct GNUNET_GNS_QueueEntry *qe, { GNUNET_break (0); force_reconnect (h); + GNUNET_free(qe); return; } @@ -372,6 +373,7 @@ process_shorten_reply (struct GNUNET_GNS_QueueEntry *qe, GNUNET_CLIENT_receive (h->client, &process_message, h, GNUNET_TIME_UNIT_FOREVER_REL); qe->shorten_proc(qe->proc_cls, short_name); + GNUNET_free(qe); } @@ -397,6 +399,7 @@ process_get_auth_reply (struct GNUNET_GNS_QueueEntry *qe, if (ntohs (((struct GNUNET_MessageHeader*)msg)->size) < sizeof (struct GNUNET_GNS_ClientGetAuthResultMessage)) { + GNUNET_free(qe); GNUNET_break (0); force_reconnect (h); return; @@ -409,6 +412,7 @@ process_get_auth_reply (struct GNUNET_GNS_QueueEntry *qe, GNUNET_CLIENT_receive (h->client, &process_message, h, GNUNET_TIME_UNIT_FOREVER_REL); qe->auth_proc(qe->proc_cls, auth_name); + GNUNET_free(qe); } /** @@ -433,6 +437,7 @@ process_lookup_reply (struct GNUNET_GNS_QueueEntry *qe, if (len < sizeof (struct GNUNET_GNS_ClientLookupResultMessage)) { + GNUNET_free(qe); GNUNET_break (0); force_reconnect (h); return; @@ -459,6 +464,7 @@ process_lookup_reply (struct GNUNET_GNS_QueueEntry *qe, ntohl(msg->rd_count)); qe->lookup_proc(qe->proc_cls, rd_count, rd); } + GNUNET_free(qe); } /** diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index a46a2fd61..0b11e980f 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c @@ -56,6 +56,10 @@ static struct GNUNET_DHT_Handle *dht_handle; /** * Initialize the resolver + * + * @param nh the namestore handle + * @param dh the dht handle + * @return GNUNET_OK on success */ int gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh, @@ -70,6 +74,18 @@ gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh, return GNUNET_SYSERR; } +/** + * Set the callback to call when we discover a + * new authority via the DHT + * + * @param adb the callback to set + * +void +gns_resolver_set_auth_discovered_cb(AuthorityDiscoveredProcessor adb) +{ + auth_discovered = adb; +} +*/ /** * Helper function to free resolver handle diff --git a/src/gns/test_gns_simple_delegated_lookup.c b/src/gns/test_gns_simple_delegated_lookup.c index 2bbc87584..ea1206b9b 100644 --- a/src/gns/test_gns_simple_delegated_lookup.c +++ b/src/gns/test_gns_simple_delegated_lookup.c @@ -270,7 +270,9 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id, sig, &commence_testing, NULL); - + GNUNET_free(sig); + GNUNET_CRYPTO_rsa_key_free(bob_key); + GNUNET_CRYPTO_rsa_key_free(alice_key); } static void diff --git a/src/gns/test_gns_simple_lookup.c b/src/gns/test_gns_simple_lookup.c index 8bd33fc47..e93de1a66 100644 --- a/src/gns/test_gns_simple_lookup.c +++ b/src/gns/test_gns_simple_lookup.c @@ -229,6 +229,8 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id, alice_key = GNUNET_CRYPTO_rsa_key_create_from_file (alice_keyfile); GNUNET_CRYPTO_rsa_key_get_public (alice_key, &alice_pkey); + + GNUNET_free(alice_keyfile); struct GNUNET_NAMESTORE_RecordData rd; char* ip = TEST_IP; @@ -245,6 +247,9 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id, &rd, &commence_testing, NULL); + + GNUNET_CRYPTO_rsa_key_free(alice_key); + GNUNET_free(web); } diff --git a/src/gns/test_gns_simple_shorten.c b/src/gns/test_gns_simple_shorten.c index c444dfe87..27a0024dc 100644 --- a/src/gns/test_gns_simple_shorten.c +++ b/src/gns/test_gns_simple_shorten.c @@ -254,7 +254,9 @@ do_shorten(void *cls, const struct GNUNET_PeerIdentity *id, /* put alice into bobs zone */ GNUNET_CRYPTO_hash(&alice_pkey, sizeof(alice_pkey), &alice_hash); rd.data = &alice_hash; - sig = GNUNET_NAMESTORE_create_signature(bob_key, GNUNET_TIME_absolute_get_forever(), TEST_AUTHORITY_ALICE, + sig = GNUNET_NAMESTORE_create_signature(bob_key, + GNUNET_TIME_absolute_get_forever(), + TEST_AUTHORITY_ALICE, &rd, 1); GNUNET_NAMESTORE_record_put (namestore_handle, @@ -266,13 +268,15 @@ do_shorten(void *cls, const struct GNUNET_PeerIdentity *id, sig, NULL, NULL); - + GNUNET_free(sig); /* put www A record and PSEU into alice's zone */ rd.data_size = sizeof(struct in_addr); rd.data = web; rd.record_type = GNUNET_DNSPARSER_TYPE_A; - sig = GNUNET_NAMESTORE_create_signature(alice_key,GNUNET_TIME_absolute_get_forever(), TEST_RECORD_NAME, + sig = GNUNET_NAMESTORE_create_signature(alice_key, + GNUNET_TIME_absolute_get_forever(), + TEST_RECORD_NAME, &rd, 1); GNUNET_NAMESTORE_record_put (namestore_handle, @@ -284,7 +288,7 @@ do_shorten(void *cls, const struct GNUNET_PeerIdentity *id, sig, NULL, NULL); - + rd.data_size = sizeof(GNUNET_HashCode); rd.data = &alice_hash; rd.record_type = GNUNET_GNS_RECORD_PKEY; @@ -297,7 +301,10 @@ do_shorten(void *cls, const struct GNUNET_PeerIdentity *id, &commence_testing, NULL); - + GNUNET_free(web); + GNUNET_CRYPTO_rsa_key_free(our_key); + GNUNET_CRYPTO_rsa_key_free(bob_key); + GNUNET_CRYPTO_rsa_key_free(alice_key); } static void -- 2.25.1