{
GNUNET_break (0);
GNUNET_free (crd);
+ GNUNET_free (cred);
return NULL;
}
cred->signature = crd->signature;
ret += dd[i].issuer_attribute_len + dd[i].subject_attribute_len;
}
return ret+GNUNET_CREDENTIAL_credentials_get_size(c_count, cd);
- return ret;
}
/**
fprintf (stderr,
_("Failed to connect to CREDENTIAL\n"));
GNUNET_SCHEDULER_shutdown ();
+ return;
}
if (NULL == issuer_attr)
{
fprintf (stderr,
_("You must provide issuer the attribute\n"));
GNUNET_SCHEDULER_shutdown ();
+ return;
}
if (NULL == ego_name)
_("Issuer public key `%s' is not well-formed\n"),
issuer_key);
GNUNET_SCHEDULER_shutdown ();
+ return;
}
credential = GNUNET_CREDENTIAL_connect (cfg);
fprintf (stderr,
_("Failed to connect to CREDENTIAL\n"));
GNUNET_SCHEDULER_shutdown ();
+ return;
}
if (NULL == issuer_attr || NULL == subject_credential)
{
fprintf (stderr,
_("You must provide issuer and subject attributes\n"));
GNUNET_SCHEDULER_shutdown ();
+ return;
}
//Subject credentials are comma separated
"Invalid subject credentials\n");
GNUNET_free (tmp);
GNUNET_SCHEDULER_shutdown ();
+ return;
}
int count = 1;
int i;
{
GNUNET_free ((char*)credentials[i].issuer_attribute);
}
+ GNUNET_free (tmp);
} else if (GNUNET_YES == create_cred) {
if (NULL == ego_name)
{
strcpy (issuer_attribute_name,
ds_entry->unresolved_attribute_delegation);
char *next_attr = strtok (issuer_attribute_name, ".");
+ if (NULL == next_attr)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to parse next attribute\n");
+ continue;
+ }
GNUNET_asprintf (&lookup_attribute,
"%s.gnu",
next_attr);
* Check for attributes from the issuer and follow the chain
* till you get the required subject's attributes
*/
- char issuer_attribute_name[strlen (vrh->issuer_attribute)];
+ char issuer_attribute_name[strlen (vrh->issuer_attribute) + strlen (".gnu") + 1];
strcpy (issuer_attribute_name,
vrh->issuer_attribute);
strcpy (issuer_attribute_name + strlen (vrh->issuer_attribute),
vrh->issuer_key = v_msg->issuer_key;
vrh->subject_key = v_msg->subject_key;
vrh->issuer_attribute = GNUNET_strdup (issuer_attribute);
- if (NULL == issuer_attribute)
+ if (0 == strlen (issuer_attribute))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No issuer attribute provided!\n");
&vrh->subject_key);
vrh->issuer_attribute = GNUNET_strdup (issuer_attribute);
- if (NULL == issuer_attribute)
+ if (0 == strlen (issuer_attribute))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"No issuer attribute provided!\n");
}
attr = (const char *) &c_msg[1];
- if ( ('\0' != attr[ntohs(c_msg->header.size) - sizeof (struct CollectMessage) - 1]) ||
+ if ( ('\0' != attr[msg_size - sizeof (struct CollectMessage) - 1]) ||
(strlen (attr) > GNUNET_CREDENTIAL_MAX_LENGTH) )
{
GNUNET_break (0);
GNUNET_free (tmp_str);
tmp_str = GNUNET_strdup (s);
token = strtok (tmp_str, ",");
+ if (NULL == token)
+ {
+ GNUNET_free (tmp_str);
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Malformed string %s\n", s);
+ return GNUNET_SYSERR;
+ }
struct GNUNET_CREDENTIAL_DelegationSet set[entries];
for (i=0;i<entries;i++)
{
set);
if (-1 == tmp_data_size)
+ {
+ GNUNET_free (tmp_str);
return GNUNET_SYSERR;
+ }
*data_size += tmp_data_size;
*data = sets = GNUNET_malloc (*data_size);
GNUNET_CREDENTIAL_delegation_set_serialize (entries,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Missing subject\n");
- GNUNET_free (entity_attr);
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Malformed subject\n");
- GNUNET_free (entity_attr);
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Missing subject key\n");
- GNUNET_free (entity_attr);
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Malformed subject\n");
- GNUNET_free (entity_attr);
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
&handle->subject_key)) {
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Malformed subject key\n");
- GNUNET_free (entity_attr);
GNUNET_SCHEDULER_add_now (&do_error, handle);
return;
}
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Subject malformed\n");
+ GNUNET_free (issuer);
return;
}
GNUNET_asprintf (&id,
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Subject malformed\n");
+ GNUNET_free (id);
+ GNUNET_free (issuer);
return;
}
GNUNET_STRINGS_base64_encode ((char*)&cred->signature,
}
expiration_str = GNUNET_CONTAINER_multihashmap_get (handle->rest_handle->url_param_map,
&key);
+ if ( NULL == expiration_str )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Expiration malformed\n");
+ GNUNET_SCHEDULER_add_now (&do_error, handle);
+ return;
+ }
+
if (GNUNET_OK == GNUNET_STRINGS_fancy_time_to_relative (expiration_str,
&etime_rel))
{
&type_str),
GNUNET_GETOPT_OPTION_END
};
- GNUNET_PROGRAM_run (argc, argv, "ct",
+ return (GNUNET_OK == GNUNET_PROGRAM_run (argc, argv, "ct",
"ct", options,
- &run, NULL);
- return ret;
+ &run, NULL));
}
bootstrap_abe_error (void *cls)
{
struct AbeBootstrapHandle *abh = cls;
- GNUNET_free (abh);
abh->proc (abh->proc_cls, NULL);
GNUNET_free (abh);
}
rh->abe_key,
(void**)&enc_buf);
GNUNET_free (buf);
+ if (GNUNET_SYSERR == enc_size)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Unable to re-encrypt with policy %s\n",
+ policy);
+ GNUNET_free (policy);
+ send_revocation_finished (rh, GNUNET_SYSERR);
+ cleanup_revoke_ticket_handle (rh);
+ return;
+ }
GNUNET_free (policy);
+
rd[0].data_size = enc_size + sizeof (uint32_t);
rd_buf = GNUNET_malloc (rd[0].data_size);
attr_ver = htonl (rh->attrs->list_head->claim->version);
{
if (NULL != handle->key)
GNUNET_ABE_cpabe_delete_key (handle->key,
- GNUNET_YES);
+ GNUNET_YES);
if (NULL != handle->attrs)
GNUNET_IDENTITY_ATTRIBUTE_list_destroy (handle->attrs);
GNUNET_free (handle);
{
decrypt_duration = GNUNET_TIME_absolute_get ();
attr_len = GNUNET_ABE_cpabe_decrypt (rd->data + sizeof (uint32_t),
- rd->data_size - sizeof (uint32_t),
- handle->key,
- (void**)&data);
+ rd->data_size - sizeof (uint32_t),
+ handle->key,
+ (void**)&data);
if (GNUNET_SYSERR != attr_len)
{
GNUNET_STATISTICS_update (stats,
attr_le = GNUNET_new (struct GNUNET_IDENTITY_ATTRIBUTE_ClaimListEntry);
attr_le->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize (data,
- attr_len);
+ attr_len);
attr_le->claim->version = ntohl(*(uint32_t*)rd->data);
GNUNET_CONTAINER_DLL_insert (handle->attrs->list_head,
handle->attrs->list_tail,
crm->identity = handle->ticket.identity;
data_tmp = (char *) &crm[1];
GNUNET_IDENTITY_ATTRIBUTE_list_serialize (handle->attrs,
- data_tmp);
+ data_tmp);
GNUNET_MQ_send (handle->client->mq, env);
cleanup_consume_ticket_handle (handle);
}
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Scopes %s\n", scopes);
handle->key = GNUNET_ABE_cpabe_deserialize_key ((void*)(buf + strlen (scopes) + 1),
- rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)
- - strlen (scopes) - 1);
+ rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)
+ - strlen (scopes) - 1);
for (scope = strtok (scopes, ","); NULL != scope; scope = strtok (NULL, ","))
{
buf = GNUNET_malloc (buf_size);
GNUNET_IDENTITY_ATTRIBUTE_serialize (as_handle->claim,
- buf);
+ buf);
GNUNET_asprintf (&policy,
"%s_%lu",
* Encrypt the attribute value and store in namestore
*/
enc_size = GNUNET_ABE_cpabe_encrypt (buf,
- buf_size,
- policy, //Policy
- as_handle->abe_key,
- (void**)&enc_buf);
+ buf_size,
+ policy, //Policy
+ as_handle->abe_key,
+ (void**)&enc_buf);
+ if (GNUNET_SYSERR == enc_size)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to encrypt with policy %s\n",
+ policy);
+ cleanup_as_handle (as_handle);
+ GNUNET_free (buf);
+ GNUNET_free (policy);
+ GNUNET_SCHEDULER_add_now (&do_shutdown, NULL);
+ return;
+ }
GNUNET_free (buf);
GNUNET_free (policy);
rd[0].data_size = enc_size + sizeof (uint32_t);
as_handle = GNUNET_new (struct AttributeStoreHandle);
as_handle->claim = GNUNET_IDENTITY_ATTRIBUTE_deserialize ((char*)&sam[1],
- data_len);
+ data_len);
as_handle->r_id = ntohl (sam->id);
as_handle->identity = sam->identity;
attrs[0] = policy;
attrs[1] = 0;
key = GNUNET_ABE_cpabe_create_key (ai->abe_key,
- attrs);
+ attrs);
msg_extra_len = GNUNET_ABE_cpabe_decrypt (rd->data+sizeof (uint32_t),
- rd->data_size-sizeof (uint32_t),
- key,
- (void**)&attr_ser);
+ rd->data_size-sizeof (uint32_t),
+ key,
+ (void**)&attr_ser);
+ if (GNUNET_SYSERR == msg_extra_len) {
+ GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it);
+ return;
+ }
GNUNET_ABE_cpabe_delete_key (key,
- GNUNET_YES);
+ GNUNET_YES);
//GNUNET_free (policy);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Found attribute: %s\n", label);
GNUNET_IDENTITY_ATTRIBUTE_list_destroy (attrs);
}
}
- op->ar_cb (op->cls,
- NULL,
- NULL);
- GNUNET_CONTAINER_DLL_remove (h->op_head,
- h->op_tail,
- op);
- GNUNET_free (op);
+ if (NULL != op)
+ {
+ op->ar_cb (op->cls,
+ NULL,
+ NULL);
+ GNUNET_CONTAINER_DLL_remove (h->op_head,
+ h->op_tail,
+ op);
+ GNUNET_free (op);
+ }
return;
}
GNUNET_assert (0);
sam->id = htonl (op->r_id);
GNUNET_IDENTITY_ATTRIBUTE_serialize (attr,
- (char*)&sam[1]);
+ (char*)&sam[1]);
sam->attr_len = htons (attr_len);
if (NULL != h->mq)
tim->id = htonl (op->r_id);
GNUNET_IDENTITY_ATTRIBUTE_list_serialize (attrs,
- (char*)&tim[1]);
+ (char*)&tim[1]);
tim->attr_len = htons (attr_len);
if (NULL != h->mq)