diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-16 09:16:58 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-03-16 09:16:58 +0000 |
commit | 2364b11771c64de0fb120d44f7cf41290f503cbc (patch) | |
tree | 7aff048fa2945ff2cb99cf777fd9064bdf5c7e9b | |
parent | 82e1974e76ae1c4a0002dfc2b81d3b3f07d50637 (diff) | |
download | gnunet-2364b11771c64de0fb120d44f7cf41290f503cbc.tar.gz gnunet-2364b11771c64de0fb120d44f7cf41290f503cbc.zip |
-fixes
-rw-r--r-- | src/gns/gns_api.c | 6 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 16 | ||||
-rw-r--r-- | src/gns/test_gns_simple_delegated_lookup.c | 4 | ||||
-rw-r--r-- | src/gns/test_gns_simple_lookup.c | 5 | ||||
-rw-r--r-- | 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, | |||
362 | { | 362 | { |
363 | GNUNET_break (0); | 363 | GNUNET_break (0); |
364 | force_reconnect (h); | 364 | force_reconnect (h); |
365 | GNUNET_free(qe); | ||
365 | return; | 366 | return; |
366 | } | 367 | } |
367 | 368 | ||
@@ -372,6 +373,7 @@ process_shorten_reply (struct GNUNET_GNS_QueueEntry *qe, | |||
372 | GNUNET_CLIENT_receive (h->client, &process_message, h, | 373 | GNUNET_CLIENT_receive (h->client, &process_message, h, |
373 | GNUNET_TIME_UNIT_FOREVER_REL); | 374 | GNUNET_TIME_UNIT_FOREVER_REL); |
374 | qe->shorten_proc(qe->proc_cls, short_name); | 375 | qe->shorten_proc(qe->proc_cls, short_name); |
376 | GNUNET_free(qe); | ||
375 | 377 | ||
376 | } | 378 | } |
377 | 379 | ||
@@ -397,6 +399,7 @@ process_get_auth_reply (struct GNUNET_GNS_QueueEntry *qe, | |||
397 | if (ntohs (((struct GNUNET_MessageHeader*)msg)->size) < | 399 | if (ntohs (((struct GNUNET_MessageHeader*)msg)->size) < |
398 | sizeof (struct GNUNET_GNS_ClientGetAuthResultMessage)) | 400 | sizeof (struct GNUNET_GNS_ClientGetAuthResultMessage)) |
399 | { | 401 | { |
402 | GNUNET_free(qe); | ||
400 | GNUNET_break (0); | 403 | GNUNET_break (0); |
401 | force_reconnect (h); | 404 | force_reconnect (h); |
402 | return; | 405 | return; |
@@ -409,6 +412,7 @@ process_get_auth_reply (struct GNUNET_GNS_QueueEntry *qe, | |||
409 | GNUNET_CLIENT_receive (h->client, &process_message, h, | 412 | GNUNET_CLIENT_receive (h->client, &process_message, h, |
410 | GNUNET_TIME_UNIT_FOREVER_REL); | 413 | GNUNET_TIME_UNIT_FOREVER_REL); |
411 | qe->auth_proc(qe->proc_cls, auth_name); | 414 | qe->auth_proc(qe->proc_cls, auth_name); |
415 | GNUNET_free(qe); | ||
412 | 416 | ||
413 | } | 417 | } |
414 | /** | 418 | /** |
@@ -433,6 +437,7 @@ process_lookup_reply (struct GNUNET_GNS_QueueEntry *qe, | |||
433 | 437 | ||
434 | if (len < sizeof (struct GNUNET_GNS_ClientLookupResultMessage)) | 438 | if (len < sizeof (struct GNUNET_GNS_ClientLookupResultMessage)) |
435 | { | 439 | { |
440 | GNUNET_free(qe); | ||
436 | GNUNET_break (0); | 441 | GNUNET_break (0); |
437 | force_reconnect (h); | 442 | force_reconnect (h); |
438 | return; | 443 | return; |
@@ -459,6 +464,7 @@ process_lookup_reply (struct GNUNET_GNS_QueueEntry *qe, | |||
459 | ntohl(msg->rd_count)); | 464 | ntohl(msg->rd_count)); |
460 | qe->lookup_proc(qe->proc_cls, rd_count, rd); | 465 | qe->lookup_proc(qe->proc_cls, rd_count, rd); |
461 | } | 466 | } |
467 | GNUNET_free(qe); | ||
462 | } | 468 | } |
463 | 469 | ||
464 | /** | 470 | /** |
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; | |||
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Initialize the resolver | 58 | * Initialize the resolver |
59 | * | ||
60 | * @param nh the namestore handle | ||
61 | * @param dh the dht handle | ||
62 | * @return GNUNET_OK on success | ||
59 | */ | 63 | */ |
60 | int | 64 | int |
61 | gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh, | 65 | gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh, |
@@ -70,6 +74,18 @@ gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh, | |||
70 | return GNUNET_SYSERR; | 74 | return GNUNET_SYSERR; |
71 | } | 75 | } |
72 | 76 | ||
77 | /** | ||
78 | * Set the callback to call when we discover a | ||
79 | * new authority via the DHT | ||
80 | * | ||
81 | * @param adb the callback to set | ||
82 | * | ||
83 | void | ||
84 | gns_resolver_set_auth_discovered_cb(AuthorityDiscoveredProcessor adb) | ||
85 | { | ||
86 | auth_discovered = adb; | ||
87 | } | ||
88 | */ | ||
73 | 89 | ||
74 | /** | 90 | /** |
75 | * Helper function to free resolver handle | 91 | * 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, | |||
270 | sig, | 270 | sig, |
271 | &commence_testing, | 271 | &commence_testing, |
272 | NULL); | 272 | NULL); |
273 | 273 | GNUNET_free(sig); | |
274 | GNUNET_CRYPTO_rsa_key_free(bob_key); | ||
275 | GNUNET_CRYPTO_rsa_key_free(alice_key); | ||
274 | } | 276 | } |
275 | 277 | ||
276 | static void | 278 | 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, | |||
229 | alice_key = GNUNET_CRYPTO_rsa_key_create_from_file (alice_keyfile); | 229 | alice_key = GNUNET_CRYPTO_rsa_key_create_from_file (alice_keyfile); |
230 | 230 | ||
231 | GNUNET_CRYPTO_rsa_key_get_public (alice_key, &alice_pkey); | 231 | GNUNET_CRYPTO_rsa_key_get_public (alice_key, &alice_pkey); |
232 | |||
233 | GNUNET_free(alice_keyfile); | ||
232 | 234 | ||
233 | struct GNUNET_NAMESTORE_RecordData rd; | 235 | struct GNUNET_NAMESTORE_RecordData rd; |
234 | char* ip = TEST_IP; | 236 | char* ip = TEST_IP; |
@@ -245,6 +247,9 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id, | |||
245 | &rd, | 247 | &rd, |
246 | &commence_testing, | 248 | &commence_testing, |
247 | NULL); | 249 | NULL); |
250 | |||
251 | GNUNET_CRYPTO_rsa_key_free(alice_key); | ||
252 | GNUNET_free(web); | ||
248 | 253 | ||
249 | } | 254 | } |
250 | 255 | ||
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, | |||
254 | /* put alice into bobs zone */ | 254 | /* put alice into bobs zone */ |
255 | GNUNET_CRYPTO_hash(&alice_pkey, sizeof(alice_pkey), &alice_hash); | 255 | GNUNET_CRYPTO_hash(&alice_pkey, sizeof(alice_pkey), &alice_hash); |
256 | rd.data = &alice_hash; | 256 | rd.data = &alice_hash; |
257 | sig = GNUNET_NAMESTORE_create_signature(bob_key, GNUNET_TIME_absolute_get_forever(), TEST_AUTHORITY_ALICE, | 257 | sig = GNUNET_NAMESTORE_create_signature(bob_key, |
258 | GNUNET_TIME_absolute_get_forever(), | ||
259 | TEST_AUTHORITY_ALICE, | ||
258 | &rd, 1); | 260 | &rd, 1); |
259 | 261 | ||
260 | GNUNET_NAMESTORE_record_put (namestore_handle, | 262 | GNUNET_NAMESTORE_record_put (namestore_handle, |
@@ -266,13 +268,15 @@ do_shorten(void *cls, const struct GNUNET_PeerIdentity *id, | |||
266 | sig, | 268 | sig, |
267 | NULL, | 269 | NULL, |
268 | NULL); | 270 | NULL); |
269 | 271 | GNUNET_free(sig); | |
270 | /* put www A record and PSEU into alice's zone */ | 272 | /* put www A record and PSEU into alice's zone */ |
271 | 273 | ||
272 | rd.data_size = sizeof(struct in_addr); | 274 | rd.data_size = sizeof(struct in_addr); |
273 | rd.data = web; | 275 | rd.data = web; |
274 | rd.record_type = GNUNET_DNSPARSER_TYPE_A; | 276 | rd.record_type = GNUNET_DNSPARSER_TYPE_A; |
275 | sig = GNUNET_NAMESTORE_create_signature(alice_key,GNUNET_TIME_absolute_get_forever(), TEST_RECORD_NAME, | 277 | sig = GNUNET_NAMESTORE_create_signature(alice_key, |
278 | GNUNET_TIME_absolute_get_forever(), | ||
279 | TEST_RECORD_NAME, | ||
276 | &rd, 1); | 280 | &rd, 1); |
277 | 281 | ||
278 | GNUNET_NAMESTORE_record_put (namestore_handle, | 282 | GNUNET_NAMESTORE_record_put (namestore_handle, |
@@ -284,7 +288,7 @@ do_shorten(void *cls, const struct GNUNET_PeerIdentity *id, | |||
284 | sig, | 288 | sig, |
285 | NULL, | 289 | NULL, |
286 | NULL); | 290 | NULL); |
287 | 291 | ||
288 | rd.data_size = sizeof(GNUNET_HashCode); | 292 | rd.data_size = sizeof(GNUNET_HashCode); |
289 | rd.data = &alice_hash; | 293 | rd.data = &alice_hash; |
290 | rd.record_type = GNUNET_GNS_RECORD_PKEY; | 294 | rd.record_type = GNUNET_GNS_RECORD_PKEY; |
@@ -297,7 +301,10 @@ do_shorten(void *cls, const struct GNUNET_PeerIdentity *id, | |||
297 | &commence_testing, | 301 | &commence_testing, |
298 | NULL); | 302 | NULL); |
299 | 303 | ||
300 | 304 | GNUNET_free(web); | |
305 | GNUNET_CRYPTO_rsa_key_free(our_key); | ||
306 | GNUNET_CRYPTO_rsa_key_free(bob_key); | ||
307 | GNUNET_CRYPTO_rsa_key_free(alice_key); | ||
301 | } | 308 | } |
302 | 309 | ||
303 | static void | 310 | static void |