diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-10-22 19:09:12 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-10-22 19:09:12 +0200 |
commit | ea1d3fd9f54879992fb997a1e94cfd6830085c4b (patch) | |
tree | 7a3fb2ad932a6ab0df3ae6bc5d5fea30575f5171 /src/gns/gnunet-service-gns_resolver.c | |
parent | acc69a8e5c921e5bbb03260383936487ec9ce0ca (diff) | |
download | gnunet-ea1d3fd9f54879992fb997a1e94cfd6830085c4b.tar.gz gnunet-ea1d3fd9f54879992fb997a1e94cfd6830085c4b.zip |
-more gnsrecord API
Diffstat (limited to 'src/gns/gnunet-service-gns_resolver.c')
-rw-r--r-- | src/gns/gnunet-service-gns_resolver.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 1c13f4df1..d9d0d3099 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -1699,8 +1699,10 @@ recursive_pkey_resolution (struct GNS_ResolverHandle *rh, | |||
1699 | struct GNUNET_IDENTITY_PublicKey auth; | 1699 | struct GNUNET_IDENTITY_PublicKey auth; |
1700 | 1700 | ||
1701 | /* delegation to another zone */ | 1701 | /* delegation to another zone */ |
1702 | if (GNUNET_OK != GNUNET_GNSRECORD_record_to_identity_key (rd, | 1702 | if (GNUNET_OK != GNUNET_GNSRECORD_identity_from_data (rd->data, |
1703 | &auth)) | 1703 | rd->data_size, |
1704 | rd->record_type, | ||
1705 | &auth)) | ||
1704 | { | 1706 | { |
1705 | GNUNET_break_op (0); | 1707 | GNUNET_break_op (0); |
1706 | fail_resolution (rh); | 1708 | fail_resolution (rh); |
@@ -1711,8 +1713,6 @@ recursive_pkey_resolution (struct GNS_ResolverHandle *rh, | |||
1711 | ac->rh = rh; | 1713 | ac->rh = rh; |
1712 | ac->gns_authority = GNUNET_YES; | 1714 | ac->gns_authority = GNUNET_YES; |
1713 | ac->authority_info.gns_authority = auth; | 1715 | ac->authority_info.gns_authority = auth; |
1714 | GNUNET_GNSRECORD_record_to_identity_key (rd, | ||
1715 | &ac->authority_info.gns_authority); | ||
1716 | ac->label = resolver_lookup_get_next_label (rh); | 1716 | ac->label = resolver_lookup_get_next_label (rh); |
1717 | /* add AC to tail */ | 1717 | /* add AC to tail */ |
1718 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, | 1718 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, |
@@ -2258,14 +2258,25 @@ handle_gns_resolution_result (void *cls, | |||
2258 | break; | 2258 | break; |
2259 | 2259 | ||
2260 | case GNUNET_GNSRECORD_TYPE_PKEY: | 2260 | case GNUNET_GNSRECORD_TYPE_PKEY: |
2261 | case GNUNET_GNSRECORD_TYPE_EDKEY: | ||
2261 | { | 2262 | { |
2262 | if (rd[i].data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) | 2263 | struct GNUNET_IDENTITY_PublicKey pubkey; |
2264 | if (rd[i].data_size < sizeof(uint32_t)) | ||
2265 | { | ||
2266 | GNUNET_break_op (0); | ||
2267 | break; | ||
2268 | } | ||
2269 | if (GNUNET_OK != | ||
2270 | GNUNET_GNSRECORD_identity_from_data (rd[i].data, | ||
2271 | rd[i].data_size, | ||
2272 | rd[i].record_type, | ||
2273 | &pubkey)) | ||
2263 | { | 2274 | { |
2264 | GNUNET_break_op (0); | 2275 | GNUNET_break_op (0); |
2265 | break; | 2276 | break; |
2266 | } | 2277 | } |
2267 | rd_off++; | 2278 | rd_off++; |
2268 | if (GNUNET_GNSRECORD_TYPE_PKEY != rh->record_type) | 2279 | if (rd[i].record_type != rh->record_type) |
2269 | { | 2280 | { |
2270 | /* try to resolve "@" */ | 2281 | /* try to resolve "@" */ |
2271 | struct AuthorityChain *ac; | 2282 | struct AuthorityChain *ac; |
@@ -2273,9 +2284,7 @@ handle_gns_resolution_result (void *cls, | |||
2273 | ac = GNUNET_new (struct AuthorityChain); | 2284 | ac = GNUNET_new (struct AuthorityChain); |
2274 | ac->rh = rh; | 2285 | ac->rh = rh; |
2275 | ac->gns_authority = GNUNET_YES; | 2286 | ac->gns_authority = GNUNET_YES; |
2276 | GNUNET_GNSRECORD_record_to_identity_key (&rd[i], | 2287 | ac->authority_info.gns_authority = pubkey; |
2277 | &ac->authority_info. | ||
2278 | gns_authority); | ||
2279 | ac->label = GNUNET_strdup (GNUNET_GNS_EMPTY_LABEL_AT); | 2288 | ac->label = GNUNET_strdup (GNUNET_GNS_EMPTY_LABEL_AT); |
2280 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, | 2289 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, |
2281 | rh->ac_tail, | 2290 | rh->ac_tail, |
@@ -2365,6 +2374,7 @@ handle_gns_resolution_result (void *cls, | |||
2365 | return; | 2374 | return; |
2366 | 2375 | ||
2367 | case GNUNET_GNSRECORD_TYPE_PKEY: | 2376 | case GNUNET_GNSRECORD_TYPE_PKEY: |
2377 | case GNUNET_GNSRECORD_TYPE_EDKEY: | ||
2368 | GNUNET_break_op (1 == rd_count); /* PKEY should be unique */ | 2378 | GNUNET_break_op (1 == rd_count); /* PKEY should be unique */ |
2369 | recursive_pkey_resolution (rh, | 2379 | recursive_pkey_resolution (rh, |
2370 | &rd[0]); | 2380 | &rd[0]); |