[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnunet] 49/171: -fix gns mq; fix serializer
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnunet] 49/171: -fix gns mq; fix serializer |
Date: |
Thu, 04 Jan 2018 16:09:17 +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 8052eb6445f29eec791e7c473a15334a66c91141
Author: Schanzenbach, Martin <address@hidden>
AuthorDate: Wed Dec 14 08:18:14 2016 +0100
-fix gns mq; fix serializer
---
src/credential/gnunet-credential.c | 23 +++++------------
src/credential/gnunet-service-credential.c | 41 +++---------------------------
src/credential/plugin_rest_credential.c | 16 +++---------
src/gns/gns_api.c | 12 +++++----
4 files changed, 21 insertions(+), 71 deletions(-)
diff --git a/src/credential/gnunet-credential.c
b/src/credential/gnunet-credential.c
index 82f0e349c..a728939dc 100644
--- a/src/credential/gnunet-credential.c
+++ b/src/credential/gnunet-credential.c
@@ -170,27 +170,18 @@ handle_verify_result (void *cls,
{
for (i=0;i<d_count;i++)
{
- char iss_attr[dc[i].issuer_attribute_len];
char* iss_key = GNUNET_CRYPTO_ecdsa_public_key_to_string
(&dc[i].issuer_key);
char* sub_key = GNUNET_CRYPTO_ecdsa_public_key_to_string
(&dc[i].subject_key);
-
- char sub_attr[dc[i].subject_attribute_len];
- memcpy (iss_attr,
- dc[i].issuer_attribute,
- dc[i].issuer_attribute_len);
- iss_attr[dc[i].issuer_attribute_len] = '\0';
- printf ("%s.%s <- ",iss_key, iss_attr);
- printf ("%s",sub_key);
if (0 != dc[i].subject_attribute_len)
{
- memcpy (sub_attr,
- dc[i].subject_attribute,
- dc[i].subject_attribute_len);
- sub_attr[dc[i].subject_attribute_len] = '\0';
-
- printf (".%s",sub_attr);
+ printf ("%s.%s <- %s.%s\n",
+ iss_key, dc[i].issuer_attribute,
+ sub_key, dc[i].subject_attribute);
+ } else {
+ printf ("%s.%s <- %s\n",
+ iss_key, dc[i].issuer_attribute,
+ sub_key);
}
- printf ("\n");
}
printf ("Successful.\n");
}
diff --git a/src/credential/gnunet-service-credential.c
b/src/credential/gnunet-service-credential.c
index 74e1e1cd2..01b955726 100644
--- a/src/credential/gnunet-service-credential.c
+++ b/src/credential/gnunet-service-credential.c
@@ -457,12 +457,12 @@ send_lookup_response (struct VerifyRequestHandle *vrh)
dd[i].issuer_key = dq_entry->delegation_chain_entry->issuer_key;
dd[i].subject_key = dq_entry->delegation_chain_entry->subject_key;
dd[i].issuer_attribute =
dq_entry->delegation_chain_entry->issuer_attribute;
- dd[i].issuer_attribute_len = strlen
(dq_entry->delegation_chain_entry->issuer_attribute);
+ dd[i].issuer_attribute_len = strlen
(dq_entry->delegation_chain_entry->issuer_attribute)+1;
dd[i].subject_attribute_len = 0;
if (NULL != dq_entry->delegation_chain_entry->subject_attribute)
{
dd[i].subject_attribute =
dq_entry->delegation_chain_entry->subject_attribute;
- dd[i].subject_attribute_len =
strlen(dq_entry->delegation_chain_entry->subject_attribute);
+ dd[i].subject_attribute_len =
strlen(dq_entry->delegation_chain_entry->subject_attribute)+1;
}
dq_entry = dq_entry->parent;
}
@@ -471,7 +471,7 @@ send_lookup_response (struct VerifyRequestHandle *vrh)
* Get serialized record data
* Append at the end of rmsg
*/
- cred.issuer_key = vrh->credential->issuer_key;
+ cred.issuer_key = vrh->credential->issuer_key;
cred.subject_key = vrh->credential->issuer_key;
cred.issuer_attribute_len = strlen((char*)&vrh->credential[1]);
cred.issuer_attribute = (char*)&vrh->credential[1];
@@ -496,41 +496,6 @@ send_lookup_response (struct VerifyRequestHandle *vrh)
size,
(char*)&rmsg[1]));
-
- /*for (dq_entry = vrh->chain_end; NULL != dq_entry; dq_entry =
dq_entry->parent)
- {
- if (NULL == dq_entry->delegation_chain_entry)
- break;
- size += sizeof (struct GNUNET_CREDENTIAL_DelegationChainEntry);
- if (NULL != dq_entry->delegation_chain_entry->subject_attribute)
- size += strlen (dq_entry->delegation_chain_entry->subject_attribute) + 1;
- size += strlen(dq_entry->delegation_chain_entry->issuer_attribute) + 1;
- d_count++;
- }*/
-
- //TODO refactor into serializer module
- /*write_ptr = (char*)&rmsg[1] + vrh->credential_size;
- for (dq_entry = vrh->chain_end; NULL != dq_entry; dq_entry =
dq_entry->parent)
- {
- if (NULL == dq_entry->delegation_chain_entry)
- break;
- memcpy (write_ptr,
- dq_entry->delegation_chain_entry,
- sizeof (struct GNUNET_CREDENTIAL_DelegationChainEntry));
- write_ptr += sizeof (struct GNUNET_CREDENTIAL_DelegationChainEntry);
- if (NULL != dq_entry->delegation_chain_entry->subject_attribute)
- {
- GNUNET_snprintf (write_ptr,
- strlen (dq_entry->delegation_chain_entry->subject_attribute) + 2,
- "%s;",
- dq_entry->delegation_chain_entry->subject_attribute);
- write_ptr += strlen (dq_entry->delegation_chain_entry->subject_attribute)
+ 1;
- }
- memcpy (write_ptr,
- dq_entry->delegation_chain_entry->issuer_attribute,
- strlen(dq_entry->delegation_chain_entry->issuer_attribute));
- write_ptr += strlen(dq_entry->delegation_chain_entry->issuer_attribute) +
1;
- }*/
GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq(vrh->client),
env);
GNUNET_CONTAINER_DLL_remove (vrh_head, vrh_tail, vrh);
diff --git a/src/credential/plugin_rest_credential.c
b/src/credential/plugin_rest_credential.c
index 798f76049..cdd0e86e9 100644
--- a/src/credential/plugin_rest_credential.c
+++ b/src/credential/plugin_rest_credential.c
@@ -190,8 +190,6 @@ attribute_delegation_to_json (struct
GNUNET_CREDENTIAL_Delegation *delegation_ch
{
char *subject;
char *issuer;
- char iss_attribute[delegation_chain_entry->issuer_attribute_len];
- char sub_attribute[delegation_chain_entry->subject_attribute_len];
json_t *attr_obj;
issuer = GNUNET_CRYPTO_ecdsa_public_key_to_string
(&delegation_chain_entry->issuer_key);
@@ -208,22 +206,16 @@ attribute_delegation_to_json (struct
GNUNET_CREDENTIAL_Delegation *delegation_ch
return NULL;
}
attr_obj = json_object ();
- memcpy (iss_attribute,
- delegation_chain_entry->issuer_attribute,
- delegation_chain_entry->issuer_attribute_len);
- iss_attribute[delegation_chain_entry->issuer_attribute_len] = '\0';
json_object_set_new (attr_obj, "subject", json_string (subject));
json_object_set_new (attr_obj, "issuer", json_string (issuer));
- json_object_set_new (attr_obj, "issuer_attribute", json_string
(iss_attribute));
+ json_object_set_new (attr_obj, "issuer_attribute",
+ json_string (delegation_chain_entry->issuer_attribute));
if (0 < delegation_chain_entry->subject_attribute_len)
{
- memcpy (sub_attribute,
- delegation_chain_entry->subject_attribute,
- delegation_chain_entry->subject_attribute_len);
- sub_attribute[delegation_chain_entry->subject_attribute_len] = '\0';
- json_object_set_new (attr_obj, "subject_attribute", json_string
(sub_attribute));
+ json_object_set_new (attr_obj, "subject_attribute",
+ json_string
(delegation_chain_entry->subject_attribute));
}
GNUNET_free (subject);
return attr_obj;
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index acb56f2c4..5ad7b4fae 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -354,11 +354,7 @@ handle_result (void *cls,
return;
proc = lr->lookup_proc;
proc_cls = lr->proc_cls;
- GNUNET_CONTAINER_DLL_remove (handle->lookup_head,
- handle->lookup_tail,
- lr);
- GNUNET_free (lr->env);
- GNUNET_free (lr);
+
GNUNET_assert (GNUNET_OK ==
GNUNET_GNSRECORD_records_deserialize (mlen,
(const char*)
&lookup_msg[1],
@@ -367,6 +363,12 @@ handle_result (void *cls,
proc (proc_cls,
rd_count,
rd);
+ GNUNET_CONTAINER_DLL_remove (handle->lookup_head,
+ handle->lookup_tail,
+ lr);
+ if (NULL != lr->env)
+ GNUNET_MQ_discard (lr->env);
+ GNUNET_free (lr);
}
--
To stop receiving notification emails like this one, please contact
address@hidden
- [GNUnet-SVN] [gnunet] 55/171: Merge remote-tracking branch 'origin/master' into credentials, (continued)
- [GNUnet-SVN] [gnunet] 55/171: Merge remote-tracking branch 'origin/master' into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 53/171: -tests, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 59/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 58/171: -fix rest issue, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 50/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 66/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 54/171: -fix rest; prelim test;, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 61/171: Merge remote-tracking branch 'origin/master' into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 56/171: -refactoring, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 67/171: Merge remote-tracking branch 'origin/master' into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 49/171: -fix gns mq; fix serializer,
gnunet <=
- [GNUnet-SVN] [gnunet] 63/171: -update rest, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 64/171: -add collect rest; fixes, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 69/171: Merge remote-tracking branch 'origin/master' into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 65/171: -add tokens for credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 73/171: -fix, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 52/171: -fixes, prettify, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 80/171: Merge remote-tracking branch 'origin/master' into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 48/171: -add serializer, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 84/171: Merge remote-tracking branch 'origin/master' into credentials, gnunet, 2018/01/04
- [GNUnet-SVN] [gnunet] 81/171: -fix 0-term, gnunet, 2018/01/04