summaryrefslogtreecommitdiff
path: root/src/credential
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2016-12-14 08:18:14 +0100
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2016-12-14 08:18:14 +0100
commit8052eb6445f29eec791e7c473a15334a66c91141 (patch)
tree43807435f1689898de04cb44f0ccbc052b807afd /src/credential
parent80bdda1c79efb648cb56bdfb63da0c2c0db3ff45 (diff)
-fix gns mq; fix serializer
Diffstat (limited to 'src/credential')
-rw-r--r--src/credential/gnunet-credential.c23
-rw-r--r--src/credential/gnunet-service-credential.c41
-rw-r--r--src/credential/plugin_rest_credential.c16
3 files changed, 14 insertions, 66 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;