aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gns/gnunet-service-gns.c11
-rw-r--r--src/gns/gnunet-service-gns_resolver.c314
-rw-r--r--src/gns/gnunet-service-gns_resolver.h6
-rw-r--r--src/gns/test_gns_revocation.c2
4 files changed, 210 insertions, 123 deletions
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index 1618e27ef..63b180b4b 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -194,7 +194,7 @@ static void
194on_resolver_cleanup(void) 194on_resolver_cleanup(void)
195{ 195{
196 GNUNET_NAMESTORE_disconnect(namestore_handle, 1); 196 GNUNET_NAMESTORE_disconnect(namestore_handle, 1);
197 GNUNET_DHT_disconnect(dht_handle); 197
198} 198}
199 199
200/** 200/**
@@ -209,15 +209,16 @@ shutdown_task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
209 209
210 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 210 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
211 "Shutting down!"); 211 "Shutting down!");
212 /* Kill zone task for it may make the scheduler hang */ 212
213 if (zone_update_taskid != GNUNET_SCHEDULER_NO_TASK)
214 GNUNET_SCHEDULER_cancel(zone_update_taskid);
215 213
216 GNUNET_SERVER_notification_context_destroy (nc); 214 GNUNET_SERVER_notification_context_destroy (nc);
217 215
218 gns_interceptor_stop(); 216 gns_interceptor_stop();
219 gns_resolver_cleanup(&on_resolver_cleanup); 217 gns_resolver_cleanup(&on_resolver_cleanup);
220 218 /* Kill zone task for it may make the scheduler hang */
219 if (zone_update_taskid != GNUNET_SCHEDULER_NO_TASK)
220 GNUNET_SCHEDULER_cancel(zone_update_taskid);
221 GNUNET_DHT_disconnect(dht_handle);
221} 222}
222 223
223 224
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index c09bcca90..b6bc5eb1d 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -81,6 +81,16 @@ static int ignore_pending_records;
81static struct GNUNET_CRYPTO_ShortHashCode local_zone; 81static struct GNUNET_CRYPTO_ShortHashCode local_zone;
82 82
83/** 83/**
84 * Background shortening handles
85 */
86static struct GetPseuAuthorityHandle *gph_head;
87
88/**
89 * Background shortening handles
90 */
91static struct GetPseuAuthorityHandle *gph_tail;
92
93/**
84 * a resolution identifier pool variable 94 * a resolution identifier pool variable
85 * FIXME overflow? 95 * FIXME overflow?
86 * This is a non critical identifier useful for debugging 96 * This is a non critical identifier useful for debugging
@@ -173,7 +183,7 @@ process_pseu_lookup_ns (void* cls,
173 gph->ahead = iter; 183 gph->ahead = iter;
174 } while (iter != NULL); 184 } while (iter != NULL);
175 GNUNET_CRYPTO_rsa_key_free (gph->key); 185 GNUNET_CRYPTO_rsa_key_free (gph->key);
176 186 GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph);
177 GNUNET_free (gph); 187 GNUNET_free (gph);
178 return; 188 return;
179 } 189 }
@@ -214,6 +224,7 @@ process_pseu_lookup_ns (void* cls,
214 gph->ahead = iter; 224 gph->ahead = iter;
215 } while (iter != NULL); 225 } while (iter != NULL);
216 GNUNET_CRYPTO_rsa_key_free (gph->key); 226 GNUNET_CRYPTO_rsa_key_free (gph->key);
227 GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph);
217 GNUNET_free (gph); 228 GNUNET_free (gph);
218 229
219} 230}
@@ -323,6 +334,12 @@ process_auth_discovery_dht_result(void* cls,
323 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 334 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
324 "GNS_GET_AUTH: got dht result (size=%d)\n", size); 335 "GNS_GET_AUTH: got dht result (size=%d)\n", size);
325 336
337
338 /* stop lookup and timeout task */
339 GNUNET_DHT_get_stop (gph->get_handle);
340 gph->get_handle = NULL;
341 GNUNET_SCHEDULER_cancel (gph->timeout);
342
326 if (data == NULL) 343 if (data == NULL)
327 { 344 {
328 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 345 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -335,18 +352,14 @@ process_auth_discovery_dht_result(void* cls,
335 gph->ahead = iter; 352 gph->ahead = iter;
336 } while (iter != NULL); 353 } while (iter != NULL);
337 GNUNET_CRYPTO_rsa_key_free (gph->key); 354 GNUNET_CRYPTO_rsa_key_free (gph->key);
355 GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph);
338 GNUNET_free (gph); 356 GNUNET_free (gph);
339 return; 357 return;
340 } 358 }
341 359
342 nrb = (struct GNSNameRecordBlock*)data; 360 nrb = (struct GNSNameRecordBlock*)data;
343 361
344 /* stop lookup and timeout task */
345 GNUNET_DHT_get_stop (gph->get_handle);
346 gph->get_handle = NULL;
347 GNUNET_SCHEDULER_cancel (gph->timeout);
348 362
349 gph->get_handle = NULL;
350 363
351 nrb = (struct GNSNameRecordBlock*)data; 364 nrb = (struct GNSNameRecordBlock*)data;
352 365
@@ -534,6 +547,7 @@ process_zone_to_name_discover (void *cls,
534 gph->ahead = iter; 547 gph->ahead = iter;
535 } while (iter != NULL); 548 } while (iter != NULL);
536 GNUNET_CRYPTO_rsa_key_free (gph->key); 549 GNUNET_CRYPTO_rsa_key_free (gph->key);
550 GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, gph);
537 GNUNET_free (gph); 551 GNUNET_free (gph);
538 } 552 }
539 else 553 else
@@ -606,6 +620,8 @@ start_shorten (struct AuthorityChain *atail,
606 &gph->our_zone); 620 &gph->our_zone);
607 gph->ahead = new_head; 621 gph->ahead = new_head;
608 622
623 GNUNET_CONTAINER_DLL_insert (gph_head, gph_tail, gph);
624
609 shorten_authority_chain (gph); 625 shorten_authority_chain (gph);
610} 626}
611 627
@@ -636,6 +652,9 @@ gns_resolver_init(struct GNUNET_NAMESTORE_Handle *nh,
636 max_allowed_background_queries = max_bg_queries; 652 max_allowed_background_queries = max_bg_queries;
637 ignore_pending_records = ignore_pending; 653 ignore_pending_records = ignore_pending;
638 654
655 gph_head = NULL;
656 gph_tail = NULL;
657
639 GNUNET_RESOLVER_connect (cfg); 658 GNUNET_RESOLVER_connect (cfg);
640 659
641 if (NULL == vpn_handle) 660 if (NULL == vpn_handle)
@@ -700,9 +719,36 @@ void
700gns_resolver_cleanup(ResolverCleanupContinuation cont) 719gns_resolver_cleanup(ResolverCleanupContinuation cont)
701{ 720{
702 unsigned int s = GNUNET_CONTAINER_heap_get_size(dht_lookup_heap); 721 unsigned int s = GNUNET_CONTAINER_heap_get_size(dht_lookup_heap);
722 struct GetPseuAuthorityHandle *tmp;
723 struct AuthorityChain *iter;
724
703 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 725 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
704 "GNS_CLEANUP: %d pending background queries to terminate\n", s); 726 "GNS_CLEANUP: %d pending background queries to terminate\n", s);
705 727
728 tmp = gph_head;
729 for (tmp = gph_head; tmp != NULL; tmp = gph_head)
730 {
731 if (tmp->get_handle != NULL)
732 GNUNET_DHT_get_stop (tmp->get_handle);
733 tmp->get_handle = NULL;
734 if (tmp->timeout != GNUNET_SCHEDULER_NO_TASK)
735 GNUNET_SCHEDULER_cancel (tmp->timeout);
736 tmp->timeout = GNUNET_SCHEDULER_NO_TASK;
737
738 iter = tmp->ahead;
739 do
740 {
741 iter = tmp->ahead->next;
742 GNUNET_free (tmp->ahead);
743 tmp->ahead = iter;
744 } while (iter != NULL);
745
746 GNUNET_CRYPTO_rsa_key_free (tmp->key);
747 GNUNET_CONTAINER_DLL_remove (gph_head, gph_tail, tmp);
748 GNUNET_free (tmp);
749 }
750
751
706 if (0 != s) 752 if (0 != s)
707 GNUNET_CONTAINER_heap_iterate (dht_lookup_heap, 753 GNUNET_CONTAINER_heap_iterate (dht_lookup_heap,
708 &cleanup_pending_background_queries, 754 &cleanup_pending_background_queries,
@@ -794,7 +840,7 @@ background_lookup_result_processor(void *cls,
794{ 840{
795 //We could do sth verbose/more useful here but it doesn't make any difference 841 //We could do sth verbose/more useful here but it doesn't make any difference
796 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 842 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
797 "GNS_BG: background dht lookup for finished. (%d results)\n", 843 "GNS_BG: background dht lookup finished. (%d results)\n",
798 rd_count); 844 rd_count);
799} 845}
800 846
@@ -882,9 +928,6 @@ process_record_result_dht(void* cls,
882 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 928 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
883 "GNS_PHASE_REC-%d: got dht result (size=%d)\n", rh->id, size); 929 "GNS_PHASE_REC-%d: got dht result (size=%d)\n", rh->id, size);
884 930
885 if (data == NULL)
886 return;
887
888 //FIXME maybe check expiration here, check block type 931 //FIXME maybe check expiration here, check block type
889 932
890 933
@@ -932,8 +975,8 @@ process_record_result_dht(void* cls,
932 "GNS_PHASE_REC-%d: Got name: %s (wanted %s)\n", 975 "GNS_PHASE_REC-%d: Got name: %s (wanted %s)\n",
933 rh->id, name, rh->name); 976 rh->id, name, rh->name);
934 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 977 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
935 "GNS_PHASE_REC-%d: Got type: %d\n", 978 "GNS_PHASE_REC-%d: Got type: %d (wanted %d)\n",
936 rh->id, rd[i].record_type); 979 rh->id, rd[i].record_type, rlh->record_type);
937 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 980 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
938 "GNS_PHASE_REC-%d: Got data length: %d\n", 981 "GNS_PHASE_REC-%d: Got data length: %d\n",
939 rh->id, rd[i].data_size); 982 rh->id, rd[i].data_size);
@@ -982,7 +1025,7 @@ process_record_result_dht(void* cls,
982 * @param rh the pending gns query context 1025 * @param rh the pending gns query context
983 */ 1026 */
984static void 1027static void
985resolve_record_dht(struct ResolverHandle *rh) 1028resolve_record_dht (struct ResolverHandle *rh)
986{ 1029{
987 uint32_t xquery; 1030 uint32_t xquery;
988 struct GNUNET_CRYPTO_ShortHashCode name_hash; 1031 struct GNUNET_CRYPTO_ShortHashCode name_hash;
@@ -1108,11 +1151,11 @@ process_record_result_ns(void* cls,
1108 if (name != NULL) 1151 if (name != NULL)
1109 { 1152 {
1110 rh->status |= RSL_RECORD_EXISTS; 1153 rh->status |= RSL_RECORD_EXISTS;
1111 }
1112 1154
1113 if (remaining_time.rel_value == 0) 1155 if (remaining_time.rel_value == 0)
1114 { 1156 {
1115 rh->status |= RSL_RECORD_EXPIRED; 1157 rh->status |= RSL_RECORD_EXPIRED;
1158 }
1116 } 1159 }
1117 1160
1118 if (rd_count == 0) 1161 if (rd_count == 0)
@@ -1624,8 +1667,8 @@ resolve_record_dns (struct ResolverHandle *rh,
1624 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1667 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1625 "GNS_PHASE_REC_DNS-%llu: Trying to shorten authority chain\n", 1668 "GNS_PHASE_REC_DNS-%llu: Trying to shorten authority chain\n",
1626 rh->id); 1669 rh->id);
1627 start_shorten (rh->authority_chain_tail, 1670 start_shorten (rh->authority_chain_tail,
1628 rh->priv_key); 1671 rh->priv_key);
1629 } 1672 }
1630 1673
1631 for (i = 0; i < rd_count; i++) 1674 for (i = 0; i < rd_count; i++)
@@ -1751,8 +1794,8 @@ resolve_record_vpn (struct ResolverHandle *rh,
1751 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1794 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1752 "GNS_PHASE_REC_VPN-%llu: Trying to shorten authority chain\n", 1795 "GNS_PHASE_REC_VPN-%llu: Trying to shorten authority chain\n",
1753 rh->id); 1796 rh->id);
1754 start_shorten (rh->authority_chain_tail, 1797 start_shorten (rh->authority_chain_tail,
1755 rh->priv_key); 1798 rh->priv_key);
1756 } 1799 }
1757 1800
1758 /* Extracting VPN information FIXME rd parsing with NS API?*/ 1801 /* Extracting VPN information FIXME rd parsing with NS API?*/
@@ -1835,8 +1878,8 @@ resolve_record_ns(struct ResolverHandle *rh)
1835 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1878 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1836 "GNS_PHASE_REC-%llu: Trying to shorten authority chain\n", 1879 "GNS_PHASE_REC-%llu: Trying to shorten authority chain\n",
1837 rh->id); 1880 rh->id);
1838 start_shorten (rh->authority_chain_tail, 1881 start_shorten (rh->authority_chain_tail,
1839 rh->priv_key); 1882 rh->priv_key);
1840 } 1883 }
1841 1884
1842 /** 1885 /**
@@ -1880,6 +1923,15 @@ dht_authority_lookup_timeout(void *cls,
1880 GNUNET_DHT_get_stop (rh->get_handle); 1923 GNUNET_DHT_get_stop (rh->get_handle);
1881 rh->get_handle = NULL; 1924 rh->get_handle = NULL;
1882 1925
1926 if (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)
1927 {
1928 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
1929 "GNS_PHASE_DELEGATE_DHT-%llu: Got shutdown\n",
1930 rh->id);
1931 rh->proc(rh->proc_cls, rh, 0, NULL);
1932 return;
1933 }
1934
1883 if (strcmp(rh->name, "") == 0) 1935 if (strcmp(rh->name, "") == 0)
1884 { 1936 {
1885 /* 1937 /*
@@ -1940,6 +1992,84 @@ handle_delegation_ns(void* cls, struct ResolverHandle *rh,
1940 1992
1941 1993
1942/** 1994/**
1995 * This is a callback function that checks for key revocation
1996 *
1997 * @param cls the pending query
1998 * @param key the key of the zone we did the lookup
1999 * @param expiration expiration date of the record data set in the namestore
2000 * @param name the name for which we need an authority
2001 * @param rd_count the number of records with 'name'
2002 * @param rd the record data
2003 * @param signature the signature of the authority for the record data
2004 */
2005static void
2006process_pkey_revocation_result_ns (void *cls,
2007 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *key,
2008 struct GNUNET_TIME_Absolute expiration,
2009 const char *name,
2010 unsigned int rd_count,
2011 const struct GNUNET_NAMESTORE_RecordData *rd,
2012 const struct GNUNET_CRYPTO_RsaSignature *signature)
2013{
2014 struct ResolverHandle *rh = cls;
2015 struct GNUNET_TIME_Relative remaining_time;
2016 int i;
2017
2018 remaining_time = GNUNET_TIME_absolute_get_remaining (expiration);
2019
2020 for (i = 0; i < rd_count; i++)
2021 {
2022 if (rd[i].record_type == GNUNET_GNS_RECORD_REV)
2023 {
2024 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
2025 "GNS_PHASE_DELEGATE_REV-%llu: Zone has been revoked.\n",
2026 rh->id);
2027 rh->status |= RSL_PKEY_REVOKED;
2028 rh->proc (rh->proc_cls, rh, 0, NULL);
2029 return;
2030 }
2031 }
2032
2033 if ((name == NULL) ||
2034 (remaining_time.rel_value == 0))
2035 {
2036 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
2037 "GNS_PHASE_DELEGATE_REV-%llu: + Records don't exist or are expired.\n",
2038 rh->id, name);
2039
2040 if (rh->timeout.rel_value != GNUNET_TIME_UNIT_FOREVER_REL.rel_value)
2041 {
2042 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
2043 "GNS_PHASE_DELEGATE_REV-%d: Starting background lookup for %s type %d\n",
2044 rh->id, "+.gnunet", GNUNET_GNS_RECORD_REV);
2045
2046 gns_resolver_lookup_record(rh->authority,
2047 rh->private_local_zone,
2048 GNUNET_GNS_RECORD_REV,
2049 GNUNET_GNS_TLD,
2050 rh->priv_key,
2051 GNUNET_TIME_UNIT_FOREVER_REL,
2052 GNUNET_NO,
2053 &background_lookup_result_processor,
2054 NULL);
2055 }
2056 }
2057 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
2058 "GNS_PHASE_DELEGATE_REV-%llu: Revocation checkpassed\n",
2059 rh->id);
2060 /**
2061 * We are done with PKEY resolution if name is empty
2062 * else resolve again with new authority
2063 */
2064 if (strcmp (rh->name, "") == 0)
2065 rh->proc (rh->proc_cls, rh, 0, NULL);
2066 else
2067 resolve_delegation_ns (rh);
2068 return;
2069}
2070
2071
2072/**
1943 * Function called when we get a result from the dht 2073 * Function called when we get a result from the dht
1944 * for our query. Recursively tries to resolve authorities 2074 * for our query. Recursively tries to resolve authorities
1945 * for name in DHT. 2075 * for name in DHT.
@@ -2109,7 +2239,7 @@ process_delegation_result_dht(void* cls,
2109 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 2239 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
2110 "GNS_PHASE_DELEGATE_DHT-%llu: Answer from DHT for %s. Yet to resolve: %s\n", 2240 "GNS_PHASE_DELEGATE_DHT-%llu: Answer from DHT for %s. Yet to resolve: %s\n",
2111 rh->id, rh->authority_name, rh->name); 2241 rh->id, rh->authority_name, rh->name);
2112 2242
2113 if (strcmp(rh->name, "") == 0) 2243 if (strcmp(rh->name, "") == 0)
2114 { 2244 {
2115 /* Start shortening */ 2245 /* Start shortening */
@@ -2121,6 +2251,28 @@ process_delegation_result_dht(void* cls,
2121 start_shorten (rh->authority_chain_tail, 2251 start_shorten (rh->authority_chain_tail,
2122 rh->priv_key); 2252 rh->priv_key);
2123 } 2253 }
2254 }
2255 else
2256 rh->proc = &handle_delegation_ns;
2257
2258 /* Check for key revocation and delegate */
2259 GNUNET_NAMESTORE_lookup_record (namestore_handle,
2260 &rh->authority,
2261 "+",
2262 GNUNET_GNS_RECORD_REV,
2263 &process_pkey_revocation_result_ns,
2264 rh);
2265
2266 /*if (strcmp(rh->name, "") == 0)
2267 {
2268 if ((rh->priv_key != NULL) && is_canonical (rh->name))
2269 {
2270 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2271 "GNS_PHASE_DELEGATE_DHT-%llu: Trying to shorten authority chain\n",
2272 rh->id);
2273 start_shorten (rh->authority_chain_tail,
2274 rh->priv_key);
2275 }
2124 2276
2125 rh->proc(rh->proc_cls, rh, 0, NULL); 2277 rh->proc(rh->proc_cls, rh, 0, NULL);
2126 } 2278 }
@@ -2129,6 +2281,7 @@ process_delegation_result_dht(void* cls,
2129 rh->proc = &handle_delegation_ns; 2281 rh->proc = &handle_delegation_ns;
2130 resolve_delegation_ns (rh); 2282 resolve_delegation_ns (rh);
2131 } 2283 }
2284 */
2132 return; 2285 return;
2133 } 2286 }
2134 2287
@@ -2353,7 +2506,7 @@ handle_record_ns (void* cls, struct ResolverHandle *rh,
2353 2506
2354 /** 2507 /**
2355 * There are 5 conditions that have to met for us to consult the DHT: 2508 * There are 5 conditions that have to met for us to consult the DHT:
2356 * 1. The entry in the DHT is RSL_RECORD_EXPIRED AND 2509 * 1. The entry in the DHT is RSL_RECORD_EXPIRED OR
2357 * 2. No entry in the NS existed AND 2510 * 2. No entry in the NS existed AND
2358 * 3. The zone queried is not the local resolver's zone AND 2511 * 3. The zone queried is not the local resolver's zone AND
2359 * 4. The name that was looked up is '+' 2512 * 4. The name that was looked up is '+'
@@ -2362,9 +2515,9 @@ handle_record_ns (void* cls, struct ResolverHandle *rh,
2362 * would already have an entry in the NS for the record) 2515 * would already have an entry in the NS for the record)
2363 * 5. We are not in cache only mode 2516 * 5. We are not in cache only mode
2364 */ 2517 */
2365 if (rh->status & (RSL_RECORD_EXPIRED | !RSL_RECORD_EXISTS) && 2518 if (((rh->status & RSL_RECORD_EXPIRED) || (rh->status &!RSL_RECORD_EXISTS))
2366 GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone, 2519 && GNUNET_CRYPTO_short_hash_cmp(&rh->authority_chain_head->zone,
2367 &rh->private_local_zone) && 2520 &rh->private_local_zone) &&
2368 (strcmp(rh->name, "+") == 0) && 2521 (strcmp(rh->name, "+") == 0) &&
2369 (rh->only_cached == GNUNET_NO)) 2522 (rh->only_cached == GNUNET_NO))
2370 { 2523 {
@@ -2653,6 +2806,7 @@ handle_delegation_ns (void* cls, struct ResolverHandle *rh,
2653 GNUNET_assert (NULL != rd); 2806 GNUNET_assert (NULL != rd);
2654 rh->proc = &handle_record_vpn; 2807 rh->proc = &handle_record_vpn;
2655 resolve_record_vpn (rh, rd_count, rd); 2808 resolve_record_vpn (rh, rd_count, rd);
2809 return;
2656 } 2810 }
2657 else if (rh->status & RSL_DELEGATE_NS) 2811 else if (rh->status & RSL_DELEGATE_NS)
2658 { 2812 {
@@ -2672,6 +2826,7 @@ handle_delegation_ns (void* cls, struct ResolverHandle *rh,
2672 GNUNET_assert (NULL != rd); 2826 GNUNET_assert (NULL != rd);
2673 rh->proc = &handle_record_ns; 2827 rh->proc = &handle_record_ns;
2674 resolve_record_dns (rh, rd_count, rd); 2828 resolve_record_dns (rh, rd_count, rd);
2829 return;
2675 } 2830 }
2676 else if (rh->status & RSL_DELEGATE_PKEY) 2831 else if (rh->status & RSL_DELEGATE_PKEY)
2677 { 2832 {
@@ -2695,15 +2850,12 @@ handle_delegation_ns (void* cls, struct ResolverHandle *rh,
2695 return; 2850 return;
2696 } 2851 }
2697 } 2852 }
2698 else 2853 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
2699 { 2854 "GNS_PHASE_DELEGATE_NS-%llu: Resolving record +\n",
2700 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 2855 rh->id);
2701 "GNS_PHASE_DELEGATE_NS-%llu: Resolving record +\n", 2856 strcpy(rh->name, "+\0");
2702 rh->id); 2857 rh->proc = &handle_record_ns;
2703 strcpy(rh->name, "+\0"); 2858 resolve_record_ns(rh);
2704 rh->proc = &handle_record_ns;
2705 resolve_record_ns(rh);
2706 }
2707 return; 2859 return;
2708 } 2860 }
2709 2861
@@ -2776,78 +2928,6 @@ handle_delegation_ns (void* cls, struct ResolverHandle *rh,
2776 resolve_delegation_dht(rh); 2928 resolve_delegation_dht(rh);
2777} 2929}
2778 2930
2779/**
2780 * This is a callback function that checks for key revocation
2781 *
2782 * @param cls the pending query
2783 * @param key the key of the zone we did the lookup
2784 * @param expiration expiration date of the record data set in the namestore
2785 * @param name the name for which we need an authority
2786 * @param rd_count the number of records with 'name'
2787 * @param rd the record data
2788 * @param signature the signature of the authority for the record data
2789 */
2790static void
2791process_pkey_revocation_result_ns (void *cls,
2792 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *key,
2793 struct GNUNET_TIME_Absolute expiration,
2794 const char *name,
2795 unsigned int rd_count,
2796 const struct GNUNET_NAMESTORE_RecordData *rd,
2797 const struct GNUNET_CRYPTO_RsaSignature *signature)
2798{
2799 struct ResolverHandle *rh = cls;
2800 struct GNUNET_TIME_Relative remaining_time;
2801 int i;
2802
2803 remaining_time = GNUNET_TIME_absolute_get_remaining (expiration);
2804
2805 for (i = 0; i < rd_count; i++)
2806 {
2807 if (rd[i].record_type == GNUNET_GNS_RECORD_REV)
2808 {
2809 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
2810 "GNS_PHASE_DELEGATE_NS-%llu: Zone has been revoked.\n",
2811 rh->id);
2812 rh->status |= RSL_PKEY_REVOKED;
2813 rh->proc (rh->proc_cls, rh, 0, NULL);
2814 return;
2815 }
2816 }
2817
2818 if ((name == NULL) ||
2819 (remaining_time.rel_value == 0))
2820 {
2821 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
2822 "GNS_PHASE_DELEGATE_NS-%llu: + Records don't exist or are expired.\n",
2823 rh->id, name);
2824 //FIXME start BG lookup
2825 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
2826 "GNS_PHASE_DELEGATE_NS-%d: Starting background lookup for %s type %d\n",
2827 rh->id, "+.gnunet", GNUNET_GNS_RECORD_REV);
2828
2829 gns_resolver_lookup_record(rh->authority,
2830 rh->private_local_zone,
2831 GNUNET_GNS_RECORD_REV,
2832 GNUNET_GNS_TLD,
2833 rh->priv_key,
2834 GNUNET_TIME_UNIT_FOREVER_REL,
2835 GNUNET_NO,
2836 &background_lookup_result_processor,
2837 NULL);
2838 }
2839
2840 /**
2841 * We are done with PKEY resolution if name is empty
2842 * else resolve again with new authority
2843 */
2844 if (strcmp (rh->name, "") == 0)
2845 rh->proc (rh->proc_cls, rh, 0, NULL);
2846 else
2847 resolve_delegation_ns (rh);
2848 return;
2849}
2850
2851 2931
2852/** 2932/**
2853 * This is a callback function that should give us only PKEY 2933 * This is a callback function that should give us only PKEY
@@ -2895,14 +2975,14 @@ process_delegation_result_ns (void* cls,
2895 "GNS_PHASE_DELEGATE_NS-%llu: Records with name %s exist.\n", 2975 "GNS_PHASE_DELEGATE_NS-%llu: Records with name %s exist.\n",
2896 rh->id, name); 2976 rh->id, name);
2897 rh->status |= RSL_RECORD_EXISTS; 2977 rh->status |= RSL_RECORD_EXISTS;
2898 }
2899 2978
2900 if (remaining_time.rel_value == 0) 2979 if (remaining_time.rel_value == 0)
2901 { 2980 {
2902 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 2981 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
2903 "GNS_PHASE_DELEGATE_NS-%llu: Record set %s expired.\n", 2982 "GNS_PHASE_DELEGATE_NS-%llu: Record set %s expired.\n",
2904 rh->id, name); 2983 rh->id, name);
2905 rh->status |= RSL_RECORD_EXPIRED; 2984 rh->status |= RSL_RECORD_EXPIRED;
2985 }
2906 } 2986 }
2907 2987
2908 /** 2988 /**
diff --git a/src/gns/gnunet-service-gns_resolver.h b/src/gns/gnunet-service-gns_resolver.h
index b93e6acec..5d9741beb 100644
--- a/src/gns/gnunet-service-gns_resolver.h
+++ b/src/gns/gnunet-service-gns_resolver.h
@@ -284,6 +284,12 @@ struct GetNameAuthorityHandle
284 */ 284 */
285struct GetPseuAuthorityHandle 285struct GetPseuAuthorityHandle
286{ 286{
287 /* DLL */
288 struct GetPseuAuthorityHandle *next;
289
290 /* DLL */
291 struct GetPseuAuthorityHandle *prev;
292
287 /* the name to store the zone under */ 293 /* the name to store the zone under */
288 char name[MAX_DNS_LABEL_LENGTH]; 294 char name[MAX_DNS_LABEL_LENGTH];
289 295
diff --git a/src/gns/test_gns_revocation.c b/src/gns/test_gns_revocation.c
index f5d2c47cd..d95f78962 100644
--- a/src/gns/test_gns_revocation.c
+++ b/src/gns/test_gns_revocation.c
@@ -257,7 +257,7 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
257 1, 257 1,
258 &rd, 258 &rd,
259 sig, 259 sig,
260 &commence_testing, 260 NULL,
261 NULL); 261 NULL);
262 rd.data_size = 0; 262 rd.data_size = 0;
263 rd.record_type = GNUNET_GNS_RECORD_REV; 263 rd.record_type = GNUNET_GNS_RECORD_REV;