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 | |
parent | 6143cf95a47f8ec7de7898a416557f5034c36b27 (diff) | |
download | gnunet-b4a29413ffa9cf01043a10747498e79455e1aa7f.tar.gz gnunet-b4a29413ffa9cf01043a10747498e79455e1aa7f.zip |
-fixes
Diffstat (limited to 'src/gns')
-rw-r--r-- | src/gns/gnunet-service-gns.c | 10 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_interceptor.c | 2 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 20 | ||||
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.h | 9 |
4 files changed, 31 insertions, 10 deletions
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index 6e157ca4b..9caa52c26 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c | |||
@@ -605,11 +605,11 @@ static void handle_shorten(void *cls, | |||
605 | key = lookup_private_key(&sh_msg->zone); | 605 | key = lookup_private_key(&sh_msg->zone); |
606 | csh->zone_key = key; | 606 | csh->zone_key = key; |
607 | } | 607 | } |
608 | gns_resolver_shorten_name(zone, name, key, | 608 | gns_resolver_shorten_name(zone, zone, name, key, |
609 | &send_shorten_response, csh); | 609 | &send_shorten_response, csh); |
610 | } | 610 | } |
611 | else | 611 | else |
612 | gns_resolver_shorten_name(zone, name, NULL, | 612 | gns_resolver_shorten_name(zone, zone, name, NULL, |
613 | &send_shorten_response, csh); | 613 | &send_shorten_response, csh); |
614 | } | 614 | } |
615 | 615 | ||
@@ -751,7 +751,7 @@ static void handle_get_authority(void *cls, | |||
751 | strlen(name)-strlen(GNUNET_GNS_TLD)); | 751 | strlen(name)-strlen(GNUNET_GNS_TLD)); |
752 | 752 | ||
753 | /* Start delegation resolution in our namestore */ | 753 | /* Start delegation resolution in our namestore */ |
754 | gns_resolver_get_authority(zone_hash, name, &send_get_auth_response, cah); | 754 | gns_resolver_get_authority(zone_hash, zone_hash, name, &send_get_auth_response, cah); |
755 | } | 755 | } |
756 | 756 | ||
757 | 757 | ||
@@ -878,14 +878,14 @@ handle_lookup(void *cls, | |||
878 | clh->zone_key = key; | 878 | clh->zone_key = key; |
879 | } | 879 | } |
880 | 880 | ||
881 | gns_resolver_lookup_record(zone, clh->type, name, | 881 | gns_resolver_lookup_record(zone, zone, clh->type, name, |
882 | key, | 882 | key, |
883 | default_lookup_timeout, | 883 | default_lookup_timeout, |
884 | &send_lookup_response, clh); | 884 | &send_lookup_response, clh); |
885 | } | 885 | } |
886 | else | 886 | else |
887 | { | 887 | { |
888 | gns_resolver_lookup_record(zone, clh->type, name, | 888 | gns_resolver_lookup_record(zone, zone, clh->type, name, |
889 | NULL, | 889 | NULL, |
890 | default_lookup_timeout, | 890 | default_lookup_timeout, |
891 | &send_lookup_response, clh); | 891 | &send_lookup_response, clh); |
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c index b3ecdfdf9..adb09ca7f 100644 --- a/src/gns/gnunet-service-gns_interceptor.c +++ b/src/gns/gnunet-service-gns_interceptor.c | |||
@@ -243,7 +243,7 @@ start_resolution_for_dns(struct GNUNET_DNS_RequestHandle *request, | |||
243 | ilh->request_handle = request; | 243 | ilh->request_handle = request; |
244 | 244 | ||
245 | /* Start resolution in our zone */ | 245 | /* Start resolution in our zone */ |
246 | gns_resolver_lookup_record(our_zone, q->type, q->name, | 246 | gns_resolver_lookup_record(our_zone, our_zone, q->type, q->name, |
247 | our_key, | 247 | our_key, |
248 | default_lookup_timeout, | 248 | default_lookup_timeout, |
249 | &reply_to_dns, ilh); | 249 | &reply_to_dns, ilh); |
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 | { |
diff --git a/src/gns/gnunet-service-gns_resolver.h b/src/gns/gnunet-service-gns_resolver.h index 44c10fc52..8222397c4 100644 --- a/src/gns/gnunet-service-gns_resolver.h +++ b/src/gns/gnunet-service-gns_resolver.h | |||
@@ -150,6 +150,9 @@ struct ResolverHandle | |||
150 | /* status of the resolution result */ | 150 | /* status of the resolution result */ |
151 | enum ResolutionStatus status; | 151 | enum ResolutionStatus status; |
152 | 152 | ||
153 | /* The provate local zone of this request */ | ||
154 | struct GNUNET_CRYPTO_ShortHashCode private_local_zone; | ||
155 | |||
153 | /** | 156 | /** |
154 | * private key of an/our authoritative zone | 157 | * private key of an/our authoritative zone |
155 | * can be NULL but automatical PKEY import will not work | 158 | * can be NULL but automatical PKEY import will not work |
@@ -276,6 +279,7 @@ gns_resolver_cleanup(ResolverCleanupContinuation cont); | |||
276 | * calls RecordLookupProcessor on result or timeout | 279 | * calls RecordLookupProcessor on result or timeout |
277 | * | 280 | * |
278 | * @param zone the root zone | 281 | * @param zone the root zone |
282 | * @param pzone the private local zone | ||
279 | * @param record_type the record type to look up | 283 | * @param record_type the record type to look up |
280 | * @param name the name to look up | 284 | * @param name the name to look up |
281 | * @param key optional private key for authority caching | 285 | * @param key optional private key for authority caching |
@@ -285,6 +289,7 @@ gns_resolver_cleanup(ResolverCleanupContinuation cont); | |||
285 | */ | 289 | */ |
286 | void | 290 | void |
287 | gns_resolver_lookup_record(struct GNUNET_CRYPTO_ShortHashCode zone, | 291 | gns_resolver_lookup_record(struct GNUNET_CRYPTO_ShortHashCode zone, |
292 | struct GNUNET_CRYPTO_ShortHashCode pzone, | ||
288 | uint32_t record_type, | 293 | uint32_t record_type, |
289 | const char* name, | 294 | const char* name, |
290 | struct GNUNET_CRYPTO_RsaPrivateKey *key, | 295 | struct GNUNET_CRYPTO_RsaPrivateKey *key, |
@@ -300,6 +305,7 @@ gns_resolver_lookup_record(struct GNUNET_CRYPTO_ShortHashCode zone, | |||
300 | * actually be canonical/short etc. | 305 | * actually be canonical/short etc. |
301 | * | 306 | * |
302 | * @param zone the zone to perform the operation in | 307 | * @param zone the zone to perform the operation in |
308 | * @param pzone the private local zone | ||
303 | * @param name name to shorten | 309 | * @param name name to shorten |
304 | * @param key optional private key for background lookups and PSEU import | 310 | * @param key optional private key for background lookups and PSEU import |
305 | * @param proc the processor to call on shorten result | 311 | * @param proc the processor to call on shorten result |
@@ -307,6 +313,7 @@ gns_resolver_lookup_record(struct GNUNET_CRYPTO_ShortHashCode zone, | |||
307 | */ | 313 | */ |
308 | void | 314 | void |
309 | gns_resolver_shorten_name(struct GNUNET_CRYPTO_ShortHashCode zone, | 315 | gns_resolver_shorten_name(struct GNUNET_CRYPTO_ShortHashCode zone, |
316 | struct GNUNET_CRYPTO_ShortHashCode pzone, | ||
310 | const char* name, | 317 | const char* name, |
311 | struct GNUNET_CRYPTO_RsaPrivateKey *key, | 318 | struct GNUNET_CRYPTO_RsaPrivateKey *key, |
312 | ShortenResultProcessor proc, | 319 | ShortenResultProcessor proc, |
@@ -317,12 +324,14 @@ gns_resolver_shorten_name(struct GNUNET_CRYPTO_ShortHashCode zone, | |||
317 | * in our namestore | 324 | * in our namestore |
318 | * | 325 | * |
319 | * @param zone the root zone to look up for | 326 | * @param zone the root zone to look up for |
327 | * @param pzone the private local zone | ||
320 | * @param name the name to lookup up | 328 | * @param name the name to lookup up |
321 | * @param proc the processor to call when finished | 329 | * @param proc the processor to call when finished |
322 | * @param proc_cls the closure to pass to the processor | 330 | * @param proc_cls the closure to pass to the processor |
323 | */ | 331 | */ |
324 | void | 332 | void |
325 | gns_resolver_get_authority(struct GNUNET_CRYPTO_ShortHashCode zone, | 333 | gns_resolver_get_authority(struct GNUNET_CRYPTO_ShortHashCode zone, |
334 | struct GNUNET_CRYPTO_ShortHashCode pzone, | ||
326 | const char* name, | 335 | const char* name, |
327 | GetAuthorityResultProcessor proc, | 336 | GetAuthorityResultProcessor proc, |
328 | void* proc_cls); | 337 | void* proc_cls); |