aboutsummaryrefslogtreecommitdiff
path: root/src/identity/plugin_rest_identity.c
diff options
context:
space:
mode:
authorPhil <phil.buschmann@tum.de>2018-07-25 17:43:37 +0200
committerPhil <phil.buschmann@tum.de>2018-07-25 17:43:37 +0200
commit4992eacc10bedaa0edfa03b401253408c6267798 (patch)
treed3b4889eb16017900c7a1ce7dab589f97a4ce0db /src/identity/plugin_rest_identity.c
parent9009fb0aa496cd72ff6f1ea3d20ac4a547055e1b (diff)
downloadgnunet-4992eacc10bedaa0edfa03b401253408c6267798.tar.gz
gnunet-4992eacc10bedaa0edfa03b401253408c6267798.zip
added name search
Diffstat (limited to 'src/identity/plugin_rest_identity.c')
-rw-r--r--src/identity/plugin_rest_identity.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c
index f1d33b0f3..59dad66c7 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -346,7 +346,8 @@ ego_get (struct GNUNET_REST_RequestHandle *con_handle, const char* url,
346 handle->subsystem); 346 handle->subsystem);
347 347
348 handle->op = GNUNET_IDENTITY_get (handle->identity_handle, 348 handle->op = GNUNET_IDENTITY_get (handle->identity_handle,
349 handle->subsystem, &ego_get_for_subsystem, 349 handle->subsystem,
350 &ego_get_for_subsystem,
350 handle); 351 handle);
351 if (NULL == handle->op) 352 if (NULL == handle->op)
352 { 353 {
@@ -359,9 +360,10 @@ ego_get (struct GNUNET_REST_RequestHandle *con_handle, const char* url,
359 egoname = NULL; 360 egoname = NULL;
360 keystring = NULL; 361 keystring = NULL;
361 362
362 //if only one identity requested 363 //if only one identity requested with key
363 GNUNET_CRYPTO_hash (GNUNET_REST_PARAM_PUBKEY, 364 GNUNET_CRYPTO_hash (GNUNET_REST_PARAM_PUBKEY,
364 strlen (GNUNET_REST_PARAM_PUBKEY), &key); 365 strlen (GNUNET_REST_PARAM_PUBKEY),
366 &key);
365 if ( GNUNET_YES 367 if ( GNUNET_YES
366 == GNUNET_CONTAINER_multihashmap_contains ( 368 == GNUNET_CONTAINER_multihashmap_contains (
367 handle->rest_handle->url_param_map, &key)) 369 handle->rest_handle->url_param_map, &key))
@@ -379,6 +381,21 @@ ego_get (struct GNUNET_REST_RequestHandle *con_handle, const char* url,
379 } 381 }
380 } 382 }
381 383
384 //if only one identity requested with name
385 if (NULL == egoname)
386 {
387 GNUNET_CRYPTO_hash (GNUNET_REST_PARAM_NAME,
388 strlen (GNUNET_REST_PARAM_NAME),
389 &key);
390 if ( GNUNET_YES
391 == GNUNET_CONTAINER_multihashmap_contains (
392 handle->rest_handle->url_param_map, &key))
393 {
394 egoname = GNUNET_CONTAINER_multihashmap_get (
395 handle->rest_handle->url_param_map, &key);
396 }
397 }
398
382 json_root = json_array (); 399 json_root = json_array ();
383 //Return ego/egos 400 //Return ego/egos
384 for (ego_entry = handle->ego_head; 401 for (ego_entry = handle->ego_head;