aboutsummaryrefslogtreecommitdiff
path: root/src/gns/plugin_rest_gns.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gns/plugin_rest_gns.c')
-rw-r--r--src/gns/plugin_rest_gns.c54
1 files changed, 2 insertions, 52 deletions
diff --git a/src/gns/plugin_rest_gns.c b/src/gns/plugin_rest_gns.c
index 3cddbc246..5d4734d9a 100644
--- a/src/gns/plugin_rest_gns.c
+++ b/src/gns/plugin_rest_gns.c
@@ -336,10 +336,9 @@ process_lookup_result (void *cls, uint32_t rd_count,
336 * identified by the given public key and the shorten zone. 336 * identified by the given public key and the shorten zone.
337 * 337 *
338 * @param pkey public key to use for the zone, can be NULL 338 * @param pkey public key to use for the zone, can be NULL
339 * @param shorten_key private key used for shortening, can be NULL
340 */ 339 */
341static void 340static void
342lookup_with_keys (struct LookupHandle *handle, const struct GNUNET_CRYPTO_EcdsaPrivateKey *shorten_key) 341lookup_with_public_key (struct LookupHandle *handle)
343{ 342{
344 if (UINT32_MAX == handle->type) 343 if (UINT32_MAX == handle->type)
345 { 344 {
@@ -354,7 +353,6 @@ lookup_with_keys (struct LookupHandle *handle, const struct GNUNET_CRYPTO_EcdsaP
354 &handle->pkey, 353 &handle->pkey,
355 handle->type, 354 handle->type,
356 handle->options, 355 handle->options,
357 shorten_key,
358 &process_lookup_result, 356 &process_lookup_result,
359 handle); 357 handle);
360 } 358 }
@@ -365,55 +363,6 @@ lookup_with_keys (struct LookupHandle *handle, const struct GNUNET_CRYPTO_EcdsaP
365 } 363 }
366} 364}
367 365
368/**
369 * Method called to with the ego we are to use for shortening
370 * during the lookup.
371 *
372 * @param cls closure contains the public key to use
373 * @param ego ego handle, NULL if not found
374 * @param ctx context for application to store data for this ego
375 * (during the lifetime of this process, initially NULL)
376 * @param name name assigned by the user for this ego,
377 * NULL if the user just deleted the ego and it
378 * must thus no longer be used
379 */
380static void
381identity_shorten_cb (void *cls,
382 struct GNUNET_IDENTITY_Ego *ego,
383 void **ctx,
384 const char *name)
385{
386 struct LookupHandle *handle = cls;
387
388 handle->id_op = NULL;
389 if (NULL == ego)
390 lookup_with_keys (handle, NULL);
391 else
392 lookup_with_keys (handle,
393 GNUNET_IDENTITY_ego_get_private_key (ego));
394}
395
396/**
397 * Perform the actual resolution, starting with the zone
398 * identified by the given public key.
399 *
400 * @param pkey public key to use for the zone
401 */
402static void
403lookup_with_public_key (struct LookupHandle *handle)
404{
405 handle->pkeym = handle->pkey;
406 GNUNET_break (NULL == handle->id_op);
407 handle->id_op = GNUNET_IDENTITY_get (handle->identity,
408 "gns-short",
409 &identity_shorten_cb,
410 handle);
411 if (NULL == handle->id_op)
412 {
413 GNUNET_break (0);
414 lookup_with_keys (handle, NULL);
415 }
416}
417 366
418/** 367/**
419 * Method called to with the ego we are to use for the lookup, 368 * Method called to with the ego we are to use for the lookup,
@@ -444,6 +393,7 @@ identity_zone_cb (void *cls,
444 json_decref(handle->json_root); 393 json_decref(handle->json_root);
445} 394}
446 395
396
447/** 397/**
448 * Method called to with the ego we are to use for the lookup, 398 * Method called to with the ego we are to use for the lookup,
449 * when the ego is the one for the default master zone. 399 * when the ego is the one for the default master zone.