{
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");
}
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;
}
* 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];
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);
{
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);
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;
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],
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);
}