diff options
-rw-r--r-- | src/identity/plugin_rest_identity.c | 23 | ||||
-rwxr-xr-x | src/identity/test_plugin_rest_identity.sh | 6 |
2 files changed, 26 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; |
diff --git a/src/identity/test_plugin_rest_identity.sh b/src/identity/test_plugin_rest_identity.sh index b48becc45..170f3e928 100755 --- a/src/identity/test_plugin_rest_identity.sh +++ b/src/identity/test_plugin_rest_identity.sh | |||
@@ -84,6 +84,12 @@ fi | |||
84 | 84 | ||
85 | id="$(gnunet-identity -d | grep "Test - " | sed "s/Test - //g")" | 85 | id="$(gnunet-identity -d | grep "Test - " | sed "s/Test - //g")" |
86 | #Test GET (one identity) for success and error json | 86 | #Test GET (one identity) for success and error json |
87 | cache="$(curl --silent "${link_to_api}?name=Test" | grep "error")" | ||
88 | if [ "" != "$cache" ] | ||
89 | then | ||
90 | exit 1 | ||
91 | fi | ||
92 | #Test GET (one identity) for success and error json | ||
87 | cache="$(curl --silent "${link_to_api}?pubkey=$id" | grep "error")" | 93 | cache="$(curl --silent "${link_to_api}?pubkey=$id" | grep "error")" |
88 | if [ "" != "$cache" ] | 94 | if [ "" != "$cache" ] |
89 | then | 95 | then |