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.c154
1 files changed, 77 insertions, 77 deletions
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c
index 110263eee..7a7c1633e 100644
--- a/src/gns/gnunet-service-gns_resolver.c
+++ b/src/gns/gnunet-service-gns_resolver.c
@@ -93,10 +93,10 @@ struct AuthorityChain
93 struct GNS_ResolverHandle *rh; 93 struct GNS_ResolverHandle *rh;
94 94
95 /** 95 /**
96 * label/name corresponding to the authority 96 * label/name corresponding to the authority
97 */ 97 */
98 char *label; 98 char *label;
99 99
100 /** 100 /**
101 * #GNUNET_YES if the authority was a GNS authority, 101 * #GNUNET_YES if the authority was a GNS authority,
102 * #GNUNET_NO if the authority was a DNS authority. 102 * #GNUNET_NO if the authority was a DNS authority.
@@ -110,7 +110,7 @@ struct AuthorityChain
110 { 110 {
111 111
112 /** 112 /**
113 * The zone of the GNS authority 113 * The zone of the GNS authority
114 */ 114 */
115 struct GNUNET_CRYPTO_EccPublicSignKey gns_authority; 115 struct GNUNET_CRYPTO_EccPublicSignKey gns_authority;
116 116
@@ -133,7 +133,7 @@ struct AuthorityChain
133 } dns_authority; 133 } dns_authority;
134 134
135 } authority_info; 135 } authority_info;
136 136
137}; 137};
138 138
139 139
@@ -180,10 +180,10 @@ struct DnsResult
180/** 180/**
181 * Closure for #vpn_allocation_cb. 181 * Closure for #vpn_allocation_cb.
182 */ 182 */
183struct VpnContext 183struct VpnContext
184{ 184{
185 185
186 /** 186 /**
187 * Which resolution process are we processing. 187 * Which resolution process are we processing.
188 */ 188 */
189 struct GNS_ResolverHandle *rh; 189 struct GNS_ResolverHandle *rh;
@@ -197,12 +197,12 @@ struct VpnContext
197 * Number of records serialized in 'rd_data'. 197 * Number of records serialized in 'rd_data'.
198 */ 198 */
199 unsigned int rd_count; 199 unsigned int rd_count;
200 200
201 /** 201 /**
202 * Serialized records. 202 * Serialized records.
203 */ 203 */
204 char *rd_data; 204 char *rd_data;
205 205
206 /** 206 /**
207 * Number of bytes in 'rd_data'. 207 * Number of bytes in 'rd_data'.
208 */ 208 */
@@ -212,38 +212,38 @@ struct VpnContext
212 212
213/** 213/**
214 * Handle to a currenty pending resolution. On result (positive or 214 * Handle to a currenty pending resolution. On result (positive or
215 * negative) the #GNS_ResultProcessor is called. 215 * negative) the #GNS_ResultProcessor is called.
216 */ 216 */
217struct GNS_ResolverHandle 217struct GNS_ResolverHandle
218{ 218{
219 219
220 /** 220 /**
221 * DLL 221 * DLL
222 */ 222 */
223 struct GNS_ResolverHandle *next; 223 struct GNS_ResolverHandle *next;
224 224
225 /** 225 /**
226 * DLL 226 * DLL
227 */ 227 */
228 struct GNS_ResolverHandle *prev; 228 struct GNS_ResolverHandle *prev;
229 229
230 /** 230 /**
231 * The top-level GNS authoritative zone to query 231 * The top-level GNS authoritative zone to query
232 */ 232 */
233 struct GNUNET_CRYPTO_EccPublicSignKey authority_zone; 233 struct GNUNET_CRYPTO_EccPublicSignKey authority_zone;
234 234
235 /** 235 /**
236 * called when resolution phase finishes 236 * called when resolution phase finishes
237 */ 237 */
238 GNS_ResultProcessor proc; 238 GNS_ResultProcessor proc;
239 239
240 /** 240 /**
241 * closure passed to proc 241 * closure passed to proc
242 */ 242 */
243 void* proc_cls; 243 void* proc_cls;
244 244
245 /** 245 /**
246 * Handle for DHT lookups. should be NULL if no lookups are in progress 246 * Handle for DHT lookups. should be NULL if no lookups are in progress
247 */ 247 */
248 struct GNUNET_DHT_GetHandle *get_handle; 248 struct GNUNET_DHT_GetHandle *get_handle;
249 249
@@ -274,12 +274,12 @@ struct GNS_ResolverHandle
274 struct GNUNET_CONTAINER_HeapNode *dht_heap_node; 274 struct GNUNET_CONTAINER_HeapNode *dht_heap_node;
275 275
276 /** 276 /**
277 * DLL to store the authority chain 277 * DLL to store the authority chain
278 */ 278 */
279 struct AuthorityChain *ac_head; 279 struct AuthorityChain *ac_head;
280 280
281 /** 281 /**
282 * DLL to store the authority chain 282 * DLL to store the authority chain
283 */ 283 */
284 struct AuthorityChain *ac_tail; 284 struct AuthorityChain *ac_tail;
285 285
@@ -294,7 +294,7 @@ struct GNS_ResolverHandle
294 GNUNET_SCHEDULER_TaskIdentifier task_id; 294 GNUNET_SCHEDULER_TaskIdentifier task_id;
295 295
296 /** 296 /**
297 * The name to resolve 297 * The name to resolve
298 */ 298 */
299 char *name; 299 char *name;
300 300
@@ -314,7 +314,7 @@ struct GNS_ResolverHandle
314 size_t name_resolution_pos; 314 size_t name_resolution_pos;
315 315
316 /** 316 /**
317 * Use only cache 317 * Use only cache
318 */ 318 */
319 int only_cached; 319 int only_cached;
320 320
@@ -325,7 +325,7 @@ struct GNS_ResolverHandle
325 325
326 /** 326 /**
327 * We increment the loop limiter for each step in a recursive 327 * We increment the loop limiter for each step in a recursive
328 * resolution. If it passes our threshold (i.e. due to 328 * resolution. If it passes our threshold (i.e. due to
329 * self-recursion in the resolution, i.e CNAME fun), we stop. 329 * self-recursion in the resolution, i.e CNAME fun), we stop.
330 */ 330 */
331 unsigned int loop_limiter; 331 unsigned int loop_limiter;
@@ -470,7 +470,7 @@ is_canonical (const char *name)
470 if ('_' != name[0]) 470 if ('_' != name[0])
471 return GNUNET_NO; 471 return GNUNET_NO;
472 pos = &name[1]; 472 pos = &name[1];
473 while (NULL != (dot = strchr (pos, '.'))) 473 while (NULL != (dot = strchr (pos, '.')))
474 if ('_' != dot[1]) 474 if ('_' != dot[1])
475 return GNUNET_NO; 475 return GNUNET_NO;
476 else 476 else
@@ -530,8 +530,8 @@ fail_resolution (void *cls,
530/* Don't have this on W32, here's a naive implementation 530/* Don't have this on W32, here's a naive implementation
531 * Was somehow removed on OS X ... */ 531 * Was somehow removed on OS X ... */
532void * 532void *
533memrchr (const void *s, 533memrchr (const void *s,
534 int c, 534 int c,
535 size_t n) 535 size_t n)
536{ 536{
537 const unsigned char *ucs = s; 537 const unsigned char *ucs = s;
@@ -567,7 +567,7 @@ resolver_lookup_get_next_label (struct GNS_ResolverHandle *rh)
567 /* done, this was the last one */ 567 /* done, this was the last one */
568 len = rh->name_resolution_pos; 568 len = rh->name_resolution_pos;
569 rp = rh->name; 569 rp = rh->name;
570 rh->name_resolution_pos = 0; 570 rh->name_resolution_pos = 0;
571 } 571 }
572 else 572 else
573 { 573 {
@@ -575,8 +575,8 @@ resolver_lookup_get_next_label (struct GNS_ResolverHandle *rh)
575 len = rh->name_resolution_pos - (dot - rh->name) - 1; 575 len = rh->name_resolution_pos - (dot - rh->name) - 1;
576 rp = dot + 1; 576 rp = dot + 1;
577 rh->name_resolution_pos = dot - rh->name; 577 rh->name_resolution_pos = dot - rh->name;
578 } 578 }
579 return GNUNET_strndup (rp, len); 579 return GNUNET_strndup (rp, len);
580} 580}
581 581
582 582
@@ -617,7 +617,7 @@ transmit_lookup_dns_result (struct GNS_ResolverHandle *rh)
617 i++; 617 i++;
618 } 618 }
619 GNUNET_assert (i == n); 619 GNUNET_assert (i == n);
620 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 620 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
621 "Transmitting standard DNS result with %u records\n", 621 "Transmitting standard DNS result with %u records\n",
622 n); 622 n);
623 rh->proc (rh->proc_cls, 623 rh->proc (rh->proc_cls,
@@ -754,7 +754,7 @@ dns_result_parser (void *cls,
754 rh->dns_request = NULL; 754 rh->dns_request = NULL;
755 GNUNET_SCHEDULER_cancel (rh->task_id); 755 GNUNET_SCHEDULER_cancel (rh->task_id);
756 rh->task_id = GNUNET_SCHEDULER_NO_TASK; 756 rh->task_id = GNUNET_SCHEDULER_NO_TASK;
757 p = GNUNET_DNSPARSER_parse ((const char *) dns, 757 p = GNUNET_DNSPARSER_parse ((const char *) dns,
758 dns_len); 758 dns_len);
759 if (NULL == p) 759 if (NULL == p)
760 { 760 {
@@ -776,7 +776,7 @@ dns_result_parser (void *cls,
776 rh->name = GNUNET_strdup (p->answers[0].data.hostname); 776 rh->name = GNUNET_strdup (p->answers[0].data.hostname);
777 start_resolver_lookup (rh); 777 start_resolver_lookup (rh);
778 GNUNET_DNSPARSER_free_packet (p); 778 GNUNET_DNSPARSER_free_packet (p);
779 return; 779 return;
780 } 780 }
781 /* FIXME: add DNAME support */ 781 /* FIXME: add DNAME support */
782 782
@@ -798,7 +798,7 @@ dns_result_parser (void *cls,
798 rec = &p->answers[i]; 798 rec = &p->answers[i];
799 else if (i < p->num_answers + p->num_authority_records) 799 else if (i < p->num_answers + p->num_authority_records)
800 rec = &p->authority_records[i - p->num_answers]; 800 rec = &p->authority_records[i - p->num_answers];
801 else 801 else
802 rec = &p->authority_records[i - p->num_answers - p->num_authority_records]; 802 rec = &p->authority_records[i - p->num_answers - p->num_authority_records];
803 /* As we copied the full DNS name to 'rh->ac_tail->label', this 803 /* As we copied the full DNS name to 'rh->ac_tail->label', this
804 should be the correct check to see if this record is actually 804 should be the correct check to see if this record is actually
@@ -909,7 +909,7 @@ dns_result_parser (void *cls,
909 } 909 }
910 rh->proc (rh->proc_cls, rd_count - skip, rd); 910 rh->proc (rh->proc_cls, rd_count - skip, rd);
911 GNS_resolver_lookup_cancel (rh); 911 GNS_resolver_lookup_cancel (rh);
912 } 912 }
913 GNUNET_DNSPARSER_free_packet (p); 913 GNUNET_DNSPARSER_free_packet (p);
914} 914}
915 915
@@ -963,7 +963,7 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh)
963 UINT16_MAX); 963 UINT16_MAX);
964 p->flags.opcode = GNUNET_TUN_DNS_OPCODE_QUERY; 964 p->flags.opcode = GNUNET_TUN_DNS_OPCODE_QUERY;
965 p->flags.recursion_desired = 1; 965 p->flags.recursion_desired = 1;
966 if (GNUNET_OK != 966 if (GNUNET_OK !=
967 GNUNET_DNSPARSER_pack (p, 1024, &dns_request, &dns_request_length)) 967 GNUNET_DNSPARSER_pack (p, 1024, &dns_request, &dns_request_length))
968 { 968 {
969 GNUNET_break (0); 969 GNUNET_break (0);
@@ -993,7 +993,7 @@ recursive_dns_resolution (struct GNS_ResolverHandle *rh)
993 * Merge it into our chain. 993 * Merge it into our chain.
994 * 994 *
995 * @param rh resolution we are performing 995 * @param rh resolution we are performing
996 * @param cname value of the cname record we got for the current 996 * @param cname value of the cname record we got for the current
997 * authority chain tail 997 * authority chain tail
998 */ 998 */
999static void 999static void
@@ -1030,13 +1030,13 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh,
1030 ac = GNUNET_new (struct AuthorityChain); 1030 ac = GNUNET_new (struct AuthorityChain);
1031 ac->rh = rh; 1031 ac->rh = rh;
1032 ac->gns_authority = GNUNET_YES; 1032 ac->gns_authority = GNUNET_YES;
1033 ac->authority_info.gns_authority = rh->ac_tail->authority_info.gns_authority; 1033 ac->authority_info.gns_authority = rh->ac_tail->authority_info.gns_authority;
1034 ac->label = resolver_lookup_get_next_label (rh); 1034 ac->label = resolver_lookup_get_next_label (rh);
1035 /* tigger shortening */ 1035 /* tigger shortening */
1036 if (NULL != rh->shorten_key) 1036 if (NULL != rh->shorten_key)
1037 GNS_shorten_start (rh->ac_tail->label, 1037 GNS_shorten_start (rh->ac_tail->label,
1038 &ac->authority_info.gns_authority, 1038 &ac->authority_info.gns_authority,
1039 rh->shorten_key); 1039 rh->shorten_key);
1040 /* add AC to tail */ 1040 /* add AC to tail */
1041 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, 1041 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
1042 rh->ac_tail, 1042 rh->ac_tail,
@@ -1076,7 +1076,7 @@ handle_gns_resolution_result (void *cls,
1076 * will match 'result_af' from the request 1076 * will match 'result_af' from the request
1077 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af') 1077 * @param address IP address (struct in_addr or struct in_addr6, depending on 'af')
1078 * that the VPN allocated for the redirection; 1078 * that the VPN allocated for the redirection;
1079 * traffic to this IP will now be redirected to the 1079 * traffic to this IP will now be redirected to the
1080 * specified target peer; NULL on error 1080 * specified target peer; NULL on error
1081 */ 1081 */
1082static void 1082static void
@@ -1102,7 +1102,7 @@ vpn_allocation_cb (void *cls,
1102 { 1102 {
1103 switch (af) 1103 switch (af)
1104 { 1104 {
1105 case AF_INET: 1105 case AF_INET:
1106 rd[i].record_type = GNUNET_DNSPARSER_TYPE_A; 1106 rd[i].record_type = GNUNET_DNSPARSER_TYPE_A;
1107 rd[i].data_size = sizeof (struct in_addr); 1107 rd[i].data_size = sizeof (struct in_addr);
1108 rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (VPN_TIMEOUT).abs_value_us; 1108 rd[i].expiration_time = GNUNET_TIME_relative_to_absolute (VPN_TIMEOUT).abs_value_us;
@@ -1118,12 +1118,12 @@ vpn_allocation_cb (void *cls,
1118 break; 1118 break;
1119 default: 1119 default:
1120 GNUNET_assert (0); 1120 GNUNET_assert (0);
1121 } 1121 }
1122 break; 1122 break;
1123 } 1123 }
1124 } 1124 }
1125 GNUNET_assert (i < vpn_ctx->rd_count); 1125 GNUNET_assert (i < vpn_ctx->rd_count);
1126 handle_gns_resolution_result (rh, 1126 handle_gns_resolution_result (rh,
1127 vpn_ctx->rd_count, 1127 vpn_ctx->rd_count,
1128 rd); 1128 rd);
1129 GNUNET_free (vpn_ctx->rd_data); 1129 GNUNET_free (vpn_ctx->rd_data);
@@ -1168,7 +1168,7 @@ handle_gns_resolution_result (void *cls,
1168 "Resolution succeeded for `%s' in zone %s, got %u records\n", 1168 "Resolution succeeded for `%s' in zone %s, got %u records\n",
1169 rh->ac_tail->label, 1169 rh->ac_tail->label,
1170 GNUNET_NAMESTORE_z2s (&rh->ac_tail->authority_info.gns_authority), 1170 GNUNET_NAMESTORE_z2s (&rh->ac_tail->authority_info.gns_authority),
1171 rd_count); 1171 rd_count);
1172 if (0 == rh->name_resolution_pos) 1172 if (0 == rh->name_resolution_pos)
1173 { 1173 {
1174 /* top-level match, are we done yet? */ 1174 /* top-level match, are we done yet? */
@@ -1188,10 +1188,10 @@ handle_gns_resolution_result (void *cls,
1188 GNS_resolver_lookup_cancel (rh); 1188 GNS_resolver_lookup_cancel (rh);
1189 return; 1189 return;
1190 } 1190 }
1191 handle_gns_cname_result (rh, 1191 handle_gns_cname_result (rh,
1192 cname); 1192 cname);
1193 GNUNET_free (cname); 1193 GNUNET_free (cname);
1194 return; 1194 return;
1195 } 1195 }
1196 /* If A/AAAA was requested, but we got a VPN 1196 /* If A/AAAA was requested, but we got a VPN
1197 record, we convert it to A/AAAA using GNUnet VPN */ 1197 record, we convert it to A/AAAA using GNUnet VPN */
@@ -1211,7 +1211,7 @@ handle_gns_resolution_result (void *cls,
1211 GNUNET_break_op (0); 1211 GNUNET_break_op (0);
1212 rh->proc (rh->proc_cls, 0, NULL); 1212 rh->proc (rh->proc_cls, 0, NULL);
1213 GNS_resolver_lookup_cancel (rh); 1213 GNS_resolver_lookup_cancel (rh);
1214 return; 1214 return;
1215 } 1215 }
1216 vpn = (const struct GNUNET_TUN_GnsVpnRecord *) rd[i].data; 1216 vpn = (const struct GNUNET_TUN_GnsVpnRecord *) rd[i].data;
1217 vname = (const char *) &vpn[1]; 1217 vname = (const char *) &vpn[1];
@@ -1300,7 +1300,7 @@ handle_gns_resolution_result (void *cls,
1300 rd_off++; 1300 rd_off++;
1301 } 1301 }
1302 } 1302 }
1303 GNUNET_free_non_null (cname); 1303 GNUNET_free_non_null (cname);
1304 } 1304 }
1305 break; 1305 break;
1306 case GNUNET_DNSPARSER_TYPE_SOA: 1306 case GNUNET_DNSPARSER_TYPE_SOA:
@@ -1337,7 +1337,7 @@ handle_gns_resolution_result (void *cls,
1337 } 1337 }
1338 } 1338 }
1339 if (NULL != soa) 1339 if (NULL != soa)
1340 GNUNET_DNSPARSER_free_soa (soa); 1340 GNUNET_DNSPARSER_free_soa (soa);
1341 } 1341 }
1342 break; 1342 break;
1343 case GNUNET_DNSPARSER_TYPE_MX: 1343 case GNUNET_DNSPARSER_TYPE_MX:
@@ -1373,7 +1373,7 @@ handle_gns_resolution_result (void *cls,
1373 } 1373 }
1374 } 1374 }
1375 if (NULL != mx) 1375 if (NULL != mx)
1376 GNUNET_DNSPARSER_free_mx (mx); 1376 GNUNET_DNSPARSER_free_mx (mx);
1377 } 1377 }
1378 break; 1378 break;
1379 case GNUNET_DNSPARSER_TYPE_SRV: 1379 case GNUNET_DNSPARSER_TYPE_SRV:
@@ -1381,7 +1381,7 @@ handle_gns_resolution_result (void *cls,
1381 struct GNUNET_DNSPARSER_SrvRecord *srv; 1381 struct GNUNET_DNSPARSER_SrvRecord *srv;
1382 1382
1383 off = 0; 1383 off = 0;
1384 /* FIXME: passing rh->name here is is not necessarily what we want 1384 /* FIXME: passing rh->name here is is not necessarily what we want
1385 (SRV support not finished) */ 1385 (SRV support not finished) */
1386 srv = GNUNET_DNSPARSER_parse_srv (rh->name, 1386 srv = GNUNET_DNSPARSER_parse_srv (rh->name,
1387 rd[i].data, 1387 rd[i].data,
@@ -1413,7 +1413,7 @@ handle_gns_resolution_result (void *cls,
1413 } 1413 }
1414 } 1414 }
1415 if (NULL != srv) 1415 if (NULL != srv)
1416 GNUNET_DNSPARSER_free_srv (srv); 1416 GNUNET_DNSPARSER_free_srv (srv);
1417 } 1417 }
1418 break; 1418 break;
1419 case GNUNET_NAMESTORE_TYPE_PKEY: 1419 case GNUNET_NAMESTORE_TYPE_PKEY:
@@ -1421,7 +1421,7 @@ handle_gns_resolution_result (void *cls,
1421 if (NULL != rh->shorten_key) 1421 if (NULL != rh->shorten_key)
1422 { 1422 {
1423 struct GNUNET_CRYPTO_EccPublicSignKey pub; 1423 struct GNUNET_CRYPTO_EccPublicSignKey pub;
1424 1424
1425 if (rd[i].data_size != sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) 1425 if (rd[i].data_size != sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))
1426 { 1426 {
1427 GNUNET_break_op (0); 1427 GNUNET_break_op (0);
@@ -1439,11 +1439,11 @@ handle_gns_resolution_result (void *cls,
1439 break; 1439 break;
1440 } 1440 }
1441 } 1441 }
1442 1442
1443 /* yes, we are done, return result */ 1443 /* yes, we are done, return result */
1444 rh->proc (rh->proc_cls, rd_off, rd_new); 1444 rh->proc (rh->proc_cls, rd_off, rd_new);
1445 GNS_resolver_lookup_cancel (rh); 1445 GNS_resolver_lookup_cancel (rh);
1446 return; 1446 return;
1447 } 1447 }
1448 do_recurse: 1448 do_recurse:
1449 /* need to recurse, check if we can */ 1449 /* need to recurse, check if we can */
@@ -1459,7 +1459,7 @@ handle_gns_resolution_result (void *cls,
1459 GNUNET_break_op (0); 1459 GNUNET_break_op (0);
1460 rh->proc (rh->proc_cls, 0, NULL); 1460 rh->proc (rh->proc_cls, 0, NULL);
1461 GNS_resolver_lookup_cancel (rh); 1461 GNS_resolver_lookup_cancel (rh);
1462 return; 1462 return;
1463 } 1463 }
1464 /* expand authority chain */ 1464 /* expand authority chain */
1465 ac = GNUNET_new (struct AuthorityChain); 1465 ac = GNUNET_new (struct AuthorityChain);
@@ -1470,10 +1470,10 @@ handle_gns_resolution_result (void *cls,
1470 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); 1470 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey));
1471 ac->label = resolver_lookup_get_next_label (rh); 1471 ac->label = resolver_lookup_get_next_label (rh);
1472 /* tigger shortening */ 1472 /* tigger shortening */
1473 if (NULL != rh->shorten_key) 1473 if (NULL != rh->shorten_key)
1474 GNS_shorten_start (rh->ac_tail->label, 1474 GNS_shorten_start (rh->ac_tail->label,
1475 &ac->authority_info.gns_authority, 1475 &ac->authority_info.gns_authority,
1476 rh->shorten_key); 1476 rh->shorten_key);
1477 /* add AC to tail */ 1477 /* add AC to tail */
1478 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, 1478 GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head,
1479 rh->ac_tail, 1479 rh->ac_tail,
@@ -1491,7 +1491,7 @@ handle_gns_resolution_result (void *cls,
1491 GNUNET_break_op (0); 1491 GNUNET_break_op (0);
1492 rh->proc (rh->proc_cls, 0, NULL); 1492 rh->proc (rh->proc_cls, 0, NULL);
1493 GNS_resolver_lookup_cancel (rh); 1493 GNS_resolver_lookup_cancel (rh);
1494 return; 1494 return;
1495 } 1495 }
1496 /* find associated A/AAAA record */ 1496 /* find associated A/AAAA record */
1497 sa = NULL; 1497 sa = NULL;
@@ -1506,7 +1506,7 @@ handle_gns_resolution_result (void *cls,
1506 GNUNET_break_op (0); 1506 GNUNET_break_op (0);
1507 rh->proc (rh->proc_cls, 0, NULL); 1507 rh->proc (rh->proc_cls, 0, NULL);
1508 GNS_resolver_lookup_cancel (rh); 1508 GNS_resolver_lookup_cancel (rh);
1509 return; 1509 return;
1510 } 1510 }
1511 /* FIXME: might want to check if we support IPv4 here, 1511 /* FIXME: might want to check if we support IPv4 here,
1512 and otherwise skip this one and hope we find another */ 1512 and otherwise skip this one and hope we find another */
@@ -1528,7 +1528,7 @@ handle_gns_resolution_result (void *cls,
1528 GNUNET_break_op (0); 1528 GNUNET_break_op (0);
1529 rh->proc (rh->proc_cls, 0, NULL); 1529 rh->proc (rh->proc_cls, 0, NULL);
1530 GNS_resolver_lookup_cancel (rh); 1530 GNS_resolver_lookup_cancel (rh);
1531 return; 1531 return;
1532 } 1532 }
1533 /* FIXME: might want to check if we support IPv6 here, 1533 /* FIXME: might want to check if we support IPv6 here,
1534 and otherwise skip this one and hope we find another */ 1534 and otherwise skip this one and hope we find another */
@@ -1620,7 +1620,7 @@ handle_gns_resolution_result (void *cls,
1620 GNS_resolver_lookup_cancel (rh); 1620 GNS_resolver_lookup_cancel (rh);
1621 return; 1621 return;
1622 } 1622 }
1623 handle_gns_cname_result (rh, 1623 handle_gns_cname_result (rh,
1624 cname); 1624 cname);
1625 GNUNET_free (cname); 1625 GNUNET_free (cname);
1626 return; 1626 return;
@@ -1688,7 +1688,7 @@ handle_dht_response (void *cls,
1688 const struct GNUNET_HashCode *key, 1688 const struct GNUNET_HashCode *key,
1689 const struct GNUNET_PeerIdentity *get_path, 1689 const struct GNUNET_PeerIdentity *get_path,
1690 unsigned int get_path_length, 1690 unsigned int get_path_length,
1691 const struct GNUNET_PeerIdentity *put_path, 1691 const struct GNUNET_PeerIdentity *put_path,
1692 unsigned int put_path_length, 1692 unsigned int put_path_length,
1693 enum GNUNET_BLOCK_Type type, 1693 enum GNUNET_BLOCK_Type type,
1694 size_t size, const void *data) 1694 size_t size, const void *data)
@@ -1697,11 +1697,11 @@ handle_dht_response (void *cls,
1697 struct AuthorityChain *ac = rh->ac_tail; 1697 struct AuthorityChain *ac = rh->ac_tail;
1698 const struct GNUNET_NAMESTORE_Block *block; 1698 const struct GNUNET_NAMESTORE_Block *block;
1699 struct CacheOps *co; 1699 struct CacheOps *co;
1700 1700
1701 GNUNET_DHT_get_stop (rh->get_handle); 1701 GNUNET_DHT_get_stop (rh->get_handle);
1702 rh->get_handle = NULL; 1702 rh->get_handle = NULL;
1703 GNUNET_CONTAINER_heap_remove_node (rh->dht_heap_node); 1703 GNUNET_CONTAINER_heap_remove_node (rh->dht_heap_node);
1704 rh->dht_heap_node = NULL; 1704 rh->dht_heap_node = NULL;
1705 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1705 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1706 "Handling response from the DHT\n"); 1706 "Handling response from the DHT\n");
1707 if (size < sizeof (struct GNUNET_NAMESTORE_Block)) 1707 if (size < sizeof (struct GNUNET_NAMESTORE_Block))
@@ -1710,11 +1710,11 @@ handle_dht_response (void *cls,
1710 GNUNET_break (0); 1710 GNUNET_break (0);
1711 rh->proc (rh->proc_cls, 0, NULL); 1711 rh->proc (rh->proc_cls, 0, NULL);
1712 GNS_resolver_lookup_cancel (rh); 1712 GNS_resolver_lookup_cancel (rh);
1713 return; 1713 return;
1714 } 1714 }
1715 block = data; 1715 block = data;
1716 if (size != 1716 if (size !=
1717 ntohl (block->purpose.size) + 1717 ntohl (block->purpose.size) +
1718 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + 1718 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
1719 sizeof (struct GNUNET_CRYPTO_EccSignature)) 1719 sizeof (struct GNUNET_CRYPTO_EccSignature))
1720 { 1720 {
@@ -1722,7 +1722,7 @@ handle_dht_response (void *cls,
1722 GNUNET_break (0); 1722 GNUNET_break (0);
1723 rh->proc (rh->proc_cls, 0, NULL); 1723 rh->proc (rh->proc_cls, 0, NULL);
1724 GNS_resolver_lookup_cancel (rh); 1724 GNS_resolver_lookup_cancel (rh);
1725 return; 1725 return;
1726 } 1726 }
1727 if (GNUNET_OK != 1727 if (GNUNET_OK !=
1728 GNUNET_NAMESTORE_block_decrypt (block, 1728 GNUNET_NAMESTORE_block_decrypt (block,
@@ -1756,7 +1756,7 @@ handle_dht_response (void *cls,
1756 * @param cls closure with the `struct GNS_ResolverHandle` 1756 * @param cls closure with the `struct GNS_ResolverHandle`
1757 * @param block block that was stored in the namestore 1757 * @param block block that was stored in the namestore
1758 */ 1758 */
1759static void 1759static void
1760handle_namestore_block_response (void *cls, 1760handle_namestore_block_response (void *cls,
1761 const struct GNUNET_NAMESTORE_Block *block) 1761 const struct GNUNET_NAMESTORE_Block *block)
1762{ 1762{
@@ -1879,10 +1879,10 @@ recursive_resolution (void *cls,
1879 GNS_resolver_lookup_cancel (rh); 1879 GNS_resolver_lookup_cancel (rh);
1880 return; 1880 return;
1881 } 1881 }
1882 if (GNUNET_YES == rh->ac_tail->gns_authority) 1882 if (GNUNET_YES == rh->ac_tail->gns_authority)
1883 recursive_gns_resolution_namestore (rh); 1883 recursive_gns_resolution_namestore (rh);
1884 else 1884 else
1885 recursive_dns_resolution (rh); 1885 recursive_dns_resolution (rh);
1886} 1886}
1887 1887
1888 1888
@@ -1919,11 +1919,11 @@ start_resolver_lookup (struct GNS_ResolverHandle *rh)
1919 default: 1919 default:
1920 af = AF_UNSPEC; 1920 af = AF_UNSPEC;
1921 break; 1921 break;
1922 } 1922 }
1923 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1923 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1924 "Doing standard DNS lookup for `%s'\n", 1924 "Doing standard DNS lookup for `%s'\n",
1925 rh->name); 1925 rh->name);
1926 rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name, 1926 rh->std_resolve = GNUNET_RESOLVER_ip_get (rh->name,
1927 af, 1927 af,
1928 DNS_LOOKUP_TIMEOUT, 1928 DNS_LOOKUP_TIMEOUT,
1929 &handle_dns_result, 1929 &handle_dns_result,
@@ -2002,7 +2002,7 @@ GNS_resolver_lookup (const struct GNUNET_CRYPTO_EccPublicSignKey *zone,
2002 2002
2003 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 2003 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
2004 (NULL == shorten_key) 2004 (NULL == shorten_key)
2005 ? "Starting lookup for `%s' with shortening disabled\n" 2005 ? "Starting lookup for `%s' with shortening disabled\n"
2006 : "Starting lookup for `%s' with shortening enabled\n", 2006 : "Starting lookup for `%s' with shortening enabled\n",
2007 name); 2007 name);
2008 rh = GNUNET_new (struct GNS_ResolverHandle); 2008 rh = GNUNET_new (struct GNS_ResolverHandle);
@@ -2153,7 +2153,7 @@ GNS_resolver_done ()
2153 while (NULL != (rh = rlh_head)) 2153 while (NULL != (rh = rlh_head))
2154 { 2154 {
2155 rh->proc (rh->proc_cls, 0, NULL); 2155 rh->proc (rh->proc_cls, 0, NULL);
2156 GNS_resolver_lookup_cancel (rh); 2156 GNS_resolver_lookup_cancel (rh);
2157 } 2157 }
2158 while (NULL != (co = co_head)) 2158 while (NULL != (co = co_head))
2159 { 2159 {