diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-05-09 11:25:44 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2012-05-09 11:25:44 +0000 |
commit | b4a29413ffa9cf01043a10747498e79455e1aa7f (patch) | |
tree | 521cd4e7ba6191d2b84fcea851a1fea401f6059e /src/gns/gnunet-service-gns_resolver.c | |
parent | 6143cf95a47f8ec7de7898a416557f5034c36b27 (diff) | |
download | gnunet-b4a29413ffa9cf01043a10747498e79455e1aa7f.tar.gz gnunet-b4a29413ffa9cf01043a10747498e79455e1aa7f.zip |
-fixes
Diffstat (limited to 'src/gns/gnunet-service-gns_resolver.c')
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index fee4295e7..56456ef99 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -634,6 +634,7 @@ dht_lookup_timeout(void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
634 | rh->id, new_name, rlh->record_type); | 634 | rh->id, new_name, rlh->record_type); |
635 | 635 | ||
636 | gns_resolver_lookup_record(rh->authority, | 636 | gns_resolver_lookup_record(rh->authority, |
637 | rh->private_local_zone, | ||
637 | rlh->record_type, | 638 | rlh->record_type, |
638 | new_name, | 639 | new_name, |
639 | rh->priv_key, | 640 | rh->priv_key, |
@@ -1081,6 +1082,7 @@ dht_authority_lookup_timeout(void *cls, | |||
1081 | rh->id, rh->name, rlh->record_type); | 1082 | rh->id, rh->name, rlh->record_type); |
1082 | 1083 | ||
1083 | gns_resolver_lookup_record(rh->authority, | 1084 | gns_resolver_lookup_record(rh->authority, |
1085 | rh->private_local_zone, | ||
1084 | rlh->record_type, | 1086 | rlh->record_type, |
1085 | new_name, | 1087 | new_name, |
1086 | rh->priv_key, | 1088 | rh->priv_key, |
@@ -1507,7 +1509,7 @@ handle_record_ns(void* cls, struct ResolverHandle *rh, | |||
1507 | */ | 1509 | */ |
1508 | if (rh->status & (RSL_RECORD_EXPIRED | !RSL_RECORD_EXISTS) && | 1510 | if (rh->status & (RSL_RECORD_EXPIRED | !RSL_RECORD_EXISTS) && |
1509 | GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone, | 1511 | GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone, |
1510 | &local_zone) && | 1512 | &rh->private_local_zone) && |
1511 | (strcmp(rh->name, "+") == 0)) | 1513 | (strcmp(rh->name, "+") == 0)) |
1512 | { | 1514 | { |
1513 | rh->proc = &handle_record_dht; | 1515 | rh->proc = &handle_record_dht; |
@@ -1800,7 +1802,7 @@ handle_delegation_ns(void* cls, struct ResolverHandle *rh, | |||
1800 | **/ | 1802 | **/ |
1801 | if (((rh->status & RSL_RECORD_EXISTS) && (!(rh->status & RSL_RECORD_EXPIRED))) | 1803 | if (((rh->status & RSL_RECORD_EXISTS) && (!(rh->status & RSL_RECORD_EXPIRED))) |
1802 | || !GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone, | 1804 | || !GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone, |
1803 | &local_zone)) | 1805 | &rh->private_local_zone)) |
1804 | { | 1806 | { |
1805 | if (is_canonical(rh->name)) | 1807 | if (is_canonical(rh->name)) |
1806 | { | 1808 | { |
@@ -2056,6 +2058,7 @@ resolve_delegation_ns(struct ResolverHandle *rh) | |||
2056 | * calls lookup result processor on result | 2058 | * calls lookup result processor on result |
2057 | * | 2059 | * |
2058 | * @param zone the root zone | 2060 | * @param zone the root zone |
2061 | * @param pzone the private local zone | ||
2059 | * @param record_type the record type to look up | 2062 | * @param record_type the record type to look up |
2060 | * @param name the name to look up | 2063 | * @param name the name to look up |
2061 | * @param key a private key for use with PSEU import (can be NULL) | 2064 | * @param key a private key for use with PSEU import (can be NULL) |
@@ -2065,6 +2068,7 @@ resolve_delegation_ns(struct ResolverHandle *rh) | |||
2065 | */ | 2068 | */ |
2066 | void | 2069 | void |
2067 | gns_resolver_lookup_record(struct GNUNET_CRYPTO_ShortHashCode zone, | 2070 | gns_resolver_lookup_record(struct GNUNET_CRYPTO_ShortHashCode zone, |
2071 | struct GNUNET_CRYPTO_ShortHashCode pzone, | ||
2068 | uint32_t record_type, | 2072 | uint32_t record_type, |
2069 | const char* name, | 2073 | const char* name, |
2070 | struct GNUNET_CRYPTO_RsaPrivateKey *key, | 2074 | struct GNUNET_CRYPTO_RsaPrivateKey *key, |
@@ -2100,6 +2104,8 @@ gns_resolver_lookup_record(struct GNUNET_CRYPTO_ShortHashCode zone, | |||
2100 | rh->priv_key = key; | 2104 | rh->priv_key = key; |
2101 | rh->timeout = timeout; | 2105 | rh->timeout = timeout; |
2102 | rh->get_handle = NULL; | 2106 | rh->get_handle = NULL; |
2107 | rh->private_local_zone = pzone; | ||
2108 | |||
2103 | if (timeout.rel_value != GNUNET_TIME_UNIT_FOREVER_REL.rel_value) | 2109 | if (timeout.rel_value != GNUNET_TIME_UNIT_FOREVER_REL.rel_value) |
2104 | { | 2110 | { |
2105 | /* | 2111 | /* |
@@ -2255,7 +2261,7 @@ process_zone_to_name_shorten(void *cls, | |||
2255 | free_resolver_handle(rh); | 2261 | free_resolver_handle(rh); |
2256 | } | 2262 | } |
2257 | else if (GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone, | 2263 | else if (GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone, |
2258 | &local_zone) == 0) | 2264 | &rh->private_local_zone) == 0) |
2259 | { | 2265 | { |
2260 | /* our zone, just append .gnunet */ | 2266 | /* our zone, just append .gnunet */ |
2261 | answer_len = strlen(rh->name) + strlen(GNUNET_GNS_TLD) + 2; | 2267 | answer_len = strlen(rh->name) + strlen(GNUNET_GNS_TLD) + 2; |
@@ -2353,7 +2359,7 @@ handle_delegation_ns_shorten(void* cls, | |||
2353 | "PKEY resolved as far as possible in ns up to %s!\n", rh->name); | 2359 | "PKEY resolved as far as possible in ns up to %s!\n", rh->name); |
2354 | 2360 | ||
2355 | if (GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone, | 2361 | if (GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone, |
2356 | &local_zone) == 0) | 2362 | &rh->private_local_zone) == 0) |
2357 | { | 2363 | { |
2358 | /** | 2364 | /** |
2359 | * This is our zone append .gnunet unless name is empty | 2365 | * This is our zone append .gnunet unless name is empty |
@@ -2498,6 +2504,7 @@ process_zone_to_name_zkey(void *cls, | |||
2498 | * Shorten api from resolver | 2504 | * Shorten api from resolver |
2499 | * | 2505 | * |
2500 | * @param zone the zone to use | 2506 | * @param zone the zone to use |
2507 | * @param pzone the private local zone | ||
2501 | * @param name the name to shorten | 2508 | * @param name the name to shorten |
2502 | * @param key optional private key for background lookups and PSEU import | 2509 | * @param key optional private key for background lookups and PSEU import |
2503 | * @param proc the processor to call with result | 2510 | * @param proc the processor to call with result |
@@ -2505,6 +2512,7 @@ process_zone_to_name_zkey(void *cls, | |||
2505 | */ | 2512 | */ |
2506 | void | 2513 | void |
2507 | gns_resolver_shorten_name(struct GNUNET_CRYPTO_ShortHashCode zone, | 2514 | gns_resolver_shorten_name(struct GNUNET_CRYPTO_ShortHashCode zone, |
2515 | struct GNUNET_CRYPTO_ShortHashCode pzone, | ||
2508 | const char* name, | 2516 | const char* name, |
2509 | struct GNUNET_CRYPTO_RsaPrivateKey *key, | 2517 | struct GNUNET_CRYPTO_RsaPrivateKey *key, |
2510 | ShortenResultProcessor proc, | 2518 | ShortenResultProcessor proc, |
@@ -2541,6 +2549,7 @@ gns_resolver_shorten_name(struct GNUNET_CRYPTO_ShortHashCode zone, | |||
2541 | rh->proc = &handle_delegation_ns_shorten; | 2549 | rh->proc = &handle_delegation_ns_shorten; |
2542 | rh->proc_cls = nsh; | 2550 | rh->proc_cls = nsh; |
2543 | rh->id = rid++; | 2551 | rh->id = rid++; |
2552 | rh->private_local_zone = pzone; | ||
2544 | 2553 | ||
2545 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2554 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2546 | "Checking for TLD...\n"); | 2555 | "Checking for TLD...\n"); |
@@ -2686,12 +2695,14 @@ handle_delegation_result_ns_get_auth(void* cls, | |||
2686 | * in our namestore | 2695 | * in our namestore |
2687 | * | 2696 | * |
2688 | * @param zone the root zone to look up for | 2697 | * @param zone the root zone to look up for |
2698 | * @param pzone the private local zone | ||
2689 | * @param name the name to lookup up | 2699 | * @param name the name to lookup up |
2690 | * @param proc the processor to call when finished | 2700 | * @param proc the processor to call when finished |
2691 | * @param proc_cls the closure to pass to the processor | 2701 | * @param proc_cls the closure to pass to the processor |
2692 | */ | 2702 | */ |
2693 | void | 2703 | void |
2694 | gns_resolver_get_authority(struct GNUNET_CRYPTO_ShortHashCode zone, | 2704 | gns_resolver_get_authority(struct GNUNET_CRYPTO_ShortHashCode zone, |
2705 | struct GNUNET_CRYPTO_ShortHashCode pzone, | ||
2695 | const char* name, | 2706 | const char* name, |
2696 | GetAuthorityResultProcessor proc, | 2707 | GetAuthorityResultProcessor proc, |
2697 | void* proc_cls) | 2708 | void* proc_cls) |
@@ -2706,6 +2717,7 @@ gns_resolver_get_authority(struct GNUNET_CRYPTO_ShortHashCode zone, | |||
2706 | rh = GNUNET_malloc(sizeof (struct ResolverHandle)); | 2717 | rh = GNUNET_malloc(sizeof (struct ResolverHandle)); |
2707 | rh->authority = zone; | 2718 | rh->authority = zone; |
2708 | rh->id = rid++; | 2719 | rh->id = rid++; |
2720 | rh->private_local_zone = pzone; | ||
2709 | 2721 | ||
2710 | if (strcmp(GNUNET_GNS_TLD, name) == 0) | 2722 | if (strcmp(GNUNET_GNS_TLD, name) == 0) |
2711 | { | 2723 | { |