aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-service-gns_resolver.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gns/gnunet-service-gns_resolver.c')
-rw-r--r--src/gns/gnunet-service-gns_resolver.c57
1 files changed, 26 insertions, 31 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index cb75b23c7..1c13f4df1 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -173,7 +173,7 @@ struct AuthorityChain
173 /** 173 /**
174 * The zone of the GNS authority 174 * The zone of the GNS authority
175 */ 175 */
176 struct GNUNET_CRYPTO_EcdsaPublicKey gns_authority; 176 struct GNUNET_IDENTITY_PublicKey gns_authority;
177 177
178 struct 178 struct
179 { 179 {
@@ -305,7 +305,7 @@ struct GNS_ResolverHandle
305 /** 305 /**
306 * The top-level GNS authoritative zone to query 306 * The top-level GNS authoritative zone to query
307 */ 307 */
308 struct GNUNET_CRYPTO_EcdsaPublicKey authority_zone; 308 struct GNUNET_IDENTITY_PublicKey authority_zone;
309 309
310 /** 310 /**
311 * called when resolution phase finishes 311 * called when resolution phase finishes
@@ -1251,7 +1251,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
1251 const char *tld; 1251 const char *tld;
1252 struct AuthorityChain *ac; 1252 struct AuthorityChain *ac;
1253 int af; 1253 int af;
1254 struct GNUNET_CRYPTO_EcdsaPublicKey zone; 1254 struct GNUNET_IDENTITY_PublicKey zone;
1255 1255
1256 nlen = strlen (cname); 1256 nlen = strlen (cname);
1257 tld = GNS_get_tld (cname); 1257 tld = GNS_get_tld (cname);
@@ -1296,7 +1296,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
1296 { 1296 {
1297 GNUNET_asprintf (&res, 1297 GNUNET_asprintf (&res,
1298 "%.*s", 1298 "%.*s",
1299 strlen (cname) - (strlen (tld) + 1), 1299 (int) (strlen (cname) - (strlen (tld) + 1)),
1300 cname); 1300 cname);
1301 } 1301 }
1302 else 1302 else
@@ -1305,7 +1305,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
1305 "%.*s.%.*s", 1305 "%.*s.%.*s",
1306 (int) rh->name_resolution_pos, 1306 (int) rh->name_resolution_pos,
1307 rh->name, 1307 rh->name,
1308 (int) strlen (cname) - (strlen (tld) + 1), 1308 (int) (strlen (cname) - (strlen (tld) + 1)),
1309 cname); 1309 cname);
1310 } 1310 }
1311 rh->name_resolution_pos = strlen (res); 1311 rh->name_resolution_pos = strlen (res);
@@ -1696,10 +1696,11 @@ recursive_pkey_resolution (struct GNS_ResolverHandle *rh,
1696 const struct GNUNET_GNSRECORD_Data *rd) 1696 const struct GNUNET_GNSRECORD_Data *rd)
1697{ 1697{
1698 struct AuthorityChain *ac; 1698 struct AuthorityChain *ac;
1699 struct GNUNET_IDENTITY_PublicKey auth;
1699 1700
1700 /* delegation to another zone */ 1701 /* delegation to another zone */
1701 if (sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) != 1702 if (GNUNET_OK != GNUNET_GNSRECORD_record_to_identity_key (rd,
1702 rd->data_size) 1703 &auth))
1703 { 1704 {
1704 GNUNET_break_op (0); 1705 GNUNET_break_op (0);
1705 fail_resolution (rh); 1706 fail_resolution (rh);
@@ -1709,9 +1710,9 @@ recursive_pkey_resolution (struct GNS_ResolverHandle *rh,
1709 ac = GNUNET_new (struct AuthorityChain); 1710 ac = GNUNET_new (struct AuthorityChain);
1710 ac->rh = rh; 1711 ac->rh = rh;
1711 ac->gns_authority = GNUNET_YES; 1712 ac->gns_authority = GNUNET_YES;
1712 GNUNET_memcpy (&ac->authority_info.gns_authority, 1713 ac->authority_info.gns_authority = auth;
1713 rd->data, 1714 GNUNET_GNSRECORD_record_to_identity_key (rd,
1714 sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); 1715 &ac->authority_info.gns_authority);
1715 ac->label = resolver_lookup_get_next_label (rh); 1716 ac->label = resolver_lookup_get_next_label (rh);
1716 /* add AC to tail */ 1717 /* add AC to tail */
1717 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, 1718 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
@@ -1754,7 +1755,7 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh,
1754 char *n; 1755 char *n;
1755 size_t off; 1756 size_t off;
1756 struct Gns2DnsPending *gp; 1757 struct Gns2DnsPending *gp;
1757 struct GNUNET_CRYPTO_EcdsaPublicKey zone; 1758 struct GNUNET_IDENTITY_PublicKey zone;
1758 struct sockaddr_in v4; 1759 struct sockaddr_in v4;
1759 struct sockaddr_in6 v6; 1760 struct sockaddr_in6 v6;
1760 1761
@@ -2258,16 +2259,11 @@ handle_gns_resolution_result (void *cls,
2258 2259
2259 case GNUNET_GNSRECORD_TYPE_PKEY: 2260 case GNUNET_GNSRECORD_TYPE_PKEY:
2260 { 2261 {
2261 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
2262
2263 if (rd[i].data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) 2262 if (rd[i].data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey))
2264 { 2263 {
2265 GNUNET_break_op (0); 2264 GNUNET_break_op (0);
2266 break; 2265 break;
2267 } 2266 }
2268 GNUNET_memcpy (&pub,
2269 rd[i].data,
2270 rd[i].data_size);
2271 rd_off++; 2267 rd_off++;
2272 if (GNUNET_GNSRECORD_TYPE_PKEY != rh->record_type) 2268 if (GNUNET_GNSRECORD_TYPE_PKEY != rh->record_type)
2273 { 2269 {
@@ -2277,7 +2273,9 @@ handle_gns_resolution_result (void *cls,
2277 ac = GNUNET_new (struct AuthorityChain); 2273 ac = GNUNET_new (struct AuthorityChain);
2278 ac->rh = rh; 2274 ac->rh = rh;
2279 ac->gns_authority = GNUNET_YES; 2275 ac->gns_authority = GNUNET_YES;
2280 ac->authority_info.gns_authority = pub; 2276 GNUNET_GNSRECORD_record_to_identity_key (&rd[i],
2277 &ac->authority_info.
2278 gns_authority);
2281 ac->label = GNUNET_strdup (GNUNET_GNS_EMPTY_LABEL_AT); 2279 ac->label = GNUNET_strdup (GNUNET_GNS_EMPTY_LABEL_AT);
2282 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, 2280 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
2283 rh->ac_tail, 2281 rh->ac_tail,
@@ -2469,10 +2467,7 @@ handle_dht_response (void *cls,
2469 return; 2467 return;
2470 } 2468 }
2471 block = data; 2469 block = data;
2472 if (size != 2470 if (size != GNUNET_GNSRECORD_block_get_size (block))
2473 ntohl (block->purpose.size)
2474 + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)
2475 + sizeof(struct GNUNET_CRYPTO_EcdsaSignature))
2476 { 2471 {
2477 /* how did this pass DHT block validation!? */ 2472 /* how did this pass DHT block validation!? */
2478 GNUNET_break (0); 2473 GNUNET_break (0);
@@ -2480,8 +2475,8 @@ handle_dht_response (void *cls,
2480 return; 2475 return;
2481 } 2476 }
2482 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2477 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2483 "Decrypting DHT block of size %u for `%s', expires %s\n", 2478 "Decrypting DHT block of size %lu for `%s', expires %s\n",
2484 ntohl (block->purpose.size), 2479 GNUNET_GNSRECORD_block_get_size (block),
2485 rh->name, 2480 rh->name,
2486 GNUNET_STRINGS_absolute_time_to_string (exp)); 2481 GNUNET_STRINGS_absolute_time_to_string (exp));
2487 if (GNUNET_OK != 2482 if (GNUNET_OK !=
@@ -2495,8 +2490,8 @@ handle_dht_response (void *cls,
2495 fail_resolution (rh); 2490 fail_resolution (rh);
2496 return; 2491 return;
2497 } 2492 }
2498 if (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh ( 2493 if (0 == GNUNET_TIME_absolute_get_remaining (
2499 block->expiration_time)). 2494 GNUNET_GNSRECORD_block_get_expiration (block)).
2500 rel_value_us) 2495 rel_value_us)
2501 { 2496 {
2502 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2497 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -2594,7 +2589,7 @@ handle_namecache_block_response (void *cls,
2594 struct GNS_ResolverHandle *rh = cls; 2589 struct GNS_ResolverHandle *rh = cls;
2595 struct AuthorityChain *ac = rh->ac_tail; 2590 struct AuthorityChain *ac = rh->ac_tail;
2596 const char *label = ac->label; 2591 const char *label = ac->label;
2597 const struct GNUNET_CRYPTO_EcdsaPublicKey *auth = 2592 const struct GNUNET_IDENTITY_PublicKey *auth =
2598 &ac->authority_info.gns_authority; 2593 &ac->authority_info.gns_authority;
2599 struct GNUNET_HashCode query; 2594 struct GNUNET_HashCode query;
2600 2595
@@ -2604,8 +2599,8 @@ handle_namecache_block_response (void *cls,
2604 ((GNUNET_GNS_LO_LOCAL_MASTER == rh->options) && 2599 ((GNUNET_GNS_LO_LOCAL_MASTER == rh->options) &&
2605 (ac != rh->ac_head))) && 2600 (ac != rh->ac_head))) &&
2606 ((NULL == block) || 2601 ((NULL == block) ||
2607 (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh ( 2602 (0 == GNUNET_TIME_absolute_get_remaining (
2608 block->expiration_time)). 2603 GNUNET_GNSRECORD_block_get_expiration (block)).
2609 rel_value_us))) 2604 rel_value_us)))
2610 { 2605 {
2611 /* namecache knows nothing; try DHT lookup */ 2606 /* namecache knows nothing; try DHT lookup */
@@ -2622,8 +2617,8 @@ handle_namecache_block_response (void *cls,
2622 } 2617 }
2623 2618
2624 if ((NULL == block) || 2619 if ((NULL == block) ||
2625 (0 == GNUNET_TIME_absolute_get_remaining (GNUNET_TIME_absolute_ntoh ( 2620 (0 == GNUNET_TIME_absolute_get_remaining (
2626 block->expiration_time)). 2621 GNUNET_GNSRECORD_block_get_expiration (block)).
2627 rel_value_us)) 2622 rel_value_us))
2628 { 2623 {
2629 /* DHT not permitted and no local result, fail */ 2624 /* DHT not permitted and no local result, fail */
@@ -2857,7 +2852,7 @@ start_resolver_lookup (void *cls)
2857 * @return handle to cancel operation 2852 * @return handle to cancel operation
2858 */ 2853 */
2859struct GNS_ResolverHandle * 2854struct GNS_ResolverHandle *
2860GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, 2855GNS_resolver_lookup (const struct GNUNET_IDENTITY_PublicKey *zone,
2861 uint32_t record_type, 2856 uint32_t record_type,
2862 const char *name, 2857 const char *name,
2863 enum GNUNET_GNS_LocalOptions options, 2858 enum GNUNET_GNS_LocalOptions options,