diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-07-14 16:27:07 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-07-14 16:27:07 +0000 |
commit | 41eebf21e8f0b3a824f216fd6fd372a79dcf0991 (patch) | |
tree | e2d6d35525009731edfa64f67fe7574452632fb4 | |
parent | 3cd0ab6b66dc7d61f2d93581e2f6ef6fc2a005fb (diff) | |
download | gnunet-41eebf21e8f0b3a824f216fd6fd372a79dcf0991.tar.gz gnunet-41eebf21e8f0b3a824f216fd6fd372a79dcf0991.zip |
-fix shorten
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 185 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.h | 4 |
2 files changed, 32 insertions, 157 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 37eb86ff3..67040840d 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -229,15 +229,9 @@ create_pkey_cont (void* cls, int32_t success, const char* emsg) | |||
229 | { | 229 | { |
230 | //FIXME do sth with error | 230 | //FIXME do sth with error |
231 | struct GetPseuAuthorityHandle* gph = (struct GetPseuAuthorityHandle*)cls; | 231 | struct GetPseuAuthorityHandle* gph = (struct GetPseuAuthorityHandle*)cls; |
232 | struct AuthorityChain *iter; | ||
233 | 232 | ||
234 | gph->namestore_task = NULL; | 233 | gph->namestore_task = NULL; |
235 | do | 234 | GNUNET_free (gph->auth); |
236 | { | ||
237 | iter = gph->ahead->next; | ||
238 | GNUNET_free (gph->ahead); | ||
239 | gph->ahead = iter; | ||
240 | } while (iter != NULL); | ||
241 | GNUNET_CRYPTO_rsa_key_free (gph->key); | 235 | GNUNET_CRYPTO_rsa_key_free (gph->key); |
242 | GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph); | 236 | GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph); |
243 | GNUNET_free (gph); | 237 | GNUNET_free (gph); |
@@ -266,51 +260,16 @@ process_pseu_lookup_ns (void* cls, | |||
266 | { | 260 | { |
267 | struct GetPseuAuthorityHandle* gph = (struct GetPseuAuthorityHandle*)cls; | 261 | struct GetPseuAuthorityHandle* gph = (struct GetPseuAuthorityHandle*)cls; |
268 | struct GNUNET_NAMESTORE_RecordData new_pkey; | 262 | struct GNUNET_NAMESTORE_RecordData new_pkey; |
269 | struct AuthorityChain *iter; | ||
270 | 263 | ||
271 | gph->namestore_task = NULL; | 264 | gph->namestore_task = NULL; |
272 | if (rd_count > 0) | 265 | if (rd_count > 0) |
273 | { | 266 | { |
274 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 267 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
275 | "GNS_AUTO_PSEU: Name %s already taken in NS!\n", name); | 268 | "GNS_AUTO_PSEU: Name %s already taken in NS!\n", name); |
276 | if (0 == strcmp (gph->name, name)) | 269 | GNUNET_free (gph->auth); |
277 | { | 270 | GNUNET_CRYPTO_rsa_key_free (gph->key); |
278 | if (gph->ahead->next != NULL) | 271 | GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph); |
279 | { | 272 | GNUNET_free (gph); |
280 | if (GNUNET_CRYPTO_short_hash_cmp (&gph->ahead->next->zone, | ||
281 | &gph->our_zone)) | ||
282 | { | ||
283 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GNS_GET_AUTH: trying next!\n"); | ||
284 | iter = gph->ahead->next; | ||
285 | GNUNET_free (gph->ahead); | ||
286 | gph->ahead = iter; | ||
287 | shorten_authority_chain (gph); | ||
288 | return; | ||
289 | } | ||
290 | } | ||
291 | |||
292 | /* Clean up */ | ||
293 | do | ||
294 | { | ||
295 | iter = gph->ahead->next; | ||
296 | GNUNET_free (gph->ahead); | ||
297 | gph->ahead = iter; | ||
298 | } while (iter != NULL); | ||
299 | GNUNET_CRYPTO_rsa_key_free (gph->key); | ||
300 | GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph); | ||
301 | GNUNET_free (gph); | ||
302 | return; | ||
303 | } | ||
304 | |||
305 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
306 | "GNS_AUTO_PSEU: Trying delegated name %s\n", gph->name); | ||
307 | memcpy (gph->test_name, gph->name, strlen (gph->name)+1); | ||
308 | gph->namestore_task = GNUNET_NAMESTORE_lookup_record (namestore_handle, | ||
309 | &gph->our_zone, | ||
310 | gph->test_name, | ||
311 | GNUNET_NAMESTORE_TYPE_ANY, | ||
312 | &process_pseu_lookup_ns, | ||
313 | gph); | ||
314 | return; | 273 | return; |
315 | } | 274 | } |
316 | 275 | ||
@@ -320,7 +279,7 @@ process_pseu_lookup_ns (void* cls, | |||
320 | 279 | ||
321 | new_pkey.expiration_time = UINT64_MAX; | 280 | new_pkey.expiration_time = UINT64_MAX; |
322 | new_pkey.data_size = sizeof (struct GNUNET_CRYPTO_ShortHashCode); | 281 | new_pkey.data_size = sizeof (struct GNUNET_CRYPTO_ShortHashCode); |
323 | new_pkey.data = &gph->ahead->zone; | 282 | new_pkey.data = &gph->auth->zone; |
324 | new_pkey.record_type = GNUNET_GNS_RECORD_PKEY; | 283 | new_pkey.record_type = GNUNET_GNS_RECORD_PKEY; |
325 | new_pkey.flags = GNUNET_NAMESTORE_RF_AUTHORITY | 284 | new_pkey.flags = GNUNET_NAMESTORE_RF_AUTHORITY |
326 | | GNUNET_NAMESTORE_RF_PRIVATE | 285 | | GNUNET_NAMESTORE_RF_PRIVATE |
@@ -344,17 +303,19 @@ process_pseu_result (struct GetPseuAuthorityHandle* gph, char* name) | |||
344 | { | 303 | { |
345 | if (NULL == name) | 304 | if (NULL == name) |
346 | { | 305 | { |
347 | memcpy (gph->test_name, gph->ahead->name, strlen (gph->ahead->name)+1); | 306 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
307 | "GNS_AUTO_PSEU: No PSEU, no shorten. Finished.\n"); | ||
308 | GNUNET_free (gph->auth); | ||
309 | GNUNET_CRYPTO_rsa_key_free (gph->key); | ||
310 | GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph); | ||
311 | GNUNET_free (gph); | ||
348 | } | 312 | } |
349 | else | 313 | else |
350 | { | ||
351 | memcpy (gph->test_name, name, strlen(name)+1); | 314 | memcpy (gph->test_name, name, strlen(name)+1); |
352 | } | ||
353 | 315 | ||
354 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 316 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
355 | "GNS_AUTO_PSEU: Checking %s for collision in NS\n", | 317 | "GNS_AUTO_PSEU: Checking %s for collision in NS\n", |
356 | gph->test_name); | 318 | gph->test_name); |
357 | |||
358 | /** | 319 | /** |
359 | * Check for collision | 320 | * Check for collision |
360 | */ | 321 | */ |
@@ -377,27 +338,11 @@ handle_auth_discovery_timeout (void *cls, | |||
377 | const struct GNUNET_SCHEDULER_TaskContext *tc) | 338 | const struct GNUNET_SCHEDULER_TaskContext *tc) |
378 | { | 339 | { |
379 | struct GetPseuAuthorityHandle* gph = (struct GetPseuAuthorityHandle*)cls; | 340 | struct GetPseuAuthorityHandle* gph = (struct GetPseuAuthorityHandle*)cls; |
380 | struct AuthorityChain *iter; | ||
381 | 341 | ||
382 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 342 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
383 | "GNS_GET_AUTH: dht lookup for query PSEU timed out.\n"); | 343 | "GNS_GET_AUTH: dht lookup for query PSEU timed out.\n"); |
384 | GNUNET_DHT_get_stop (gph->get_handle); | 344 | GNUNET_DHT_get_stop (gph->get_handle); |
385 | gph->get_handle = NULL; | 345 | gph->get_handle = NULL; |
386 | |||
387 | if (gph->ahead->next != NULL) | ||
388 | { | ||
389 | if (GNUNET_CRYPTO_short_hash_cmp (&gph->ahead->next->zone, | ||
390 | &gph->our_zone)) | ||
391 | { | ||
392 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GNS_GET_AUTH: trying next!\n"); | ||
393 | iter = gph->ahead->next; | ||
394 | GNUNET_free (gph->ahead); | ||
395 | gph->ahead = iter; | ||
396 | shorten_authority_chain (gph); | ||
397 | return; | ||
398 | } | ||
399 | } | ||
400 | |||
401 | process_pseu_result (gph, NULL); | 346 | process_pseu_result (gph, NULL); |
402 | } | 347 | } |
403 | 348 | ||
@@ -427,7 +372,6 @@ process_auth_discovery_dht_result (void* cls, | |||
427 | size_t size, const void *data) | 372 | size_t size, const void *data) |
428 | { | 373 | { |
429 | struct GetPseuAuthorityHandle* gph = (struct GetPseuAuthorityHandle*)cls; | 374 | struct GetPseuAuthorityHandle* gph = (struct GetPseuAuthorityHandle*)cls; |
430 | struct AuthorityChain *iter; | ||
431 | struct GNSNameRecordBlock *nrb; | 375 | struct GNSNameRecordBlock *nrb; |
432 | char* rd_data = (char*)data; | 376 | char* rd_data = (char*)data; |
433 | char* name; | 377 | char* name; |
@@ -438,7 +382,6 @@ process_auth_discovery_dht_result (void* cls, | |||
438 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 382 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
439 | "GNS_GET_AUTH: got dht result (size=%d)\n", size); | 383 | "GNS_GET_AUTH: got dht result (size=%d)\n", size); |
440 | 384 | ||
441 | |||
442 | /* stop lookup and timeout task */ | 385 | /* stop lookup and timeout task */ |
443 | GNUNET_DHT_get_stop (gph->get_handle); | 386 | GNUNET_DHT_get_stop (gph->get_handle); |
444 | gph->get_handle = NULL; | 387 | gph->get_handle = NULL; |
@@ -448,13 +391,7 @@ process_auth_discovery_dht_result (void* cls, | |||
448 | { | 391 | { |
449 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 392 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
450 | "GNS_GET_AUTH: got dht result null!\n", size); | 393 | "GNS_GET_AUTH: got dht result null!\n", size); |
451 | 394 | GNUNET_free (gph->auth); | |
452 | do | ||
453 | { | ||
454 | iter = gph->ahead->next; | ||
455 | GNUNET_free (gph->ahead); | ||
456 | gph->ahead = iter; | ||
457 | } while (iter != NULL); | ||
458 | GNUNET_CRYPTO_rsa_key_free (gph->key); | 395 | GNUNET_CRYPTO_rsa_key_free (gph->key); |
459 | GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph); | 396 | GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph); |
460 | GNUNET_free (gph); | 397 | GNUNET_free (gph); |
@@ -462,11 +399,6 @@ process_auth_discovery_dht_result (void* cls, | |||
462 | } | 399 | } |
463 | 400 | ||
464 | nrb = (struct GNSNameRecordBlock*)data; | 401 | nrb = (struct GNSNameRecordBlock*)data; |
465 | |||
466 | |||
467 | |||
468 | nrb = (struct GNSNameRecordBlock*)data; | ||
469 | |||
470 | name = (char*)&nrb[1]; | 402 | name = (char*)&nrb[1]; |
471 | num_records = ntohl (nrb->rd_count); | 403 | num_records = ntohl (nrb->rd_count); |
472 | { | 404 | { |
@@ -497,22 +429,6 @@ process_auth_discovery_dht_result (void* cls, | |||
497 | } | 429 | } |
498 | } | 430 | } |
499 | } | 431 | } |
500 | |||
501 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GNS_GET_AUTH: no pseu in dht!\n"); | ||
502 | |||
503 | if (gph->ahead->next != NULL) | ||
504 | { | ||
505 | if (GNUNET_CRYPTO_short_hash_cmp (&gph->ahead->next->zone, | ||
506 | &gph->our_zone)) | ||
507 | { | ||
508 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GNS_GET_AUTH: trying next!\n"); | ||
509 | iter = gph->ahead->next; | ||
510 | GNUNET_free (gph->ahead); | ||
511 | gph->ahead = iter; | ||
512 | shorten_authority_chain (gph); | ||
513 | return; | ||
514 | } | ||
515 | } | ||
516 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 432 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
517 | "GNS_GET_AUTH: finished shorten, no results!\n"); | 433 | "GNS_GET_AUTH: finished shorten, no results!\n"); |
518 | process_pseu_result (gph, NULL); | 434 | process_pseu_result (gph, NULL); |
@@ -546,7 +462,6 @@ process_auth_discovery_ns_result (void* cls, | |||
546 | struct GNUNET_HashCode zone_hash_double; | 462 | struct GNUNET_HashCode zone_hash_double; |
547 | int i; | 463 | int i; |
548 | struct GetPseuAuthorityHandle* gph = (struct GetPseuAuthorityHandle*)cls; | 464 | struct GetPseuAuthorityHandle* gph = (struct GetPseuAuthorityHandle*)cls; |
549 | struct AuthorityChain *iter; | ||
550 | 465 | ||
551 | gph->namestore_task = NULL; | 466 | gph->namestore_task = NULL; |
552 | /* no pseu found */ | 467 | /* no pseu found */ |
@@ -557,7 +472,7 @@ process_auth_discovery_ns_result (void* cls, | |||
557 | */ | 472 | */ |
558 | GNUNET_CRYPTO_short_hash ("+", strlen ("+"), &name_hash); | 473 | GNUNET_CRYPTO_short_hash ("+", strlen ("+"), &name_hash); |
559 | GNUNET_CRYPTO_short_hash_double (&name_hash, &name_hash_double); | 474 | GNUNET_CRYPTO_short_hash_double (&name_hash, &name_hash_double); |
560 | GNUNET_CRYPTO_short_hash_double (&gph->ahead->zone, &zone_hash_double); | 475 | GNUNET_CRYPTO_short_hash_double (&gph->auth->zone, &zone_hash_double); |
561 | GNUNET_CRYPTO_hash_xor (&name_hash_double, &zone_hash_double, &lookup_key); | 476 | GNUNET_CRYPTO_hash_xor (&name_hash_double, &zone_hash_double, &lookup_key); |
562 | GNUNET_CRYPTO_hash_to_enc (&lookup_key, &lookup_key_string); | 477 | GNUNET_CRYPTO_hash_to_enc (&lookup_key, &lookup_key_string); |
563 | 478 | ||
@@ -596,21 +511,6 @@ process_auth_discovery_ns_result (void* cls, | |||
596 | } | 511 | } |
597 | 512 | ||
598 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GNS_GET_AUTH: no pseu in namestore!\n"); | 513 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GNS_GET_AUTH: no pseu in namestore!\n"); |
599 | |||
600 | if (gph->ahead->next != NULL) | ||
601 | { | ||
602 | if (GNUNET_CRYPTO_short_hash_cmp (&gph->ahead->next->zone, | ||
603 | &gph->our_zone)) | ||
604 | { | ||
605 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "GNS_GET_AUTH: trying next!\n"); | ||
606 | iter = gph->ahead->next; | ||
607 | GNUNET_free (gph->ahead); | ||
608 | gph->ahead = iter; | ||
609 | shorten_authority_chain (gph); | ||
610 | return; | ||
611 | } | ||
612 | } | ||
613 | |||
614 | process_pseu_result (gph, NULL); | 514 | process_pseu_result (gph, NULL); |
615 | } | 515 | } |
616 | 516 | ||
@@ -636,7 +536,6 @@ process_zone_to_name_discover (void *cls, | |||
636 | const struct GNUNET_CRYPTO_RsaSignature *signature) | 536 | const struct GNUNET_CRYPTO_RsaSignature *signature) |
637 | { | 537 | { |
638 | struct GetPseuAuthorityHandle* gph = (struct GetPseuAuthorityHandle*)cls; | 538 | struct GetPseuAuthorityHandle* gph = (struct GetPseuAuthorityHandle*)cls; |
639 | struct AuthorityChain *iter; | ||
640 | 539 | ||
641 | gph->namestore_task = NULL; | 540 | gph->namestore_task = NULL; |
642 | /* we found a match in our own zone */ | 541 | /* we found a match in our own zone */ |
@@ -644,14 +543,8 @@ process_zone_to_name_discover (void *cls, | |||
644 | { | 543 | { |
645 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, | 544 | GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, |
646 | "GNS_AUTO_PSEU: name for zone in our root %s\n", name); | 545 | "GNS_AUTO_PSEU: name for zone in our root %s\n", name); |
647 | 546 | ||
648 | iter = gph->ahead; | 547 | GNUNET_free (gph->auth); |
649 | do | ||
650 | { | ||
651 | iter = gph->ahead->next; | ||
652 | GNUNET_free (gph->ahead); | ||
653 | gph->ahead = iter; | ||
654 | } while (iter != NULL); | ||
655 | GNUNET_CRYPTO_rsa_key_free (gph->key); | 548 | GNUNET_CRYPTO_rsa_key_free (gph->key); |
656 | GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph); | 549 | GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph); |
657 | GNUNET_free (gph); | 550 | GNUNET_free (gph); |
@@ -660,7 +553,7 @@ process_zone_to_name_discover (void *cls, | |||
660 | { | 553 | { |
661 | 554 | ||
662 | gph->namestore_task = GNUNET_NAMESTORE_lookup_record (namestore_handle, | 555 | gph->namestore_task = GNUNET_NAMESTORE_lookup_record (namestore_handle, |
663 | &gph->ahead->zone, | 556 | &gph->auth->zone, |
664 | "+", | 557 | "+", |
665 | GNUNET_GNS_RECORD_PSEU, | 558 | GNUNET_GNS_RECORD_PSEU, |
666 | &process_auth_discovery_ns_result, | 559 | &process_auth_discovery_ns_result, |
@@ -681,37 +574,28 @@ shorten_authority_chain (struct GetPseuAuthorityHandle *gph) | |||
681 | 574 | ||
682 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 575 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
683 | "GNS_AUTO_PSEU: New authority %s discovered\n", | 576 | "GNS_AUTO_PSEU: New authority %s discovered\n", |
684 | gph->ahead->name); | 577 | gph->auth->name); |
685 | 578 | ||
686 | gph->namestore_task = GNUNET_NAMESTORE_zone_to_name (namestore_handle, | 579 | gph->namestore_task = GNUNET_NAMESTORE_zone_to_name (namestore_handle, |
687 | &gph->our_zone, | 580 | &gph->our_zone, |
688 | &gph->ahead->zone, | 581 | &gph->auth->zone, |
689 | &process_zone_to_name_discover, | 582 | &process_zone_to_name_discover, |
690 | gph); | 583 | gph); |
691 | 584 | ||
692 | } | 585 | } |
693 | 586 | ||
694 | static void | 587 | static void |
695 | start_shorten (struct AuthorityChain *atail, | 588 | start_shorten (struct AuthorityChain *auth, |
696 | struct GNUNET_CRYPTO_RsaPrivateKey *key) | 589 | struct GNUNET_CRYPTO_RsaPrivateKey *key) |
697 | { | 590 | { |
698 | struct AuthorityChain *new_head = NULL; | ||
699 | struct AuthorityChain *new_tail = NULL; | ||
700 | struct AuthorityChain *iter; | ||
701 | struct AuthorityChain *acopy; | 591 | struct AuthorityChain *acopy; |
702 | struct GetPseuAuthorityHandle *gph; | 592 | struct GetPseuAuthorityHandle *gph; |
703 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey; | 593 | struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey; |
704 | struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded *pb_key; | 594 | struct GNUNET_CRYPTO_RsaPrivateKeyBinaryEncoded *pb_key; |
705 | 595 | ||
706 | /* First copy the authority chain in reverse order */ | 596 | |
707 | for (iter = atail; iter != NULL; iter = iter->prev) | 597 | acopy = GNUNET_malloc (sizeof (struct AuthorityChain)); |
708 | { | 598 | memcpy (acopy, auth, sizeof (struct AuthorityChain)); |
709 | acopy = GNUNET_malloc (sizeof (struct AuthorityChain)); | ||
710 | memcpy (acopy, iter, sizeof (struct AuthorityChain)); | ||
711 | acopy->next = NULL; | ||
712 | acopy->prev = NULL; | ||
713 | GNUNET_CONTAINER_DLL_insert (new_head, new_tail, acopy); | ||
714 | } | ||
715 | 599 | ||
716 | gph = GNUNET_malloc (sizeof (struct GetPseuAuthorityHandle)); | 600 | gph = GNUNET_malloc (sizeof (struct GetPseuAuthorityHandle)); |
717 | 601 | ||
@@ -722,7 +606,7 @@ start_shorten (struct AuthorityChain *atail, | |||
722 | GNUNET_CRYPTO_short_hash (&pkey, | 606 | GNUNET_CRYPTO_short_hash (&pkey, |
723 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), | 607 | sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), |
724 | &gph->our_zone); | 608 | &gph->our_zone); |
725 | gph->ahead = new_head; | 609 | gph->auth = acopy; |
726 | 610 | ||
727 | GNUNET_CONTAINER_DLL_insert (gph_head, gph_tail, gph); | 611 | GNUNET_CONTAINER_DLL_insert (gph_head, gph_tail, gph); |
728 | 612 | ||
@@ -946,7 +830,6 @@ gns_resolver_cleanup (ResolverCleanupContinuation cont) | |||
946 | { | 830 | { |
947 | unsigned int s; | 831 | unsigned int s; |
948 | struct GetPseuAuthorityHandle *tmp; | 832 | struct GetPseuAuthorityHandle *tmp; |
949 | struct AuthorityChain *iter; | ||
950 | 833 | ||
951 | 834 | ||
952 | tmp = gph_head; | 835 | tmp = gph_head; |
@@ -962,15 +845,7 @@ gns_resolver_cleanup (ResolverCleanupContinuation cont) | |||
962 | if (NULL != tmp->namestore_task) | 845 | if (NULL != tmp->namestore_task) |
963 | GNUNET_NAMESTORE_cancel (tmp->namestore_task); | 846 | GNUNET_NAMESTORE_cancel (tmp->namestore_task); |
964 | tmp->namestore_task = NULL; | 847 | tmp->namestore_task = NULL; |
965 | 848 | GNUNET_free (tmp->auth); | |
966 | iter = tmp->ahead; | ||
967 | do | ||
968 | { | ||
969 | iter = tmp->ahead->next; | ||
970 | GNUNET_free (tmp->ahead); | ||
971 | tmp->ahead = iter; | ||
972 | } while (iter != NULL); | ||
973 | |||
974 | GNUNET_CRYPTO_rsa_key_free (tmp->key); | 849 | GNUNET_CRYPTO_rsa_key_free (tmp->key); |
975 | GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, tmp); | 850 | GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, tmp); |
976 | GNUNET_free (tmp); | 851 | GNUNET_free (tmp); |
@@ -1886,7 +1761,7 @@ resolve_record_dns (struct ResolverHandle *rh, | |||
1886 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1761 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1887 | "GNS_PHASE_REC_DNS-%llu: Trying to shorten authority chain\n", | 1762 | "GNS_PHASE_REC_DNS-%llu: Trying to shorten authority chain\n", |
1888 | rh->id); | 1763 | rh->id); |
1889 | start_shorten (rh->authority_chain_tail, | 1764 | start_shorten (rh->authority_chain_head, |
1890 | rh->priv_key); | 1765 | rh->priv_key); |
1891 | } | 1766 | } |
1892 | 1767 | ||
@@ -2006,7 +1881,7 @@ resolve_record_vpn (struct ResolverHandle *rh, | |||
2006 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1881 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2007 | "GNS_PHASE_REC_VPN-%llu: Trying to shorten authority chain\n", | 1882 | "GNS_PHASE_REC_VPN-%llu: Trying to shorten authority chain\n", |
2008 | rh->id); | 1883 | rh->id); |
2009 | start_shorten (rh->authority_chain_tail, | 1884 | start_shorten (rh->authority_chain_head, |
2010 | rh->priv_key); | 1885 | rh->priv_key); |
2011 | } | 1886 | } |
2012 | 1887 | ||
@@ -2085,7 +1960,7 @@ resolve_record_ns(struct ResolverHandle *rh) | |||
2085 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1960 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2086 | "GNS_PHASE_REC-%llu: Trying to shorten authority chain\n", | 1961 | "GNS_PHASE_REC-%llu: Trying to shorten authority chain\n", |
2087 | rh->id); | 1962 | rh->id); |
2088 | start_shorten (rh->authority_chain_tail, | 1963 | start_shorten (rh->authority_chain_head, |
2089 | rh->priv_key); | 1964 | rh->priv_key); |
2090 | } | 1965 | } |
2091 | 1966 | ||
@@ -2520,7 +2395,7 @@ process_delegation_result_dht(void* cls, | |||
2520 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2395 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2521 | "GNS_PHASE_DELEGATE_DHT-%llu: Trying to shorten authority chain\n", | 2396 | "GNS_PHASE_DELEGATE_DHT-%llu: Trying to shorten authority chain\n", |
2522 | rh->id); | 2397 | rh->id); |
2523 | start_shorten (rh->authority_chain_tail, | 2398 | start_shorten (rh->authority_chain_head, |
2524 | rh->priv_key); | 2399 | rh->priv_key); |
2525 | } | 2400 | } |
2526 | } | 2401 | } |
@@ -3475,7 +3350,7 @@ process_delegation_result_ns (void* cls, | |||
3475 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 3350 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
3476 | "GNS_PHASE_DELEGATE_NS-%llu: Trying to shorten authority chain\n", | 3351 | "GNS_PHASE_DELEGATE_NS-%llu: Trying to shorten authority chain\n", |
3477 | rh->id); | 3352 | rh->id); |
3478 | start_shorten (rh->authority_chain_tail, | 3353 | start_shorten (rh->authority_chain_head, |
3479 | rh->priv_key); | 3354 | rh->priv_key); |
3480 | } | 3355 | } |
3481 | /* simply promote back */ | 3356 | /* simply promote back */ |
diff --git a/src/gns/gnunet-service-gns_resolver.h b/src/gns/gnunet-service-gns_resolver.h index b57386f4f..8b0a05e5f 100644 --- a/src/gns/gnunet-service-gns_resolver.h +++ b/src/gns/gnunet-service-gns_resolver.h | |||
@@ -330,8 +330,8 @@ struct GetPseuAuthorityHandle | |||
330 | /* timeout task for lookup */ | 330 | /* timeout task for lookup */ |
331 | GNUNET_SCHEDULER_TaskIdentifier timeout; | 331 | GNUNET_SCHEDULER_TaskIdentifier timeout; |
332 | 332 | ||
333 | /* Head of the authority list */ | 333 | /* Authority to shorten */ |
334 | struct AuthorityChain *ahead; | 334 | struct AuthorityChain *auth; |
335 | 335 | ||
336 | /* handle to namestore request */ | 336 | /* handle to namestore request */ |
337 | struct GNUNET_NAMESTORE_QueueEntry* namestore_task; | 337 | struct GNUNET_NAMESTORE_QueueEntry* namestore_task; |