aboutsummaryrefslogtreecommitdiff
path: root/src/gns/gnunet-service-gns_shorten.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gns/gnunet-service-gns_shorten.c')
-rw-r--r--src/gns/gnunet-service-gns_shorten.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/gns/gnunet-service-gns_shorten.c b/src/gns/gnunet-service-gns_shorten.c
index 8b69e670c..ff2cab097 100644
--- a/src/gns/gnunet-service-gns_shorten.c
+++ b/src/gns/gnunet-service-gns_shorten.c
@@ -83,12 +83,12 @@ struct GetPseuAuthorityHandle
83 struct GNUNET_CRYPTO_EccPublicSignKey target_zone; 83 struct GNUNET_CRYPTO_EccPublicSignKey target_zone;
84 84
85 /** 85 /**
86 * Handle for DHT lookups. Should be NULL if no lookups are in progress 86 * Handle for DHT lookups. Should be NULL if no lookups are in progress
87 */ 87 */
88 struct GNUNET_DHT_GetHandle *get_handle; 88 struct GNUNET_DHT_GetHandle *get_handle;
89 89
90 /** 90 /**
91 * Handle to namestore request 91 * Handle to namestore request
92 */ 92 */
93 struct GNUNET_NAMESTORE_QueueEntry *namestore_task; 93 struct GNUNET_NAMESTORE_QueueEntry *namestore_task;
94 94
@@ -158,8 +158,8 @@ free_get_pseu_authority_handle (struct GetPseuAuthorityHandle *gph)
158 * @param emsg unused 158 * @param emsg unused
159 */ 159 */
160static void 160static void
161create_pkey_cont (void* cls, 161create_pkey_cont (void* cls,
162 int32_t success, 162 int32_t success,
163 const char *emsg) 163 const char *emsg)
164{ 164{
165 struct GetPseuAuthorityHandle* gph = cls; 165 struct GetPseuAuthorityHandle* gph = cls;
@@ -205,7 +205,7 @@ process_pseu_block_ns (void *cls,
205 } 205 }
206 GNUNET_CRYPTO_ecc_key_get_public_for_signature (&gph->shorten_zone_key, 206 GNUNET_CRYPTO_ecc_key_get_public_for_signature (&gph->shorten_zone_key,
207 &pub); 207 &pub);
208 if (GNUNET_OK != 208 if (GNUNET_OK !=
209 GNUNET_NAMESTORE_block_decrypt (block, 209 GNUNET_NAMESTORE_block_decrypt (block,
210 &pub, 210 &pub,
211 gph->current_label, 211 gph->current_label,
@@ -225,10 +225,10 @@ process_pseu_block_ns (void *cls,
225 * @param gph the handle to our shorten operation 225 * @param gph the handle to our shorten operation
226 * @param label the label to lookup 226 * @param label the label to lookup
227 */ 227 */
228static void 228static void
229perform_pseu_lookup (struct GetPseuAuthorityHandle *gph, 229perform_pseu_lookup (struct GetPseuAuthorityHandle *gph,
230 const char *label) 230 const char *label)
231{ 231{
232 struct GNUNET_CRYPTO_EccPublicSignKey pub; 232 struct GNUNET_CRYPTO_EccPublicSignKey pub;
233 struct GNUNET_HashCode query; 233 struct GNUNET_HashCode query;
234 234
@@ -266,7 +266,7 @@ process_pseu_lookup_ns (void *cls,
266 if (rd_count > 0) 266 if (rd_count > 0)
267 { 267 {
268 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, 268 GNUNET_log(GNUNET_ERROR_TYPE_DEBUG,
269 "Name `%s' already taken, cannot shorten.\n", 269 "Name `%s' already taken, cannot shorten.\n",
270 gph->current_label); 270 gph->current_label);
271 /* if this was not yet the original label, try one more 271 /* if this was not yet the original label, try one more
272 time, this time not using PSEU but the original label */ 272 time, this time not using PSEU but the original label */
@@ -283,7 +283,7 @@ process_pseu_lookup_ns (void *cls,
283 } 283 }
284 /* name is available */ 284 /* name is available */
285 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 285 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
286 "Shortening `%s' to `%s'\n", 286 "Shortening `%s' to `%s'\n",
287 GNUNET_NAMESTORE_z2s (&gph->target_zone), 287 GNUNET_NAMESTORE_z2s (&gph->target_zone),
288 gph->current_label); 288 gph->current_label);
289 new_pkey.expiration_time = UINT64_MAX; 289 new_pkey.expiration_time = UINT64_MAX;
@@ -293,7 +293,7 @@ process_pseu_lookup_ns (void *cls,
293 new_pkey.flags = GNUNET_NAMESTORE_RF_NONE 293 new_pkey.flags = GNUNET_NAMESTORE_RF_NONE
294 | GNUNET_NAMESTORE_RF_PRIVATE 294 | GNUNET_NAMESTORE_RF_PRIVATE
295 | GNUNET_NAMESTORE_RF_PENDING; 295 | GNUNET_NAMESTORE_RF_PENDING;
296 gph->namestore_task 296 gph->namestore_task
297 = GNUNET_NAMESTORE_records_store (namestore_handle, 297 = GNUNET_NAMESTORE_records_store (namestore_handle,
298 &gph->shorten_zone_key, 298 &gph->shorten_zone_key,
299 gph->current_label, 299 gph->current_label,
@@ -309,7 +309,7 @@ process_pseu_lookup_ns (void *cls,
309 * @param pseu the pseu result or NULL 309 * @param pseu the pseu result or NULL
310 */ 310 */
311static void 311static void
312process_pseu_result (struct GetPseuAuthorityHandle* gph, 312process_pseu_result (struct GetPseuAuthorityHandle* gph,
313 const char *pseu) 313 const char *pseu)
314{ 314{
315 if (NULL == pseu) 315 if (NULL == pseu)
@@ -320,7 +320,7 @@ process_pseu_result (struct GetPseuAuthorityHandle* gph,
320 gph->label); 320 gph->label);
321 perform_pseu_lookup (gph, gph->label); 321 perform_pseu_lookup (gph, gph->label);
322 return; 322 return;
323 } 323 }
324 /* check if 'pseu' is taken */ 324 /* check if 'pseu' is taken */
325 perform_pseu_lookup (gph, pseu); 325 perform_pseu_lookup (gph, pseu);
326} 326}
@@ -373,7 +373,7 @@ process_auth_records (void *cls,
373 rd[i].data, 373 rd[i].data,
374 rd[i].data_size); 374 rd[i].data_size);
375 pseu[rd[i].data_size] = '\0'; 375 pseu[rd[i].data_size] = '\0';
376 process_pseu_result (gph, 376 process_pseu_result (gph,
377 pseu); 377 pseu);
378 return; 378 return;
379 } 379 }
@@ -432,18 +432,18 @@ process_auth_discovery_dht_result (void* cls,
432 /* how did this pass DHT block validation!? */ 432 /* how did this pass DHT block validation!? */
433 GNUNET_break (0); 433 GNUNET_break (0);
434 process_pseu_result (gph, NULL); 434 process_pseu_result (gph, NULL);
435 return; 435 return;
436 } 436 }
437 block = data; 437 block = data;
438 if (size != 438 if (size !=
439 ntohl (block->purpose.size) + 439 ntohl (block->purpose.size) +
440 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + 440 sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
441 sizeof (struct GNUNET_CRYPTO_EccSignature)) 441 sizeof (struct GNUNET_CRYPTO_EccSignature))
442 { 442 {
443 /* how did this pass DHT block validation!? */ 443 /* how did this pass DHT block validation!? */
444 GNUNET_break (0); 444 GNUNET_break (0);
445 process_pseu_result (gph, NULL); 445 process_pseu_result (gph, NULL);
446 return; 446 return;
447 } 447 }
448 if (GNUNET_OK != 448 if (GNUNET_OK !=
449 GNUNET_NAMESTORE_block_decrypt (block, 449 GNUNET_NAMESTORE_block_decrypt (block,
@@ -455,7 +455,7 @@ process_auth_discovery_dht_result (void* cls,
455 /* other peer encrypted invalid block, complain */ 455 /* other peer encrypted invalid block, complain */
456 GNUNET_break_op (0); 456 GNUNET_break_op (0);
457 process_pseu_result (gph, NULL); 457 process_pseu_result (gph, NULL);
458 return; 458 return;
459 } 459 }
460} 460}
461 461
@@ -479,7 +479,7 @@ process_zone_to_name_discover (void *cls,
479{ 479{
480 struct GetPseuAuthorityHandle* gph = cls; 480 struct GetPseuAuthorityHandle* gph = cls;
481 struct GNUNET_HashCode lookup_key; 481 struct GNUNET_HashCode lookup_key;
482 482
483 gph->namestore_task = NULL; 483 gph->namestore_task = NULL;
484 if (0 != rd_len) 484 if (0 != rd_len)
485 { 485 {
@@ -492,10 +492,10 @@ process_zone_to_name_discover (void *cls,
492 } 492 }
493 /* record does not yet exist, go into DHT to find PSEU record */ 493 /* record does not yet exist, go into DHT to find PSEU record */
494 GNUNET_NAMESTORE_query_from_public_key (&gph->target_zone, 494 GNUNET_NAMESTORE_query_from_public_key (&gph->target_zone,
495 GNUNET_GNS_TLD_PLUS, 495 GNUNET_GNS_TLD_PLUS,
496 &lookup_key); 496 &lookup_key);
497 gph->timeout_task = GNUNET_SCHEDULER_add_delayed (DHT_LOOKUP_TIMEOUT, 497 gph->timeout_task = GNUNET_SCHEDULER_add_delayed (DHT_LOOKUP_TIMEOUT,
498 &handle_auth_discovery_timeout, 498 &handle_auth_discovery_timeout,
499 gph); 499 gph);
500 gph->get_handle = GNUNET_DHT_get_start (dht_handle, 500 gph->get_handle = GNUNET_DHT_get_start (dht_handle,
501 GNUNET_BLOCK_TYPE_GNS_NAMERECORD, 501 GNUNET_BLOCK_TYPE_GNS_NAMERECORD,