along with this program. If not, see <http://www.gnu.org/licenses/>.
SPDX-License-Identifier: AGPL3.0-or-later
- */
+ */
/**
* @author Martin Schanzenbach
{
struct RevokedAttributeEntry *ae;
struct TicketRecordsEntry *le;
+
if (NULL != rh->ns_qe)
GNUNET_NAMESTORE_cancel (rh->ns_qe);
if (NULL != rh->ns_it)
ticket_processed (void *cls, int32_t success, const char *emsg)
{
struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+
rvk->ns_qe = NULL;
GNUNET_SCHEDULER_add_now (&process_tickets, rvk);
}
struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
struct TicketRecordsEntry *le;
struct RevokedAttributeEntry *ae;
+
if (NULL == rvk->tickets_to_update_head)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
continue;
for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
{
- if (0 != memcmp (rd[i].data, &ae->old_id, sizeof (uint64_t)))
+ if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(uint64_t)))
continue;
rd[i].data = &ae->new_id;
}
rvk_ticket_update_finished (void *cls)
{
struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+
rvk->ns_it = NULL;
GNUNET_SCHEDULER_add_now (&process_tickets, rvk);
}
continue;
for (ae = rvk->attrs_head; NULL != ae; ae = ae->next)
{
- if (0 != memcmp (rd[i].data, &ae->old_id, sizeof (uint64_t)))
+ if (0 != memcmp (rd[i].data, &ae->old_id, sizeof(uint64_t)))
continue;
has_changed = GNUNET_YES;
break;
rvk_ns_iter_err (void *cls)
{
struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+
rvk->ns_it = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Namestore error on revocation (id=%" PRIu64 "\n",
rvk_ns_err (void *cls)
{
struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+
rvk->ns_qe = NULL;
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Namestore error on revocation (id=%" PRIu64 "\n",
del_attr_finished (void *cls, int32_t success, const char *emsg)
{
struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+
rvk->ns_qe = NULL;
if (GNUNET_SYSERR == success)
{
{
struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
char *label;
+
rvk->ns_qe = NULL;
if (GNUNET_SYSERR == success)
{
return;
}
label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id,
- sizeof (uint64_t));
+ sizeof(uint64_t));
GNUNET_assert (NULL != label);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing attribute %s\n", label);
rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
struct RevokedAttributeEntry *le;
char *new_label;
char *attr_data;
+
rvk->ns_qe = NULL;
if (0 == rd_count)
{
new_rd.data_size = GNUNET_RECLAIM_ATTRIBUTE_serialize (claim, attr_data);
new_rd.data = attr_data;
new_label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->new_id,
- sizeof (uint64_t));
+ sizeof(uint64_t));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label);
rvk->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
&rvk->identity,
return;
}
label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id,
- sizeof (uint64_t));
+ sizeof(uint64_t));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving attribute %s\n", label);
rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh,
remove_ticket_cont (void *cls, int32_t success, const char *emsg)
{
struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+
rvk->ns_qe = NULL;
if (GNUNET_SYSERR == success)
{
{
struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
struct RevokedAttributeEntry *le;
+
rvk->ns_qe = NULL;
/**
* Temporarily store attribute references.
rvk_attrs_err_cb (void *cls)
{
struct RECLAIM_TICKETS_RevokeHandle *rvk = cls;
+
rvk->cb (rvk->cb_cls, GNUNET_SYSERR);
cleanup_rvk (rvk);
}
rvk->ticket = *ticket;
GNUNET_CRYPTO_ecdsa_key_get_public (&rvk->identity, &rvk->ticket.identity);
/** Get shared attributes **/
- label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof (uint64_t));
+ label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(uint64_t));
GNUNET_assert (NULL != label);
rvk->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh,
identity,
/*******************************
- * Ticket consume
- *******************************/
+* Ticket consume
+*******************************/
/**
* Cleanup ticket consume handle
cleanup_cth (struct RECLAIM_TICKETS_ConsumeHandle *cth)
{
struct ParallelLookup *lu;
+
if (NULL != cth->lookup_request)
GNUNET_GNS_lookup_cancel (cth->lookup_request);
if (NULL != cth->kill_task)
struct ParallelLookup *parallel_lookup = cls;
struct RECLAIM_TICKETS_ConsumeHandle *cth = parallel_lookup->handle;
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *attr_le;
+
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Parallel lookup finished (count=%u)\n",
rd_count);
"attribute_lookup_time_total",
GNUNET_TIME_absolute_get_duration (
parallel_lookup->lookup_start_time)
- .rel_value_us,
+ .rel_value_us,
GNUNET_YES);
GNUNET_STATISTICS_update (stats, "attribute_lookups_count", 1, GNUNET_YES);
"reclaim_authz_lookup_time_total",
GNUNET_TIME_absolute_get_duration (
cth->lookup_start_time)
- .rel_value_us,
+ .rel_value_us,
GNUNET_YES);
GNUNET_STATISTICS_update (stats,
"reclaim_authz_lookups_count",
{
struct RECLAIM_TICKETS_ConsumeHandle *cth;
char *label;
+
cth = GNUNET_new (struct RECLAIM_TICKETS_ConsumeHandle);
cth->identity = *id;
cth->cb = cb;
cth->cb_cls = cb_cls;
label =
- GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd, sizeof (uint64_t));
+ GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd, sizeof(uint64_t));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Looking for AuthZ info under %s\n",
label);
/*******************************
- * Ticket issue
- *******************************/
+* Ticket issue
+*******************************/
/**
* Cleanup ticket consume handle
list_len++;
attrs_record =
- GNUNET_malloc (list_len * sizeof (struct GNUNET_GNSRECORD_Data));
+ GNUNET_malloc (list_len * sizeof(struct GNUNET_GNSRECORD_Data));
i = 0;
for (le = ih->attrs->list_head; NULL != le; le = le->next)
{
attrs_record[i].data = &le->claim->id;
- attrs_record[i].data_size = sizeof (le->claim->id);
+ attrs_record[i].data_size = sizeof(le->claim->id);
/**
* FIXME: Should this be the attribute expiration time or ticket
* refresh interval? Probably min(attrs.expiration)
i++;
}
attrs_record[i].data = &ih->ticket;
- attrs_record[i].data_size = sizeof (struct GNUNET_RECLAIM_Ticket);
+ attrs_record[i].data_size = sizeof(struct GNUNET_RECLAIM_Ticket);
attrs_record[i].expiration_time = ticket_refresh_interval.rel_value_us;
attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET;
attrs_record[i].flags =
GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE;
label =
- GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd, sizeof (uint64_t));
+ GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd, sizeof(uint64_t));
// Publish record
ih->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
&ih->identity,
}
/*************************************************
- * Ticket iteration (finding a specific ticket)
- *************************************************/
+* Ticket iteration (finding a specific ticket)
+*************************************************/
/**
filter_tickets_error_cb (void *cls)
{
struct TicketIssueHandle *tih = cls;
+
tih->ns_it = NULL;
tih->cb (tih->cb_cls,
&tih->ticket,
// figure out the number of requested attributes
struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
unsigned int attr_cnt = 0;
+
for (le = tih->attrs->list_head; NULL != le; le = le->next)
attr_cnt++;
// cmp audience
if (0 == memcmp (&tih->ticket.audience,
&ticket->audience,
- sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)))
+ sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)))
{
tih->ticket = *ticket;
continue;
le->claim->id);
- if (0 == memcmp (rd[i].data, &le->claim->id, sizeof (uint64_t)))
+ if (0 == memcmp (rd[i].data, &le->claim->id, sizeof(uint64_t)))
found_attrs_cnt++;
}
}
* If we found a matching ticket, return that to the caller and
* we are done.
*/
- if (attr_cnt == found_attrs_cnt && NULL != ticket)
+ if ((attr_cnt == found_attrs_cnt)&&(NULL != ticket))
{
GNUNET_NAMESTORE_zone_iteration_stop (tih->ns_it);
tih->cb (tih->cb_cls, &tih->ticket, GNUNET_OK, NULL);
filter_tickets_finished_cb (void *cls)
{
struct TicketIssueHandle *tih = cls;
+
GNUNET_CRYPTO_ecdsa_key_get_public (&tih->identity, &tih->ticket.identity);
tih->ticket.rnd =
GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX);
void *cb_cls)
{
struct TicketIssueHandle *tih;
+
tih = GNUNET_new (struct TicketIssueHandle);
tih->cb = cb;
tih->cb_cls = cb_cls;
/************************************
- * Ticket iteration
- ************************************/
+* Ticket iteration
+************************************/
/**
* Cleanup ticket iterator
collect_tickets_finished_cb (void *cls)
{
struct RECLAIM_TICKETS_Iterator *iter = cls;
+
iter->ns_it = NULL;
iter->cb (iter->cb_cls, NULL);
cleanup_iter (iter);
collect_tickets_error_cb (void *cls)
{
struct RECLAIM_TICKETS_Iterator *iter = cls;
+
iter->ns_it = NULL;
iter->cb (iter->cb_cls, NULL);
cleanup_iter (iter);