[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 142/171: -fixes
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 142/171: -fixes |
Date: |
Thu, 04 Jan 2018 16:10:50 +0100 |
This is an automated email from the git hooks/post-receive script.
martin-schanzenbach pushed a commit to branch master
in repository gnunet.
commit 037bf3d5a227287e4b2e9c4dbb2583f39bd8fa20
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Mon Oct 9 11:07:28 2017 +0200
-fixes
---
.../plugin_rest_identity_provider.c | 30 ++++++++++------------
src/identity-provider/test_idp_attribute.sh | 3 ++-
2 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/src/identity-provider/plugin_rest_identity_provider.c
b/src/identity-provider/plugin_rest_identity_provider.c
index 0ba0666d0..f136901a0 100644
--- a/src/identity-provider/plugin_rest_identity_provider.c
+++ b/src/identity-provider/plugin_rest_identity_provider.c
@@ -239,11 +239,6 @@ struct RequestHandle
*/
struct GNUNET_JSONAPI_Document *resp_object;
- /**
- * Resource object
- */
- struct GNUNET_JSONAPI_Resource *json_resource;
-
};
@@ -397,6 +392,7 @@ static void
ticket_collect (void *cls,
const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket)
{
+ struct GNUNET_JSONAPI_Resource *json_resource;
struct RequestHandle *handle = cls;
json_t *value;
char* tmp;
@@ -404,15 +400,15 @@ ticket_collect (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding ticket\n");
tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd,
sizeof (uint64_t));
- handle->json_resource = GNUNET_JSONAPI_resource_new
(GNUNET_REST_JSONAPI_IDENTITY_TICKET,
+ json_resource = GNUNET_JSONAPI_resource_new
(GNUNET_REST_JSONAPI_IDENTITY_TICKET,
tmp);
GNUNET_free (tmp);
- GNUNET_JSONAPI_document_resource_add (handle->resp_object,
handle->json_resource);
+ GNUNET_JSONAPI_document_resource_add (handle->resp_object, json_resource);
tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->identity,
sizeof (struct
GNUNET_CRYPTO_EcdsaPublicKey));
value = json_string (tmp);
- GNUNET_JSONAPI_resource_add_attr (handle->json_resource,
+ GNUNET_JSONAPI_resource_add_attr (json_resource,
"issuer",
value);
GNUNET_free (tmp);
@@ -420,7 +416,7 @@ ticket_collect (void *cls,
tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->audience,
sizeof (struct
GNUNET_CRYPTO_EcdsaPublicKey));
value = json_string (tmp);
- GNUNET_JSONAPI_resource_add_attr (handle->json_resource,
+ GNUNET_JSONAPI_resource_add_attr (json_resource,
"audience",
value);
GNUNET_free (tmp);
@@ -428,7 +424,7 @@ ticket_collect (void *cls,
tmp = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd,
sizeof (uint64_t));
value = json_string (tmp);
- GNUNET_JSONAPI_resource_add_attr (handle->json_resource,
+ GNUNET_JSONAPI_resource_add_attr (json_resource,
"rnd",
value);
GNUNET_free (tmp);
@@ -535,7 +531,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle
*con_handle,
ego_entry = ego_entry->next)
if (0 == strcmp (identity, ego_entry->identifier))
break;
-
+
if (NULL == ego_entry)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -620,14 +616,19 @@ attr_collect (void *cls,
const struct GNUNET_CRYPTO_EcdsaPublicKey *identity,
const struct GNUNET_IDENTITY_PROVIDER_Attribute *attr)
{
+ struct GNUNET_JSONAPI_Resource *json_resource;
struct RequestHandle *handle = cls;
json_t *value;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute: %s\n",
attr->name);
+ json_resource = GNUNET_JSONAPI_resource_new
(GNUNET_REST_JSONAPI_IDENTITY_ATTRIBUTE,
+ attr->name);
+ GNUNET_JSONAPI_document_resource_add (handle->resp_object, json_resource);
+
value = json_string (attr->data);
- GNUNET_JSONAPI_resource_add_attr (handle->json_resource,
- attr->name,
+ GNUNET_JSONAPI_resource_add_attr (json_resource,
+ "value",
value);
json_decref (value);
GNUNET_IDENTITY_PROVIDER_get_attributes_next (handle->attr_it);
@@ -670,9 +671,6 @@ list_attribute_cont (struct GNUNET_REST_RequestHandle
*con_handle,
break;
handle->resp_object = GNUNET_JSONAPI_document_new ();
- handle->json_resource = GNUNET_JSONAPI_resource_new
(GNUNET_REST_JSONAPI_IDENTITY_ATTRIBUTE,
- identity);
- GNUNET_JSONAPI_document_resource_add (handle->resp_object,
handle->json_resource);
if (NULL == ego_entry)
{
diff --git a/src/identity-provider/test_idp_attribute.sh
b/src/identity-provider/test_idp_attribute.sh
index 6c357128f..0b0436ede 100755
--- a/src/identity-provider/test_idp_attribute.sh
+++ b/src/identity-provider/test_idp_attribute.sh
@@ -24,10 +24,11 @@ which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
TEST_ATTR="test"
gnunet-arm -s -c test_idp.conf
+gnunet-arm -i rest -c test_idp.conf
gnunet-identity -C testego -c test_idp.conf
gnunet-identity -C rpego -c test_idp.conf
TEST_KEY=$(gnunet-identity -d -c test_idp.conf | grep testego | awk '{print
$3}')
gnunet-idp -e testego -a email -V address@hidden -c test_idp.conf
gnunet-idp -e testego -a name -V John -c test_idp.conf
-gnunet-namestore -D -z testego -D -c test_idp.conf
+curl localhost:7776/idp/attributes/testego
gnunet-arm -e -c test_idp.conf
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] 131/171: -more revocation, (continued)
- [GNUnet-SVN] [gnunet] 131/171: -more revocation, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 98/171: -add cli, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 92/171: Merge branch 'abe' into identity_abe, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 130/171: -towards ticket revocation, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 109/171: -change to gabe bswabe fork, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 124/171: -add ticket iteration, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 136/171: -fixes, add tests, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 91/171: -fix api, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 57/171: -fixes, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 77/171: -remove reverse record, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 142/171: -fixes,
gnunet <=
- [GNUnet-SVN] [gnunet] 96/171: Merge branch 'abe' into identity_abe, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 135/171: -mem fixes, revocation finish, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 137/171: -fix records, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 148/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 68/171: - merge; service API change, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 116/171: - rework issue api, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 105/171: Merge branch 'abe' into identity_abe, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 115/171: -various fixes; add attribute list API, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 155/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 157/171: -add decrypt stats, gnunet, 2018/01/04