GNUNET_RECLAIM_cancel (reclaim_op);
if (NULL != attr_iterator)
GNUNET_RECLAIM_get_attributes_stop (attr_iterator);
+ if (NULL != attest_iterator)
+ GNUNET_RECLAIM_get_attestations_stop (attest_iterator);
if (NULL != ticket_iterator)
GNUNET_RECLAIM_ticket_iteration_stop (ticket_iterator);
if (NULL != reclaim_handle)
{
claim->attestation = attestation;
}
- else
reclaim_op = GNUNET_RECLAIM_attribute_store (reclaim_handle,
pkey,
claim,
attest_iter_finished (void *cls)
{
attest_iterator = NULL;
- //Add new attestation
+
+ // Add new attestation
if ((NULL != attestation_name) &&
(NULL != attr_value))
{
struct GNUNET_RECLAIM_Attestation *attestation =
GNUNET_RECLAIM_attestation_new (attestation_name,
- GNUNET_RECLAIM_ATTESTATION_TYPE_JWT, //FIXME hardcoded
+ GNUNET_RECLAIM_ATTESTATION_TYPE_JWT, // FIXME hardcoded
attr_value,
strlen (attr_value));
reclaim_op = GNUNET_RECLAIM_attestation_store (reclaim_handle,
return;
}
- if (! list_attestations)
+ if (list_attestations)
{
- attr_iterator = GNUNET_RECLAIM_get_attributes_start (reclaim_handle,
- pkey,
- &iter_error,
- NULL,
- &iter_cb,
- NULL,
- &iter_finished,
- NULL);
-
+ cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
+ return;
}
- cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
+ attr_iterator = GNUNET_RECLAIM_get_attributes_start (reclaim_handle,
+ pkey,
+ &iter_error,
+ NULL,
+ &iter_cb,
+ NULL,
+ &iter_finished,
+ NULL);
+
}
attest_str = GNUNET_RECLAIM_attestation_value_to_string (attest->type,
attest->data,
attest->data_size);
- attest_type = GNUNET_RECLAIM_attribute_number_to_typename (attest->type);
+ attest_type = GNUNET_RECLAIM_attestation_number_to_typename (attest->type);
id = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(attest->id));
fprintf (stdout,
"Name: %s; Value: %s (%s); Flag %u; ID: %s\n",
NULL);
return;
}
- if (list_attestations)
- {
- attest_iterator = GNUNET_RECLAIM_get_attestations_start (reclaim_handle,
- pkey,
- &iter_error,
- NULL,
- &attest_iter_cb,
- NULL,
- &
- attest_iter_finished,
- NULL);
- return;
- }
if ((NULL != rp) &&
(GNUNET_OK !=
attr_list = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
claim = NULL;
+ attest_iterator = GNUNET_RECLAIM_get_attestations_start (reclaim_handle,
+ pkey,
+ &iter_error,
+ NULL,
+ &attest_iter_cb,
+ NULL,
+ &
+ attest_iter_finished,
+ NULL);
+
}
GNUNET_GETOPT_option_string ('I',
"Attestation ID",
"ATTESTATION_ID",
- gettext_noop ("Attestation to use for attribute"),
+ gettext_noop (
+ "Attestation to use for attribute"),
&attestation_id),
GNUNET_GETOPT_option_string ('N',
"attestation-name",
struct GNUNET_MQ_Envelope *env;
char *data_tmp;
- if (rd_count == 0)
+ if ((rd_count != 1) ||
+ (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE != rd->record_type))
{
GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
return;
}
-
- for (int i = 0; i<rd_count; i++)
- {
- if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE != rd[i].record_type)
- continue;
- struct AttributeResultMessage *arm;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
- label);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending ATTRIBUTE_RESULT message\n");
- env = GNUNET_MQ_msg_extra (arm,
- rd[i].data_size,
- GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
- arm->id = htonl (ai->request_id);
- arm->attr_len = htons (rd[i].data_size);
- GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
- data_tmp = (char *) &arm[1];
- GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
- GNUNET_MQ_send (ai->client->mq, env);
- }
+ struct AttributeResultMessage *arm;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n",
+ label);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending ATTRIBUTE_RESULT message\n");
+ env = GNUNET_MQ_msg_extra (arm,
+ rd->data_size,
+ GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT);
+ arm->id = htonl (ai->request_id);
+ arm->attr_len = htons (rd->data_size);
+ GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
+ data_tmp = (char *) &arm[1];
+ GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
+ GNUNET_MQ_send (ai->client->mq, env);
}
struct GNUNET_MQ_Envelope *env;
char *data_tmp;
- if (rd_count == 0)
+ if ((rd_count != 1) ||
+ (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION != rd->record_type))
{
GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1);
return;
}
- for (int i = 0; i<rd_count; i++)
- {
- if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION != rd[i].record_type)
- continue;
- struct AttestationResultMessage *arm;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n",
- label);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Sending ATTESTATION_RESULT message\n");
- env = GNUNET_MQ_msg_extra (arm,
- rd[i].data_size,
- GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT);
- arm->id = htonl (ai->request_id);
- arm->attestation_len = htons (rd[i].data_size);
- GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
- data_tmp = (char *) &arm[1];
- GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size);
- GNUNET_MQ_send (ai->client->mq, env);
- }
+ struct AttestationResultMessage *arm;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n",
+ label);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Sending ATTESTATION_RESULT message\n");
+ env = GNUNET_MQ_msg_extra (arm,
+ rd->data_size,
+ GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT);
+ arm->id = htonl (ai->request_id);
+ arm->attestation_len = htons (rd->data_size);
+ GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity);
+ data_tmp = (char *) &arm[1];
+ GNUNET_memcpy (data_tmp, rd->data, rd->data_size);
+ GNUNET_MQ_send (ai->client->mq, env);
}