diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-05-22 16:25:38 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-05-22 16:25:38 +0200 |
commit | b2e257ecb9c82b19f6ab23431faa3605718d3f01 (patch) | |
tree | 767b8cf35d6e1c9a741ee7e87f33dc852a6593cc /src/reclaim | |
parent | f9c41505dd2ad80d08d6b516c534df0a66ea55fc (diff) | |
download | gnunet-b2e257ecb9c82b19f6ab23431faa3605718d3f01.tar.gz gnunet-b2e257ecb9c82b19f6ab23431faa3605718d3f01.zip |
clang-format and cleanup
Diffstat (limited to 'src/reclaim')
-rw-r--r-- | src/reclaim/Makefile.am | 3 | ||||
-rw-r--r-- | src/reclaim/gnunet-service-reclaim.c | 197 | ||||
-rw-r--r-- | src/reclaim/gnunet-service-reclaim_tickets.c | 71 | ||||
-rw-r--r-- | src/reclaim/gnunet-service-reclaim_tickets.h | 1 | ||||
-rw-r--r-- | src/reclaim/json_reclaim.c | 58 | ||||
-rw-r--r-- | src/reclaim/json_reclaim.h | 28 | ||||
-rw-r--r-- | src/reclaim/oidc_helper.c | 52 | ||||
-rw-r--r-- | src/reclaim/oidc_helper.h | 28 | ||||
-rw-r--r-- | src/reclaim/plugin_rest_openid_connect.c | 66 | ||||
-rw-r--r-- | src/reclaim/plugin_rest_reclaim.c | 79 | ||||
-rw-r--r-- | src/reclaim/reclaim_api.c | 142 |
11 files changed, 308 insertions, 417 deletions
diff --git a/src/reclaim/Makefile.am b/src/reclaim/Makefile.am index fb17a8174..6e5046437 100644 --- a/src/reclaim/Makefile.am +++ b/src/reclaim/Makefile.am | |||
@@ -73,7 +73,7 @@ libgnunet_plugin_rest_openid_connect_la_LIBADD = \ | |||
73 | $(top_builddir)/src/rest/libgnunetrest.la \ | 73 | $(top_builddir)/src/rest/libgnunetrest.la \ |
74 | $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \ | 74 | $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \ |
75 | $(top_builddir)/src/namestore/libgnunetnamestore.la \ | 75 | $(top_builddir)/src/namestore/libgnunetnamestore.la \ |
76 | $(top_builddir)/src/gns/libgnunetgns.la \ | 76 | $(top_builddir)/src/gns/libgnunetgns.la \ |
77 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ | 77 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ |
78 | $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ | 78 | $(top_builddir)/src/util/libgnunetutil.la $(XLIBS) \ |
79 | $(LTLIBINTL) -ljansson -lmicrohttpd | 79 | $(LTLIBINTL) -ljansson -lmicrohttpd |
@@ -98,7 +98,6 @@ gnunet_service_reclaim_LDADD = \ | |||
98 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ | 98 | $(top_builddir)/src/gnsrecord/libgnunetgnsrecord.la \ |
99 | $(top_builddir)/src/util/libgnunetutil.la \ | 99 | $(top_builddir)/src/util/libgnunetutil.la \ |
100 | $(top_builddir)/src/namestore/libgnunetnamestore.la \ | 100 | $(top_builddir)/src/namestore/libgnunetnamestore.la \ |
101 | $(top_builddir)/src/identity/libgnunetidentity.la \ | ||
102 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ | 101 | $(top_builddir)/src/statistics/libgnunetstatistics.la \ |
103 | $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \ | 102 | $(top_builddir)/src/reclaim-attribute/libgnunetreclaimattribute.la \ |
104 | libgnunetreclaim.la \ | 103 | libgnunetreclaim.la \ |
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c index 1447f71f6..ffc67c5ae 100644 --- a/src/reclaim/gnunet-service-reclaim.c +++ b/src/reclaim/gnunet-service-reclaim.c | |||
@@ -28,34 +28,12 @@ | |||
28 | #include "gnunet-service-reclaim_tickets.h" | 28 | #include "gnunet-service-reclaim_tickets.h" |
29 | #include "gnunet_constants.h" | 29 | #include "gnunet_constants.h" |
30 | #include "gnunet_gnsrecord_lib.h" | 30 | #include "gnunet_gnsrecord_lib.h" |
31 | #include "gnunet_identity_service.h" | ||
32 | #include "gnunet_namestore_service.h" | ||
33 | #include "gnunet_protocols.h" | 31 | #include "gnunet_protocols.h" |
34 | #include "gnunet_reclaim_attribute_lib.h" | 32 | #include "gnunet_reclaim_attribute_lib.h" |
35 | #include "gnunet_reclaim_service.h" | 33 | #include "gnunet_reclaim_service.h" |
36 | #include "gnunet_signatures.h" | 34 | #include "gnunet_signatures.h" |
37 | #include "reclaim.h" | 35 | #include "reclaim.h" |
38 | 36 | ||
39 | /** | ||
40 | * First pass state | ||
41 | */ | ||
42 | #define STATE_INIT 0 | ||
43 | |||
44 | /** | ||
45 | * Normal operation state | ||
46 | */ | ||
47 | #define STATE_POST_INIT 1 | ||
48 | |||
49 | /** | ||
50 | * Minimum interval between updates | ||
51 | */ | ||
52 | #define MIN_WAIT_TIME GNUNET_TIME_UNIT_MINUTES | ||
53 | |||
54 | |||
55 | /** | ||
56 | * Identity handle | ||
57 | */ | ||
58 | static struct GNUNET_IDENTITY_Handle *identity_handle; | ||
59 | 37 | ||
60 | /** | 38 | /** |
61 | * Namestore handle | 39 | * Namestore handle |
@@ -68,11 +46,6 @@ static struct GNUNET_NAMESTORE_Handle *nsh; | |||
68 | static struct GNUNET_SCHEDULER_Task *timeout_task; | 46 | static struct GNUNET_SCHEDULER_Task *timeout_task; |
69 | 47 | ||
70 | /** | 48 | /** |
71 | * Update task | ||
72 | */ | ||
73 | static struct GNUNET_SCHEDULER_Task *update_task; | ||
74 | |||
75 | /** | ||
76 | * Our configuration. | 49 | * Our configuration. |
77 | */ | 50 | */ |
78 | static const struct GNUNET_CONFIGURATION_Handle *cfg; | 51 | static const struct GNUNET_CONFIGURATION_Handle *cfg; |
@@ -399,33 +372,6 @@ struct ConsumeTicketOperation | |||
399 | 372 | ||
400 | 373 | ||
401 | /** | 374 | /** |
402 | * Updated attribute IDs | ||
403 | */ | ||
404 | struct TicketAttributeUpdateEntry | ||
405 | { | ||
406 | /** | ||
407 | * DLL | ||
408 | */ | ||
409 | struct TicketAttributeUpdateEntry *next; | ||
410 | |||
411 | /** | ||
412 | * DLL | ||
413 | */ | ||
414 | struct TicketAttributeUpdateEntry *prev; | ||
415 | |||
416 | /** | ||
417 | * The old ID | ||
418 | */ | ||
419 | uint64_t old_id; | ||
420 | |||
421 | /** | ||
422 | * The new ID | ||
423 | */ | ||
424 | uint64_t new_id; | ||
425 | }; | ||
426 | |||
427 | |||
428 | /** | ||
429 | * Ticket revocation request handle | 375 | * Ticket revocation request handle |
430 | */ | 376 | */ |
431 | struct TicketRevocationOperation | 377 | struct TicketRevocationOperation |
@@ -485,35 +431,6 @@ struct TicketIssueOperation | |||
485 | 431 | ||
486 | 432 | ||
487 | /** | 433 | /** |
488 | * DLL for ego handles to egos containing the RECLAIM_ATTRS in a | ||
489 | * map in json_t format | ||
490 | * | ||
491 | */ | ||
492 | struct EgoEntry | ||
493 | { | ||
494 | /** | ||
495 | * DLL | ||
496 | */ | ||
497 | struct EgoEntry *next; | ||
498 | |||
499 | /** | ||
500 | * DLL | ||
501 | */ | ||
502 | struct EgoEntry *prev; | ||
503 | |||
504 | /** | ||
505 | * Ego handle | ||
506 | */ | ||
507 | struct GNUNET_IDENTITY_Ego *ego; | ||
508 | |||
509 | /** | ||
510 | * Attribute map. Contains the attributes as json_t | ||
511 | */ | ||
512 | struct GNUNET_CONTAINER_MultiHashMap *attr_map; | ||
513 | }; | ||
514 | |||
515 | |||
516 | /** | ||
517 | * Client list | 434 | * Client list |
518 | */ | 435 | */ |
519 | static struct IdpClient *client_list_head = NULL; | 436 | static struct IdpClient *client_list_head = NULL; |
@@ -649,10 +566,6 @@ cleanup () | |||
649 | RECLAIM_TICKETS_deinit (); | 566 | RECLAIM_TICKETS_deinit (); |
650 | if (NULL != timeout_task) | 567 | if (NULL != timeout_task) |
651 | GNUNET_SCHEDULER_cancel (timeout_task); | 568 | GNUNET_SCHEDULER_cancel (timeout_task); |
652 | if (NULL != update_task) | ||
653 | GNUNET_SCHEDULER_cancel (update_task); | ||
654 | if (NULL != identity_handle) | ||
655 | GNUNET_IDENTITY_disconnect (identity_handle); | ||
656 | if (NULL != nsh) | 569 | if (NULL != nsh) |
657 | GNUNET_NAMESTORE_disconnect (nsh); | 570 | GNUNET_NAMESTORE_disconnect (nsh); |
658 | } | 571 | } |
@@ -1600,8 +1513,8 @@ ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket) | |||
1600 | */ | 1513 | */ |
1601 | static void | 1514 | static void |
1602 | handle_ticket_iteration_start ( | 1515 | handle_ticket_iteration_start ( |
1603 | void *cls, | 1516 | void *cls, |
1604 | const struct TicketIterationStartMessage *tis_msg) | 1517 | const struct TicketIterationStartMessage *tis_msg) |
1605 | { | 1518 | { |
1606 | struct IdpClient *client = cls; | 1519 | struct IdpClient *client = cls; |
1607 | struct TicketIteration *ti; | 1520 | struct TicketIteration *ti; |
@@ -1713,8 +1626,6 @@ run (void *cls, | |||
1713 | "error connecting to namestore"); | 1626 | "error connecting to namestore"); |
1714 | } | 1627 | } |
1715 | 1628 | ||
1716 | identity_handle = GNUNET_IDENTITY_connect (cfg, NULL, NULL); | ||
1717 | |||
1718 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); | 1629 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); |
1719 | } | 1630 | } |
1720 | 1631 | ||
@@ -1769,56 +1680,56 @@ client_connect_cb (void *cls, | |||
1769 | * Define "main" method using service macro. | 1680 | * Define "main" method using service macro. |
1770 | */ | 1681 | */ |
1771 | GNUNET_SERVICE_MAIN ( | 1682 | GNUNET_SERVICE_MAIN ( |
1772 | "reclaim", | 1683 | "reclaim", |
1773 | GNUNET_SERVICE_OPTION_NONE, | 1684 | GNUNET_SERVICE_OPTION_NONE, |
1774 | &run, | 1685 | &run, |
1775 | &client_connect_cb, | 1686 | &client_connect_cb, |
1776 | &client_disconnect_cb, | 1687 | &client_disconnect_cb, |
1777 | NULL, | 1688 | NULL, |
1778 | GNUNET_MQ_hd_var_size (attribute_store_message, | 1689 | GNUNET_MQ_hd_var_size (attribute_store_message, |
1779 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, | 1690 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_STORE, |
1780 | struct AttributeStoreMessage, | 1691 | struct AttributeStoreMessage, |
1781 | NULL), | 1692 | NULL), |
1782 | GNUNET_MQ_hd_var_size (attribute_delete_message, | 1693 | GNUNET_MQ_hd_var_size (attribute_delete_message, |
1783 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, | 1694 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_DELETE, |
1784 | struct AttributeDeleteMessage, | 1695 | struct AttributeDeleteMessage, |
1785 | NULL), | 1696 | NULL), |
1786 | GNUNET_MQ_hd_fixed_size ( | 1697 | GNUNET_MQ_hd_fixed_size ( |
1787 | iteration_start, | 1698 | iteration_start, |
1788 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, | 1699 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, |
1789 | struct AttributeIterationStartMessage, | 1700 | struct AttributeIterationStartMessage, |
1790 | NULL), | 1701 | NULL), |
1791 | GNUNET_MQ_hd_fixed_size (iteration_next, | 1702 | GNUNET_MQ_hd_fixed_size (iteration_next, |
1792 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, | 1703 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, |
1793 | struct AttributeIterationNextMessage, | 1704 | struct AttributeIterationNextMessage, |
1794 | NULL), | 1705 | NULL), |
1795 | GNUNET_MQ_hd_fixed_size (iteration_stop, | 1706 | GNUNET_MQ_hd_fixed_size (iteration_stop, |
1796 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, | 1707 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, |
1797 | struct AttributeIterationStopMessage, | 1708 | struct AttributeIterationStopMessage, |
1798 | NULL), | 1709 | NULL), |
1799 | GNUNET_MQ_hd_var_size (issue_ticket_message, | 1710 | GNUNET_MQ_hd_var_size (issue_ticket_message, |
1800 | GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET, | 1711 | GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET, |
1801 | struct IssueTicketMessage, | 1712 | struct IssueTicketMessage, |
1802 | NULL), | 1713 | NULL), |
1803 | GNUNET_MQ_hd_var_size (consume_ticket_message, | 1714 | GNUNET_MQ_hd_var_size (consume_ticket_message, |
1804 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, | 1715 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, |
1805 | struct ConsumeTicketMessage, | 1716 | struct ConsumeTicketMessage, |
1806 | NULL), | 1717 | NULL), |
1807 | GNUNET_MQ_hd_fixed_size (ticket_iteration_start, | 1718 | GNUNET_MQ_hd_fixed_size (ticket_iteration_start, |
1808 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, | 1719 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, |
1809 | struct TicketIterationStartMessage, | 1720 | struct TicketIterationStartMessage, |
1810 | NULL), | 1721 | NULL), |
1811 | GNUNET_MQ_hd_fixed_size (ticket_iteration_next, | 1722 | GNUNET_MQ_hd_fixed_size (ticket_iteration_next, |
1812 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT, | 1723 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT, |
1813 | struct TicketIterationNextMessage, | 1724 | struct TicketIterationNextMessage, |
1814 | NULL), | 1725 | NULL), |
1815 | GNUNET_MQ_hd_fixed_size (ticket_iteration_stop, | 1726 | GNUNET_MQ_hd_fixed_size (ticket_iteration_stop, |
1816 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP, | 1727 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP, |
1817 | struct TicketIterationStopMessage, | 1728 | struct TicketIterationStopMessage, |
1818 | NULL), | 1729 | NULL), |
1819 | GNUNET_MQ_hd_var_size (revoke_ticket_message, | 1730 | GNUNET_MQ_hd_var_size (revoke_ticket_message, |
1820 | GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET, | 1731 | GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET, |
1821 | struct RevokeTicketMessage, | 1732 | struct RevokeTicketMessage, |
1822 | NULL), | 1733 | NULL), |
1823 | GNUNET_MQ_handler_end ()); | 1734 | GNUNET_MQ_handler_end ()); |
1824 | /* end of gnunet-service-reclaim.c */ | 1735 | /* end of gnunet-service-reclaim.c */ |
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.c b/src/reclaim/gnunet-service-reclaim_tickets.c index f18b11cb1..d20a4e3bf 100644 --- a/src/reclaim/gnunet-service-reclaim_tickets.c +++ b/src/reclaim/gnunet-service-reclaim_tickets.c | |||
@@ -25,7 +25,6 @@ | |||
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | #include <inttypes.h> | 27 | #include <inttypes.h> |
28 | |||
29 | #include "gnunet-service-reclaim_tickets.h" | 28 | #include "gnunet-service-reclaim_tickets.h" |
30 | 29 | ||
31 | #define DEFAULT_TICKET_REFRESH_INTERVAL GNUNET_TIME_UNIT_HOURS | 30 | #define DEFAULT_TICKET_REFRESH_INTERVAL GNUNET_TIME_UNIT_HOURS |
@@ -406,7 +405,7 @@ rvk_move_attr_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | |||
406 | } | 405 | } |
407 | /** find a new place for this attribute **/ | 406 | /** find a new place for this attribute **/ |
408 | rvk->move_attr->new_id = | 407 | rvk->move_attr->new_id = |
409 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); | 408 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); |
410 | new_rd = *rd; | 409 | new_rd = *rd; |
411 | claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd->data, rd->data_size); | 410 | claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd->data, rd->data_size); |
412 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 411 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -421,7 +420,7 @@ rvk_move_attr_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | |||
421 | sizeof (uint64_t)); | 420 | sizeof (uint64_t)); |
422 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label); | 421 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding attribute %s\n", new_label); |
423 | rvk->ns_qe = GNUNET_NAMESTORE_records_store ( | 422 | rvk->ns_qe = GNUNET_NAMESTORE_records_store ( |
424 | nsh, &rvk->identity, new_label, 1, &new_rd, &move_attr_finished, rvk); | 423 | nsh, &rvk->identity, new_label, 1, &new_rd, &move_attr_finished, rvk); |
425 | GNUNET_free (new_label); | 424 | GNUNET_free (new_label); |
426 | GNUNET_free (claim); | 425 | GNUNET_free (claim); |
427 | GNUNET_free (attr_data); | 426 | GNUNET_free (attr_data); |
@@ -506,7 +505,7 @@ process_tickets (void *cls) | |||
506 | } | 505 | } |
507 | } | 506 | } |
508 | rvk->ns_qe = GNUNET_NAMESTORE_records_store ( | 507 | rvk->ns_qe = GNUNET_NAMESTORE_records_store ( |
509 | nsh, &rvk->identity, le->label, le->rd_count, rd, &ticket_processed, rvk); | 508 | nsh, &rvk->identity, le->label, le->rd_count, rd, &ticket_processed, rvk); |
510 | GNUNET_free (le->label); | 509 | GNUNET_free (le->label); |
511 | GNUNET_free (le->data); | 510 | GNUNET_free (le->data); |
512 | GNUNET_free (le); | 511 | GNUNET_free (le); |
@@ -555,8 +554,8 @@ move_attrs (struct RECLAIM_TICKETS_RevokeHandle *rvk) | |||
555 | if (NULL == rvk->move_attr) { | 554 | if (NULL == rvk->move_attr) { |
556 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished moving attributes\n"); | 555 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Finished moving attributes\n"); |
557 | rvk->ns_it = GNUNET_NAMESTORE_zone_iteration_start ( | 556 | rvk->ns_it = GNUNET_NAMESTORE_zone_iteration_start ( |
558 | nsh, &rvk->identity, &rvk_ns_iter_err, rvk, &rvk_ticket_update, rvk, | 557 | nsh, &rvk->identity, &rvk_ns_iter_err, rvk, &rvk_ticket_update, rvk, |
559 | &rvk_ticket_update_finished, rvk); | 558 | &rvk_ticket_update_finished, rvk); |
560 | return; | 559 | return; |
561 | } | 560 | } |
562 | label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id, | 561 | label = GNUNET_STRINGS_data_to_string_alloc (&rvk->move_attr->old_id, |
@@ -564,7 +563,7 @@ move_attrs (struct RECLAIM_TICKETS_RevokeHandle *rvk) | |||
564 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving attribute %s\n", label); | 563 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Moving attribute %s\n", label); |
565 | 564 | ||
566 | rvk->ns_qe = GNUNET_NAMESTORE_records_lookup ( | 565 | rvk->ns_qe = GNUNET_NAMESTORE_records_lookup ( |
567 | nsh, &rvk->identity, label, &rvk_ns_err, rvk, &rvk_move_attr_cb, rvk); | 566 | nsh, &rvk->identity, label, &rvk_ns_err, rvk, &rvk_move_attr_cb, rvk); |
568 | GNUNET_free (label); | 567 | GNUNET_free (label); |
569 | } | 568 | } |
570 | 569 | ||
@@ -644,7 +643,7 @@ RECLAIM_TICKETS_revoke (const struct GNUNET_RECLAIM_Ticket *ticket, | |||
644 | label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof (uint64_t)); | 643 | label = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof (uint64_t)); |
645 | 644 | ||
646 | rvk->ns_qe = GNUNET_NAMESTORE_records_lookup ( | 645 | rvk->ns_qe = GNUNET_NAMESTORE_records_lookup ( |
647 | nsh, identity, label, &rvk_attrs_err_cb, rvk, &revoke_attrs_cb, rvk); | 646 | nsh, identity, label, &rvk_attrs_err_cb, rvk, &revoke_attrs_cb, rvk); |
648 | return rvk; | 647 | return rvk; |
649 | } | 648 | } |
650 | 649 | ||
@@ -700,10 +699,10 @@ process_parallel_lookup_result (void *cls, uint32_t rd_count, | |||
700 | GNUNET_free (parallel_lookup->label); | 699 | GNUNET_free (parallel_lookup->label); |
701 | 700 | ||
702 | GNUNET_STATISTICS_update ( | 701 | GNUNET_STATISTICS_update ( |
703 | stats, "attribute_lookup_time_total", | 702 | stats, "attribute_lookup_time_total", |
704 | GNUNET_TIME_absolute_get_duration (parallel_lookup->lookup_start_time) | 703 | GNUNET_TIME_absolute_get_duration (parallel_lookup->lookup_start_time) |
705 | .rel_value_us, | 704 | .rel_value_us, |
706 | GNUNET_YES); | 705 | GNUNET_YES); |
707 | GNUNET_STATISTICS_update (stats, "attribute_lookups_count", 1, GNUNET_YES); | 706 | GNUNET_STATISTICS_update (stats, "attribute_lookups_count", 1, GNUNET_YES); |
708 | 707 | ||
709 | 708 | ||
@@ -713,7 +712,7 @@ process_parallel_lookup_result (void *cls, uint32_t rd_count, | |||
713 | if (rd->record_type == GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR) { | 712 | if (rd->record_type == GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR) { |
714 | attr_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry); | 713 | attr_le = GNUNET_new (struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry); |
715 | attr_le->claim = | 714 | attr_le->claim = |
716 | GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd->data, rd->data_size); | 715 | GNUNET_RECLAIM_ATTRIBUTE_deserialize (rd->data, rd->data_size); |
717 | GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head, cth->attrs->list_tail, | 716 | GNUNET_CONTAINER_DLL_insert (cth->attrs->list_head, cth->attrs->list_tail, |
718 | attr_le); | 717 | attr_le); |
719 | } | 718 | } |
@@ -758,9 +757,9 @@ lookup_authz_cb (void *cls, uint32_t rd_count, | |||
758 | cth->lookup_request = NULL; | 757 | cth->lookup_request = NULL; |
759 | 758 | ||
760 | GNUNET_STATISTICS_update ( | 759 | GNUNET_STATISTICS_update ( |
761 | stats, "reclaim_authz_lookup_time_total", | 760 | stats, "reclaim_authz_lookup_time_total", |
762 | GNUNET_TIME_absolute_get_duration (cth->lookup_start_time).rel_value_us, | 761 | GNUNET_TIME_absolute_get_duration (cth->lookup_start_time).rel_value_us, |
763 | GNUNET_YES); | 762 | GNUNET_YES); |
764 | GNUNET_STATISTICS_update (stats, "reclaim_authz_lookups_count", 1, | 763 | GNUNET_STATISTICS_update (stats, "reclaim_authz_lookups_count", 1, |
765 | GNUNET_YES); | 764 | GNUNET_YES); |
766 | 765 | ||
@@ -774,16 +773,16 @@ lookup_authz_cb (void *cls, uint32_t rd_count, | |||
774 | parallel_lookup->label = lbl; | 773 | parallel_lookup->label = lbl; |
775 | parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get (); | 774 | parallel_lookup->lookup_start_time = GNUNET_TIME_absolute_get (); |
776 | parallel_lookup->lookup_request = GNUNET_GNS_lookup ( | 775 | parallel_lookup->lookup_request = GNUNET_GNS_lookup ( |
777 | gns, lbl, &cth->ticket.identity, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR, | 776 | gns, lbl, &cth->ticket.identity, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR, |
778 | GNUNET_GNS_LO_DEFAULT, &process_parallel_lookup_result, | 777 | GNUNET_GNS_LO_DEFAULT, &process_parallel_lookup_result, |
779 | parallel_lookup); | 778 | parallel_lookup); |
780 | GNUNET_CONTAINER_DLL_insert (cth->parallel_lookups_head, | 779 | GNUNET_CONTAINER_DLL_insert (cth->parallel_lookups_head, |
781 | cth->parallel_lookups_tail, parallel_lookup); | 780 | cth->parallel_lookups_tail, parallel_lookup); |
782 | } | 781 | } |
783 | if (NULL != cth->parallel_lookups_head) { | 782 | if (NULL != cth->parallel_lookups_head) { |
784 | cth->kill_task = GNUNET_SCHEDULER_add_delayed ( | 783 | cth->kill_task = GNUNET_SCHEDULER_add_delayed ( |
785 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 3), | 784 | GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 3), |
786 | &abort_parallel_lookups, cth); | 785 | &abort_parallel_lookups, cth); |
787 | return; | 786 | return; |
788 | } | 787 | } |
789 | cth->cb (cth->cb_cls, &cth->ticket.identity, cth->attrs, GNUNET_OK, NULL); | 788 | cth->cb (cth->cb_cls, &cth->ticket.identity, cth->attrs, GNUNET_OK, NULL); |
@@ -807,13 +806,13 @@ RECLAIM_TICKETS_consume (const struct GNUNET_CRYPTO_EcdsaPrivateKey *id, | |||
807 | cth->cb = cb; | 806 | cth->cb = cb; |
808 | cth->cb_cls = cb_cls; | 807 | cth->cb_cls = cb_cls; |
809 | label = | 808 | label = |
810 | GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd, sizeof (uint64_t)); | 809 | GNUNET_STRINGS_data_to_string_alloc (&cth->ticket.rnd, sizeof (uint64_t)); |
811 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking for AuthZ info under %s\n", | 810 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking for AuthZ info under %s\n", |
812 | label); | 811 | label); |
813 | cth->lookup_start_time = GNUNET_TIME_absolute_get (); | 812 | cth->lookup_start_time = GNUNET_TIME_absolute_get (); |
814 | cth->lookup_request = GNUNET_GNS_lookup ( | 813 | cth->lookup_request = GNUNET_GNS_lookup ( |
815 | gns, label, &cth->ticket.identity, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF, | 814 | gns, label, &cth->ticket.identity, GNUNET_GNSRECORD_TYPE_RECLAIM_ATTR_REF, |
816 | GNUNET_GNS_LO_DEFAULT, &lookup_authz_cb, cth); | 815 | GNUNET_GNS_LO_DEFAULT, &lookup_authz_cb, cth); |
817 | GNUNET_free (label); | 816 | GNUNET_free (label); |
818 | return cth; | 817 | return cth; |
819 | } | 818 | } |
@@ -872,7 +871,7 @@ issue_ticket (struct TicketIssueHandle *ih) | |||
872 | list_len++; | 871 | list_len++; |
873 | 872 | ||
874 | attrs_record = | 873 | attrs_record = |
875 | GNUNET_malloc (list_len * sizeof (struct GNUNET_GNSRECORD_Data)); | 874 | GNUNET_malloc (list_len * sizeof (struct GNUNET_GNSRECORD_Data)); |
876 | i = 0; | 875 | i = 0; |
877 | for (le = ih->attrs->list_head; NULL != le; le = le->next) { | 876 | for (le = ih->attrs->list_head; NULL != le; le = le->next) { |
878 | attrs_record[i].data = &le->claim->id; | 877 | attrs_record[i].data = &le->claim->id; |
@@ -888,10 +887,10 @@ issue_ticket (struct TicketIssueHandle *ih) | |||
888 | attrs_record[i].expiration_time = ticket_refresh_interval.rel_value_us; | 887 | attrs_record[i].expiration_time = ticket_refresh_interval.rel_value_us; |
889 | attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET; | 888 | attrs_record[i].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_TICKET; |
890 | attrs_record[i].flags = | 889 | attrs_record[i].flags = |
891 | GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE; | 890 | GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION | GNUNET_GNSRECORD_RF_PRIVATE; |
892 | 891 | ||
893 | label = | 892 | label = |
894 | GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd, sizeof (uint64_t)); | 893 | GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd, sizeof (uint64_t)); |
895 | // Publish record | 894 | // Publish record |
896 | ih->ns_qe = GNUNET_NAMESTORE_records_store (nsh, &ih->identity, label, | 895 | ih->ns_qe = GNUNET_NAMESTORE_records_store (nsh, &ih->identity, label, |
897 | list_len, attrs_record, | 896 | list_len, attrs_record, |
@@ -915,7 +914,7 @@ RECLAIM_TICKETS_issue (const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | |||
915 | tih->identity = *identity; | 914 | tih->identity = *identity; |
916 | GNUNET_CRYPTO_ecdsa_key_get_public (identity, &tih->ticket.identity); | 915 | GNUNET_CRYPTO_ecdsa_key_get_public (identity, &tih->ticket.identity); |
917 | tih->ticket.rnd = | 916 | tih->ticket.rnd = |
918 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); | 917 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); |
919 | tih->ticket.audience = *audience; | 918 | tih->ticket.audience = *audience; |
920 | issue_ticket (tih); | 919 | issue_ticket (tih); |
921 | } | 920 | } |
@@ -987,8 +986,8 @@ RECLAIM_TICKETS_iteration_stop (struct RECLAIM_TICKETS_Iterator *iter) | |||
987 | 986 | ||
988 | struct RECLAIM_TICKETS_Iterator * | 987 | struct RECLAIM_TICKETS_Iterator * |
989 | RECLAIM_TICKETS_iteration_start ( | 988 | RECLAIM_TICKETS_iteration_start ( |
990 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 989 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, |
991 | RECLAIM_TICKETS_TicketIter cb, void *cb_cls) | 990 | RECLAIM_TICKETS_TicketIter cb, void *cb_cls) |
992 | { | 991 | { |
993 | struct RECLAIM_TICKETS_Iterator *iter; | 992 | struct RECLAIM_TICKETS_Iterator *iter; |
994 | 993 | ||
@@ -996,8 +995,8 @@ RECLAIM_TICKETS_iteration_start ( | |||
996 | iter->cb = cb; | 995 | iter->cb = cb; |
997 | iter->cb_cls = cb_cls; | 996 | iter->cb_cls = cb_cls; |
998 | iter->ns_it = GNUNET_NAMESTORE_zone_iteration_start ( | 997 | iter->ns_it = GNUNET_NAMESTORE_zone_iteration_start ( |
999 | nsh, identity, &collect_tickets_error_cb, iter, &collect_tickets_cb, iter, | 998 | nsh, identity, &collect_tickets_error_cb, iter, &collect_tickets_cb, iter, |
1000 | &collect_tickets_finished_cb, iter); | 999 | &collect_tickets_finished_cb, iter); |
1001 | return iter; | 1000 | return iter; |
1002 | } | 1001 | } |
1003 | 1002 | ||
@@ -1012,10 +1011,10 @@ RECLAIM_TICKETS_init (const struct GNUNET_CONFIGURATION_Handle *c) | |||
1012 | "TICKET_REFRESH_INTERVAL", | 1011 | "TICKET_REFRESH_INTERVAL", |
1013 | &ticket_refresh_interval)) { | 1012 | &ticket_refresh_interval)) { |
1014 | GNUNET_log ( | 1013 | GNUNET_log ( |
1015 | GNUNET_ERROR_TYPE_DEBUG, | 1014 | GNUNET_ERROR_TYPE_DEBUG, |
1016 | "Configured refresh interval for tickets: %s\n", | 1015 | "Configured refresh interval for tickets: %s\n", |
1017 | GNUNET_STRINGS_relative_time_to_string (ticket_refresh_interval, | 1016 | GNUNET_STRINGS_relative_time_to_string (ticket_refresh_interval, |
1018 | GNUNET_YES)); | 1017 | GNUNET_YES)); |
1019 | } else { | 1018 | } else { |
1020 | ticket_refresh_interval = DEFAULT_TICKET_REFRESH_INTERVAL; | 1019 | ticket_refresh_interval = DEFAULT_TICKET_REFRESH_INTERVAL; |
1021 | } | 1020 | } |
diff --git a/src/reclaim/gnunet-service-reclaim_tickets.h b/src/reclaim/gnunet-service-reclaim_tickets.h index 6e704243d..6e69355fa 100644 --- a/src/reclaim/gnunet-service-reclaim_tickets.h +++ b/src/reclaim/gnunet-service-reclaim_tickets.h | |||
@@ -35,7 +35,6 @@ | |||
35 | #include "gnunet_constants.h" | 35 | #include "gnunet_constants.h" |
36 | #include "gnunet_gns_service.h" | 36 | #include "gnunet_gns_service.h" |
37 | #include "gnunet_gnsrecord_lib.h" | 37 | #include "gnunet_gnsrecord_lib.h" |
38 | #include "gnunet_namestore_service.h" | ||
39 | #include "gnunet_protocols.h" | 38 | #include "gnunet_protocols.h" |
40 | #include "gnunet_reclaim_attribute_lib.h" | 39 | #include "gnunet_reclaim_attribute_lib.h" |
41 | #include "gnunet_reclaim_service.h" | 40 | #include "gnunet_reclaim_service.h" |
diff --git a/src/reclaim/json_reclaim.c b/src/reclaim/json_reclaim.c index 9c186b64a..3ba4300bb 100644 --- a/src/reclaim/json_reclaim.c +++ b/src/reclaim/json_reclaim.c | |||
@@ -1,22 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2018 GNUnet e.V. | 3 | Copyright (C) 2009-2018 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation, either version 3 of the License, | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | or (at your option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file rest-plugins/json_reclaim.c | 22 | * @file rest-plugins/json_reclaim.c |
@@ -62,8 +62,8 @@ parse_attr (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) | |||
62 | } | 62 | } |
63 | // interpret single attribute | 63 | // interpret single attribute |
64 | unpack_state = | 64 | unpack_state = |
65 | json_unpack (root, "{s:s, s?s, s:s, s:s!}", "name", &name_str, "id", | 65 | json_unpack (root, "{s:s, s?s, s:s, s:s!}", "name", &name_str, "id", |
66 | &id_str, "type", &type_str, "value", &val_str); | 66 | &id_str, "type", &type_str, "value", &val_str); |
67 | if ((0 != unpack_state) || (NULL == name_str) || (NULL == val_str) || | 67 | if ((0 != unpack_state) || (NULL == name_str) || (NULL == val_str) || |
68 | (NULL == type_str)) { | 68 | (NULL == type_str)) { |
69 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 69 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -72,7 +72,7 @@ parse_attr (void *cls, json_t *root, struct GNUNET_JSON_Specification *spec) | |||
72 | } | 72 | } |
73 | type = GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (type_str); | 73 | type = GNUNET_RECLAIM_ATTRIBUTE_typename_to_number (type_str); |
74 | if (GNUNET_SYSERR == (GNUNET_RECLAIM_ATTRIBUTE_string_to_value ( | 74 | if (GNUNET_SYSERR == (GNUNET_RECLAIM_ATTRIBUTE_string_to_value ( |
75 | type, val_str, (void **)&data, &data_size))) { | 75 | type, val_str, (void **)&data, &data_size))) { |
76 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attribute value invalid!\n"); | 76 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Attribute value invalid!\n"); |
77 | return GNUNET_SYSERR; | 77 | return GNUNET_SYSERR; |
78 | } | 78 | } |
@@ -114,12 +114,12 @@ struct GNUNET_JSON_Specification | |||
114 | GNUNET_RECLAIM_JSON_spec_claim (struct GNUNET_RECLAIM_ATTRIBUTE_Claim **attr) | 114 | GNUNET_RECLAIM_JSON_spec_claim (struct GNUNET_RECLAIM_ATTRIBUTE_Claim **attr) |
115 | { | 115 | { |
116 | struct GNUNET_JSON_Specification ret = {.parser = &parse_attr, | 116 | struct GNUNET_JSON_Specification ret = {.parser = &parse_attr, |
117 | .cleaner = &clean_attr, | 117 | .cleaner = &clean_attr, |
118 | .cls = NULL, | 118 | .cls = NULL, |
119 | .field = NULL, | 119 | .field = NULL, |
120 | .ptr = attr, | 120 | .ptr = attr, |
121 | .ptr_size = 0, | 121 | .ptr_size = 0, |
122 | .size_ptr = NULL}; | 122 | .size_ptr = NULL}; |
123 | *attr = NULL; | 123 | *attr = NULL; |
124 | return ret; | 124 | return ret; |
125 | } | 125 | } |
@@ -210,12 +210,12 @@ struct GNUNET_JSON_Specification | |||
210 | GNUNET_RECLAIM_JSON_spec_ticket (struct GNUNET_RECLAIM_Ticket **ticket) | 210 | GNUNET_RECLAIM_JSON_spec_ticket (struct GNUNET_RECLAIM_Ticket **ticket) |
211 | { | 211 | { |
212 | struct GNUNET_JSON_Specification ret = {.parser = &parse_ticket, | 212 | struct GNUNET_JSON_Specification ret = {.parser = &parse_ticket, |
213 | .cleaner = &clean_ticket, | 213 | .cleaner = &clean_ticket, |
214 | .cls = NULL, | 214 | .cls = NULL, |
215 | .field = NULL, | 215 | .field = NULL, |
216 | .ptr = ticket, | 216 | .ptr = ticket, |
217 | .ptr_size = 0, | 217 | .ptr_size = 0, |
218 | .size_ptr = NULL}; | 218 | .size_ptr = NULL}; |
219 | *ticket = NULL; | 219 | *ticket = NULL; |
220 | return ret; | 220 | return ret; |
221 | } | 221 | } |
diff --git a/src/reclaim/json_reclaim.h b/src/reclaim/json_reclaim.h index ced2e10dd..36221ccb4 100644 --- a/src/reclaim/json_reclaim.h +++ b/src/reclaim/json_reclaim.h | |||
@@ -1,22 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2009-2018 GNUnet e.V. | 3 | Copyright (C) 2009-2018 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation, either version 3 of the License, | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | or (at your option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file rest-plugins/json_reclaim.h | 22 | * @file rest-plugins/json_reclaim.h |
diff --git a/src/reclaim/oidc_helper.c b/src/reclaim/oidc_helper.c index 167ee1729..6a06d5440 100644 --- a/src/reclaim/oidc_helper.c +++ b/src/reclaim/oidc_helper.c | |||
@@ -1,22 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2010-2015 GNUnet e.V. | 3 | Copyright (C) 2010-2015 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation, either version 3 of the License, | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | or (at your option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file reclaim/oidc_helper.c | 22 | * @file reclaim/oidc_helper.c |
@@ -26,13 +26,13 @@ | |||
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | #include <inttypes.h> | 27 | #include <inttypes.h> |
28 | #include <jansson.h> | 28 | #include <jansson.h> |
29 | |||
30 | #include "gnunet_util_lib.h" | 29 | #include "gnunet_util_lib.h" |
31 | |||
32 | #include "gnunet_reclaim_attribute_lib.h" | 30 | #include "gnunet_reclaim_attribute_lib.h" |
33 | #include "gnunet_reclaim_service.h" | 31 | #include "gnunet_reclaim_service.h" |
34 | #include "gnunet_signatures.h" | 32 | #include "gnunet_signatures.h" |
35 | #include "oidc_helper.h" | 33 | #include "oidc_helper.h" |
34 | |||
35 | |||
36 | static char * | 36 | static char * |
37 | create_jwt_header (void) | 37 | create_jwt_header (void) |
38 | { | 38 | { |
@@ -308,7 +308,7 @@ derive_aes_key (struct GNUNET_CRYPTO_SymmetricSessionKey *key, | |||
308 | NULL); | 308 | NULL); |
309 | GNUNET_CRYPTO_kdf (iv, | 309 | GNUNET_CRYPTO_kdf (iv, |
310 | sizeof ( | 310 | sizeof ( |
311 | struct GNUNET_CRYPTO_SymmetricInitializationVector), | 311 | struct GNUNET_CRYPTO_SymmetricInitializationVector), |
312 | ctx_iv, | 312 | ctx_iv, |
313 | strlen (ctx_iv), | 313 | strlen (ctx_iv), |
314 | key_material, | 314 | key_material, |
@@ -368,7 +368,7 @@ encrypt_payload (const struct GNUNET_CRYPTO_EcdsaPublicKey *ecdsa_pub, | |||
368 | 368 | ||
369 | calculate_key_pub (&key, &iv, ecdsa_pub, ecdh_priv); | 369 | calculate_key_pub (&key, &iv, ecdsa_pub, ecdh_priv); |
370 | GNUNET_break ( | 370 | GNUNET_break ( |
371 | GNUNET_CRYPTO_symmetric_encrypt (payload, payload_len, &key, &iv, buf)); | 371 | GNUNET_CRYPTO_symmetric_encrypt (payload, payload_len, &key, &iv, buf)); |
372 | } | 372 | } |
373 | 373 | ||
374 | 374 | ||
@@ -416,9 +416,9 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, | |||
416 | GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, attrs_ser); | 416 | GNUNET_RECLAIM_ATTRIBUTE_list_serialize (attrs, attrs_ser); |
417 | } | 417 | } |
418 | code_payload_len = sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | 418 | code_payload_len = sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + |
419 | sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) + | 419 | sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) + |
420 | signature_payload_len + | 420 | signature_payload_len + |
421 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature); | 421 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature); |
422 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 422 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
423 | "Length of data to encode: %lu\n", | 423 | "Length of data to encode: %lu\n", |
424 | code_payload_len); | 424 | code_payload_len); |
@@ -482,7 +482,7 @@ OIDC_build_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *issuer, | |||
482 | GNUNET_CRYPTO_ecdsa_sign (issuer, | 482 | GNUNET_CRYPTO_ecdsa_sign (issuer, |
483 | purpose, | 483 | purpose, |
484 | (struct GNUNET_CRYPTO_EcdsaSignature *) | 484 | (struct GNUNET_CRYPTO_EcdsaSignature *) |
485 | buf_ptr)) | 485 | buf_ptr)) |
486 | { | 486 | { |
487 | GNUNET_break (0); | 487 | GNUNET_break (0); |
488 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unable to sign code\n"); | 488 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Unable to sign code\n"); |
@@ -532,10 +532,10 @@ OIDC_parse_authz_code (const struct GNUNET_CRYPTO_EcdsaPrivateKey *ecdsa_priv, | |||
532 | code_payload_len = | 532 | code_payload_len = |
533 | GNUNET_STRINGS_base64_decode (code, strlen (code), (void **) &code_payload); | 533 | GNUNET_STRINGS_base64_decode (code, strlen (code), (void **) &code_payload); |
534 | if (code_payload_len < sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + | 534 | if (code_payload_len < sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + |
535 | sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) + | 535 | sizeof (struct GNUNET_CRYPTO_EcdhePublicKey) + |
536 | sizeof (struct GNUNET_RECLAIM_Ticket) + | 536 | sizeof (struct GNUNET_RECLAIM_Ticket) + |
537 | sizeof (uint32_t) + | 537 | sizeof (uint32_t) + |
538 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature)) | 538 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature)) |
539 | { | 539 | { |
540 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Authorization code malformed\n"); | 540 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Authorization code malformed\n"); |
541 | GNUNET_free_non_null (code_payload); | 541 | GNUNET_free_non_null (code_payload); |
diff --git a/src/reclaim/oidc_helper.h b/src/reclaim/oidc_helper.h index 6fe1721d3..6c10a4ab0 100644 --- a/src/reclaim/oidc_helper.h +++ b/src/reclaim/oidc_helper.h | |||
@@ -1,22 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet | 2 | This file is part of GNUnet |
3 | Copyright (C) 2010-2015 GNUnet e.V. | 3 | Copyright (C) 2010-2015 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation, either version 3 of the License, | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | or (at your option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file reclaim/oidc_helper.h | 22 | * @file reclaim/oidc_helper.h |
diff --git a/src/reclaim/plugin_rest_openid_connect.c b/src/reclaim/plugin_rest_openid_connect.c index a29d71c01..93e5ac864 100644 --- a/src/reclaim/plugin_rest_openid_connect.c +++ b/src/reclaim/plugin_rest_openid_connect.c | |||
@@ -15,7 +15,7 @@ | |||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @author Martin Schanzenbach | 21 | * @author Martin Schanzenbach |
@@ -209,12 +209,12 @@ | |||
209 | * OIDC ignored parameter array | 209 | * OIDC ignored parameter array |
210 | */ | 210 | */ |
211 | static char *OIDC_ignored_parameter_array[] = {"display", | 211 | static char *OIDC_ignored_parameter_array[] = {"display", |
212 | "prompt", | 212 | "prompt", |
213 | "ui_locales", | 213 | "ui_locales", |
214 | "response_mode", | 214 | "response_mode", |
215 | "id_token_hint", | 215 | "id_token_hint", |
216 | "login_hint", | 216 | "login_hint", |
217 | "acr_values"}; | 217 | "acr_values"}; |
218 | 218 | ||
219 | /** | 219 | /** |
220 | * OIDC Hash map that keeps track of issued cookies | 220 | * OIDC Hash map that keeps track of issued cookies |
@@ -724,7 +724,7 @@ cookie_identity_interpretation (struct RequestHandle *handle) | |||
724 | strlen (OIDC_COOKIE_HEADER_KEY), | 724 | strlen (OIDC_COOKIE_HEADER_KEY), |
725 | &cache_key); | 725 | &cache_key); |
726 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle | 726 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle |
727 | ->header_param_map, | 727 | ->header_param_map, |
728 | &cache_key)) | 728 | &cache_key)) |
729 | { | 729 | { |
730 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No cookie found\n"); | 730 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No cookie found\n"); |
@@ -772,9 +772,9 @@ cookie_identity_interpretation (struct RequestHandle *handle) | |||
772 | GNUNET_CONTAINER_multihashmap_contains (OIDC_cookie_jar_map, &cache_key)) | 772 | GNUNET_CONTAINER_multihashmap_contains (OIDC_cookie_jar_map, &cache_key)) |
773 | { | 773 | { |
774 | GNUNET_log ( | 774 | GNUNET_log ( |
775 | GNUNET_ERROR_TYPE_WARNING, | 775 | GNUNET_ERROR_TYPE_WARNING, |
776 | "Found cookie `%s', but no corresponding expiration entry present...\n", | 776 | "Found cookie `%s', but no corresponding expiration entry present...\n", |
777 | token); | 777 | token); |
778 | GNUNET_free (cookies); | 778 | GNUNET_free (cookies); |
779 | return; | 779 | return; |
780 | } | 780 | } |
@@ -1020,10 +1020,10 @@ code_redirect (void *cls) | |||
1020 | { | 1020 | { |
1021 | if (GNUNET_OK != | 1021 | if (GNUNET_OK != |
1022 | GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->oidc | 1022 | GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->oidc |
1023 | ->login_identity, | 1023 | ->login_identity, |
1024 | strlen ( | 1024 | strlen ( |
1025 | handle->oidc | 1025 | handle->oidc |
1026 | ->login_identity), | 1026 | ->login_identity), |
1027 | &pubkey)) | 1027 | &pubkey)) |
1028 | { | 1028 | { |
1029 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_COOKIE); | 1029 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_COOKIE); |
@@ -1191,7 +1191,7 @@ get_url_parameter_copy (const struct RequestHandle *handle, const char *key) | |||
1191 | char *value; | 1191 | char *value; |
1192 | GNUNET_CRYPTO_hash (key, strlen (key), &hc); | 1192 | GNUNET_CRYPTO_hash (key, strlen (key), &hc); |
1193 | if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle | 1193 | if (GNUNET_YES != GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle |
1194 | ->url_param_map, | 1194 | ->url_param_map, |
1195 | &hc)) | 1195 | &hc)) |
1196 | return NULL; | 1196 | return NULL; |
1197 | value = | 1197 | value = |
@@ -1264,7 +1264,7 @@ build_authz_response (void *cls) | |||
1264 | &cache_key); | 1264 | &cache_key); |
1265 | if (GNUNET_YES == | 1265 | if (GNUNET_YES == |
1266 | GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle | 1266 | GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle |
1267 | ->url_param_map, | 1267 | ->url_param_map, |
1268 | &cache_key)) | 1268 | &cache_key)) |
1269 | { | 1269 | { |
1270 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_ACCESS_DENIED); | 1270 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_ACCESS_DENIED); |
@@ -1370,7 +1370,7 @@ authorize_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
1370 | if (GNUNET_OK != | 1370 | if (GNUNET_OK != |
1371 | GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->oidc->client_id, | 1371 | GNUNET_CRYPTO_ecdsa_public_key_from_string (handle->oidc->client_id, |
1372 | strlen ( | 1372 | strlen ( |
1373 | handle->oidc->client_id), | 1373 | handle->oidc->client_id), |
1374 | &handle->oidc->client_pkey)) | 1374 | &handle->oidc->client_pkey)) |
1375 | { | 1375 | { |
1376 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_UNAUTHORIZED_CLIENT); | 1376 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_UNAUTHORIZED_CLIENT); |
@@ -1455,8 +1455,8 @@ login_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
1455 | { | 1455 | { |
1456 | current_time = GNUNET_new (struct GNUNET_TIME_Absolute); | 1456 | current_time = GNUNET_new (struct GNUNET_TIME_Absolute); |
1457 | *current_time = GNUNET_TIME_relative_to_absolute ( | 1457 | *current_time = GNUNET_TIME_relative_to_absolute ( |
1458 | GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_get_second_ (), | 1458 | GNUNET_TIME_relative_multiply (GNUNET_TIME_relative_get_second_ (), |
1459 | OIDC_COOKIE_EXPIRATION)); | 1459 | OIDC_COOKIE_EXPIRATION)); |
1460 | last_time = | 1460 | last_time = |
1461 | GNUNET_CONTAINER_multihashmap_get (OIDC_cookie_jar_map, &cache_key); | 1461 | GNUNET_CONTAINER_multihashmap_get (OIDC_cookie_jar_map, &cache_key); |
1462 | GNUNET_free_non_null (last_time); | 1462 | GNUNET_free_non_null (last_time); |
@@ -1488,7 +1488,7 @@ check_authorization (struct RequestHandle *handle, | |||
1488 | strlen (OIDC_AUTHORIZATION_HEADER_KEY), | 1488 | strlen (OIDC_AUTHORIZATION_HEADER_KEY), |
1489 | &cache_key); | 1489 | &cache_key); |
1490 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle | 1490 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle |
1491 | ->header_param_map, | 1491 | ->header_param_map, |
1492 | &cache_key)) | 1492 | &cache_key)) |
1493 | { | 1493 | { |
1494 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_CLIENT); | 1494 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_CLIENT); |
@@ -1620,10 +1620,10 @@ persist_access_token (const struct RequestHandle *handle, | |||
1620 | ticketbuf = GNUNET_new (struct GNUNET_RECLAIM_Ticket); | 1620 | ticketbuf = GNUNET_new (struct GNUNET_RECLAIM_Ticket); |
1621 | *ticketbuf = *ticket; | 1621 | *ticketbuf = *ticket; |
1622 | GNUNET_CONTAINER_multihashmap_put ( | 1622 | GNUNET_CONTAINER_multihashmap_put ( |
1623 | OIDC_access_token_map, | 1623 | OIDC_access_token_map, |
1624 | &hc, | 1624 | &hc, |
1625 | ticketbuf, | 1625 | ticketbuf, |
1626 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); | 1626 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY); |
1627 | } | 1627 | } |
1628 | 1628 | ||
1629 | /** | 1629 | /** |
@@ -1826,7 +1826,7 @@ userinfo_endpoint (struct GNUNET_REST_RequestHandle *con_handle, | |||
1826 | strlen (OIDC_AUTHORIZATION_HEADER_KEY), | 1826 | strlen (OIDC_AUTHORIZATION_HEADER_KEY), |
1827 | &cache_key); | 1827 | &cache_key); |
1828 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle | 1828 | if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains (handle->rest_handle |
1829 | ->header_param_map, | 1829 | ->header_param_map, |
1830 | &cache_key)) | 1830 | &cache_key)) |
1831 | { | 1831 | { |
1832 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_TOKEN); | 1832 | handle->emsg = GNUNET_strdup (OIDC_ERROR_KEY_INVALID_TOKEN); |
@@ -1915,16 +1915,16 @@ init_cont (struct RequestHandle *handle) | |||
1915 | { | 1915 | { |
1916 | struct GNUNET_REST_RequestHandlerError err; | 1916 | struct GNUNET_REST_RequestHandlerError err; |
1917 | static const struct GNUNET_REST_RequestHandler handlers[] = | 1917 | static const struct GNUNET_REST_RequestHandler handlers[] = |
1918 | {{MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_AUTHORIZE, &authorize_endpoint}, | 1918 | {{MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_AUTHORIZE, &authorize_endpoint}, |
1919 | {MHD_HTTP_METHOD_POST, | 1919 | {MHD_HTTP_METHOD_POST, |
1920 | GNUNET_REST_API_NS_AUTHORIZE, | 1920 | GNUNET_REST_API_NS_AUTHORIZE, |
1921 | &authorize_endpoint}, // url-encoded | 1921 | &authorize_endpoint}, // url-encoded |
1922 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_LOGIN, &login_cont}, | 1922 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_LOGIN, &login_cont}, |
1923 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_TOKEN, &token_endpoint}, | 1923 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_TOKEN, &token_endpoint}, |
1924 | {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_USERINFO, &userinfo_endpoint}, | 1924 | {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_USERINFO, &userinfo_endpoint}, |
1925 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_USERINFO, &userinfo_endpoint}, | 1925 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_USERINFO, &userinfo_endpoint}, |
1926 | {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_OIDC, &options_cont}, | 1926 | {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_OIDC, &options_cont}, |
1927 | GNUNET_REST_HANDLER_END}; | 1927 | GNUNET_REST_HANDLER_END}; |
1928 | 1928 | ||
1929 | if (GNUNET_NO == | 1929 | if (GNUNET_NO == |
1930 | GNUNET_REST_handle_request (handle->rest_handle, handlers, &err, handle)) | 1930 | GNUNET_REST_handle_request (handle->rest_handle, handlers, &err, handle)) |
diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c index 1a3784e64..7fe5283c4 100644 --- a/src/reclaim/plugin_rest_reclaim.c +++ b/src/reclaim/plugin_rest_reclaim.c | |||
@@ -15,7 +15,7 @@ | |||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | /** | 20 | /** |
21 | * @author Martin Schanzenbach | 21 | * @author Martin Schanzenbach |
@@ -25,21 +25,19 @@ | |||
25 | * | 25 | * |
26 | */ | 26 | */ |
27 | #include "platform.h" | 27 | #include "platform.h" |
28 | |||
29 | #include "microhttpd.h" | 28 | #include "microhttpd.h" |
30 | #include <inttypes.h> | 29 | #include <inttypes.h> |
31 | #include <jansson.h> | 30 | #include <jansson.h> |
32 | |||
33 | #include "gnunet_gns_service.h" | 31 | #include "gnunet_gns_service.h" |
34 | #include "gnunet_gnsrecord_lib.h" | 32 | #include "gnunet_gnsrecord_lib.h" |
35 | #include "gnunet_identity_service.h" | 33 | #include "gnunet_identity_service.h" |
36 | #include "gnunet_namestore_service.h" | ||
37 | #include "gnunet_reclaim_attribute_lib.h" | 34 | #include "gnunet_reclaim_attribute_lib.h" |
38 | #include "gnunet_reclaim_service.h" | 35 | #include "gnunet_reclaim_service.h" |
39 | #include "gnunet_rest_lib.h" | 36 | #include "gnunet_rest_lib.h" |
40 | #include "gnunet_rest_plugin.h" | 37 | #include "gnunet_rest_plugin.h" |
41 | #include "gnunet_signatures.h" | 38 | #include "gnunet_signatures.h" |
42 | #include "json_reclaim.h" | 39 | #include "json_reclaim.h" |
40 | |||
43 | /** | 41 | /** |
44 | * REST root namespace | 42 | * REST root namespace |
45 | */ | 43 | */ |
@@ -163,16 +161,6 @@ struct RequestHandle | |||
163 | struct GNUNET_REST_RequestHandle *rest_handle; | 161 | struct GNUNET_REST_RequestHandle *rest_handle; |
164 | 162 | ||
165 | /** | 163 | /** |
166 | * Handle to NAMESTORE | ||
167 | */ | ||
168 | struct GNUNET_NAMESTORE_Handle *namestore_handle; | ||
169 | |||
170 | /** | ||
171 | * Iterator for NAMESTORE | ||
172 | */ | ||
173 | struct GNUNET_NAMESTORE_ZoneIterator *namestore_handle_it; | ||
174 | |||
175 | /** | ||
176 | * Attribute claim list | 164 | * Attribute claim list |
177 | */ | 165 | */ |
178 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attr_list; | 166 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attr_list; |
@@ -276,8 +264,6 @@ cleanup_handle (struct RequestHandle *handle) | |||
276 | GNUNET_free (handle->url); | 264 | GNUNET_free (handle->url); |
277 | if (NULL != handle->emsg) | 265 | if (NULL != handle->emsg) |
278 | GNUNET_free (handle->emsg); | 266 | GNUNET_free (handle->emsg); |
279 | if (NULL != handle->namestore_handle) | ||
280 | GNUNET_NAMESTORE_disconnect (handle->namestore_handle); | ||
281 | if (NULL != handle->attr_list) { | 267 | if (NULL != handle->attr_list) { |
282 | for (claim_entry = handle->attr_list->list_head; NULL != claim_entry;) { | 268 | for (claim_entry = handle->attr_list->list_head; NULL != claim_entry;) { |
283 | claim_tmp = claim_entry; | 269 | claim_tmp = claim_entry; |
@@ -420,12 +406,12 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket) | |||
420 | json_array_append (handle->resp_object, json_resource); | 406 | json_array_append (handle->resp_object, json_resource); |
421 | 407 | ||
422 | tmp = GNUNET_STRINGS_data_to_string_alloc ( | 408 | tmp = GNUNET_STRINGS_data_to_string_alloc ( |
423 | &ticket->identity, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | 409 | &ticket->identity, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); |
424 | value = json_string (tmp); | 410 | value = json_string (tmp); |
425 | json_object_set_new (json_resource, "issuer", value); | 411 | json_object_set_new (json_resource, "issuer", value); |
426 | GNUNET_free (tmp); | 412 | GNUNET_free (tmp); |
427 | tmp = GNUNET_STRINGS_data_to_string_alloc ( | 413 | tmp = GNUNET_STRINGS_data_to_string_alloc ( |
428 | &ticket->audience, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | 414 | &ticket->audience, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); |
429 | value = json_string (tmp); | 415 | value = json_string (tmp); |
430 | json_object_set_new (json_resource, "audience", value); | 416 | json_object_set_new (json_resource, "audience", value); |
431 | GNUNET_free (tmp); | 417 | GNUNET_free (tmp); |
@@ -477,8 +463,8 @@ list_tickets_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
477 | priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); | 463 | priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); |
478 | handle->idp = GNUNET_RECLAIM_connect (cfg); | 464 | handle->idp = GNUNET_RECLAIM_connect (cfg); |
479 | handle->ticket_it = GNUNET_RECLAIM_ticket_iteration_start ( | 465 | handle->ticket_it = GNUNET_RECLAIM_ticket_iteration_start ( |
480 | handle->idp, priv_key, &collect_error_cb, handle, &ticket_collect, handle, | 466 | handle->idp, priv_key, &collect_error_cb, handle, &ticket_collect, handle, |
481 | &collect_finished_cb, handle); | 467 | &collect_finished_cb, handle); |
482 | } | 468 | } |
483 | 469 | ||
484 | 470 | ||
@@ -496,7 +482,7 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
496 | json_t *data_json; | 482 | json_t *data_json; |
497 | json_error_t err; | 483 | json_error_t err; |
498 | struct GNUNET_JSON_Specification attrspec[] = { | 484 | struct GNUNET_JSON_Specification attrspec[] = { |
499 | GNUNET_RECLAIM_JSON_spec_claim (&attribute), GNUNET_JSON_spec_end ()}; | 485 | GNUNET_RECLAIM_JSON_spec_claim (&attribute), GNUNET_JSON_spec_end ()}; |
500 | 486 | ||
501 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding an attribute for %s.\n", | 487 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding an attribute for %s.\n", |
502 | handle->url); | 488 | handle->url); |
@@ -541,11 +527,11 @@ add_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
541 | */ | 527 | */ |
542 | if (0 == attribute->id) | 528 | if (0 == attribute->id) |
543 | attribute->id = | 529 | attribute->id = |
544 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); | 530 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, UINT64_MAX); |
545 | handle->idp = GNUNET_RECLAIM_connect (cfg); | 531 | handle->idp = GNUNET_RECLAIM_connect (cfg); |
546 | exp = GNUNET_TIME_UNIT_HOURS; | 532 | exp = GNUNET_TIME_UNIT_HOURS; |
547 | handle->idp_op = GNUNET_RECLAIM_attribute_store ( | 533 | handle->idp_op = GNUNET_RECLAIM_attribute_store ( |
548 | handle->idp, identity_priv, attribute, &exp, &finished_cont, handle); | 534 | handle->idp, identity_priv, attribute, &exp, &finished_cont, handle); |
549 | GNUNET_JSON_parse_free (attrspec); | 535 | GNUNET_JSON_parse_free (attrspec); |
550 | } | 536 | } |
551 | 537 | ||
@@ -629,8 +615,8 @@ list_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
629 | priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); | 615 | priv_key = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); |
630 | handle->idp = GNUNET_RECLAIM_connect (cfg); | 616 | handle->idp = GNUNET_RECLAIM_connect (cfg); |
631 | handle->attr_it = GNUNET_RECLAIM_get_attributes_start ( | 617 | handle->attr_it = GNUNET_RECLAIM_get_attributes_start ( |
632 | handle->idp, priv_key, &collect_error_cb, handle, &attr_collect, handle, | 618 | handle->idp, priv_key, &collect_error_cb, handle, &attr_collect, handle, |
633 | &collect_finished_cb, handle); | 619 | &collect_finished_cb, handle); |
634 | } | 620 | } |
635 | 621 | ||
636 | 622 | ||
@@ -676,7 +662,7 @@ delete_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
676 | return; | 662 | return; |
677 | } | 663 | } |
678 | identity_id_str = | 664 | identity_id_str = |
679 | strdup (handle->url + strlen (GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES) + 1); | 665 | strdup (handle->url + strlen (GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES) + 1); |
680 | identity = strtok (identity_id_str, "/"); | 666 | identity = strtok (identity_id_str, "/"); |
681 | id = strtok (NULL, "/"); | 667 | id = strtok (NULL, "/"); |
682 | if ((NULL == identity) || (NULL == id)) { | 668 | if ((NULL == identity) || (NULL == id)) { |
@@ -704,7 +690,7 @@ delete_attribute_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
704 | GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof (uint64_t)); | 690 | GNUNET_STRINGS_string_to_data (id, strlen (id), &attr.id, sizeof (uint64_t)); |
705 | attr.name = ""; | 691 | attr.name = ""; |
706 | handle->idp_op = GNUNET_RECLAIM_attribute_delete ( | 692 | handle->idp_op = GNUNET_RECLAIM_attribute_delete ( |
707 | handle->idp, priv_key, &attr, &delete_finished_cb, handle); | 693 | handle->idp, priv_key, &attr, &delete_finished_cb, handle); |
708 | GNUNET_free (identity_id_str); | 694 | GNUNET_free (identity_id_str); |
709 | } | 695 | } |
710 | 696 | ||
@@ -722,7 +708,7 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
722 | json_t *data_json; | 708 | json_t *data_json; |
723 | json_error_t err; | 709 | json_error_t err; |
724 | struct GNUNET_JSON_Specification tktspec[] = { | 710 | struct GNUNET_JSON_Specification tktspec[] = { |
725 | GNUNET_RECLAIM_JSON_spec_ticket (&ticket), GNUNET_JSON_spec_end ()}; | 711 | GNUNET_RECLAIM_JSON_spec_ticket (&ticket), GNUNET_JSON_spec_end ()}; |
726 | 712 | ||
727 | if (0 >= handle->rest_handle->data_size) { | 713 | if (0 >= handle->rest_handle->data_size) { |
728 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 714 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
@@ -766,7 +752,7 @@ revoke_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
766 | 752 | ||
767 | handle->idp = GNUNET_RECLAIM_connect (cfg); | 753 | handle->idp = GNUNET_RECLAIM_connect (cfg); |
768 | handle->idp_op = GNUNET_RECLAIM_ticket_revoke ( | 754 | handle->idp_op = GNUNET_RECLAIM_ticket_revoke ( |
769 | handle->idp, identity_priv, ticket, &finished_cont, handle); | 755 | handle->idp, identity_priv, ticket, &finished_cont, handle); |
770 | GNUNET_JSON_parse_free (tktspec); | 756 | GNUNET_JSON_parse_free (tktspec); |
771 | } | 757 | } |
772 | 758 | ||
@@ -810,7 +796,7 @@ consume_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
810 | json_t *data_json; | 796 | json_t *data_json; |
811 | json_error_t err; | 797 | json_error_t err; |
812 | struct GNUNET_JSON_Specification tktspec[] = { | 798 | struct GNUNET_JSON_Specification tktspec[] = { |
813 | GNUNET_RECLAIM_JSON_spec_ticket (&ticket), GNUNET_JSON_spec_end ()}; | 799 | GNUNET_RECLAIM_JSON_spec_ticket (&ticket), GNUNET_JSON_spec_end ()}; |
814 | 800 | ||
815 | if (0 >= handle->rest_handle->data_size) { | 801 | if (0 >= handle->rest_handle->data_size) { |
816 | GNUNET_SCHEDULER_add_now (&do_error, handle); | 802 | GNUNET_SCHEDULER_add_now (&do_error, handle); |
@@ -850,7 +836,7 @@ consume_ticket_cont (struct GNUNET_REST_RequestHandle *con_handle, | |||
850 | handle->resp_object = json_object (); | 836 | handle->resp_object = json_object (); |
851 | handle->idp = GNUNET_RECLAIM_connect (cfg); | 837 | handle->idp = GNUNET_RECLAIM_connect (cfg); |
852 | handle->idp_op = GNUNET_RECLAIM_ticket_consume ( | 838 | handle->idp_op = GNUNET_RECLAIM_ticket_consume ( |
853 | handle->idp, identity_priv, ticket, &consume_cont, handle); | 839 | handle->idp, identity_priv, ticket, &consume_cont, handle); |
854 | GNUNET_JSON_parse_free (tktspec); | 840 | GNUNET_JSON_parse_free (tktspec); |
855 | } | 841 | } |
856 | 842 | ||
@@ -887,20 +873,20 @@ init_cont (struct RequestHandle *handle) | |||
887 | { | 873 | { |
888 | struct GNUNET_REST_RequestHandlerError err; | 874 | struct GNUNET_REST_RequestHandlerError err; |
889 | static const struct GNUNET_REST_RequestHandler handlers[] = { | 875 | static const struct GNUNET_REST_RequestHandler handlers[] = { |
890 | {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, | 876 | {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, |
891 | &list_attribute_cont}, | 877 | &list_attribute_cont}, |
892 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, | 878 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, |
893 | &add_attribute_cont}, | 879 | &add_attribute_cont}, |
894 | {MHD_HTTP_METHOD_DELETE, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, | 880 | {MHD_HTTP_METHOD_DELETE, GNUNET_REST_API_NS_RECLAIM_ATTRIBUTES, |
895 | &delete_attribute_cont}, | 881 | &delete_attribute_cont}, |
896 | {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY_TICKETS, | 882 | {MHD_HTTP_METHOD_GET, GNUNET_REST_API_NS_IDENTITY_TICKETS, |
897 | &list_tickets_cont}, | 883 | &list_tickets_cont}, |
898 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_IDENTITY_REVOKE, | 884 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_IDENTITY_REVOKE, |
899 | &revoke_ticket_cont}, | 885 | &revoke_ticket_cont}, |
900 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_IDENTITY_CONSUME, | 886 | {MHD_HTTP_METHOD_POST, GNUNET_REST_API_NS_IDENTITY_CONSUME, |
901 | &consume_ticket_cont}, | 887 | &consume_ticket_cont}, |
902 | {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_RECLAIM, &options_cont}, | 888 | {MHD_HTTP_METHOD_OPTIONS, GNUNET_REST_API_NS_RECLAIM, &options_cont}, |
903 | GNUNET_REST_HANDLER_END}; | 889 | GNUNET_REST_HANDLER_END}; |
904 | 890 | ||
905 | if (GNUNET_NO == GNUNET_REST_handle_request (handle->rest_handle, handlers, | 891 | if (GNUNET_NO == GNUNET_REST_handle_request (handle->rest_handle, handlers, |
906 | &err, handle)) { | 892 | &err, handle)) { |
@@ -983,9 +969,8 @@ rest_identity_process_request (struct GNUNET_REST_RequestHandle *rest_handle, | |||
983 | handle->url[strlen (handle->url) - 1] = '\0'; | 969 | handle->url[strlen (handle->url) - 1] = '\0'; |
984 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting...\n"); | 970 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connecting...\n"); |
985 | handle->identity_handle = GNUNET_IDENTITY_connect (cfg, &list_ego, handle); | 971 | handle->identity_handle = GNUNET_IDENTITY_connect (cfg, &list_ego, handle); |
986 | handle->namestore_handle = GNUNET_NAMESTORE_connect (cfg); | ||
987 | handle->timeout_task = | 972 | handle->timeout_task = |
988 | GNUNET_SCHEDULER_add_delayed (handle->timeout, &do_timeout, handle); | 973 | GNUNET_SCHEDULER_add_delayed (handle->timeout, &do_timeout, handle); |
989 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected\n"); | 974 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Connected\n"); |
990 | } | 975 | } |
991 | 976 | ||
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c index 2e64a27b6..5a9b9d4a9 100644 --- a/src/reclaim/reclaim_api.c +++ b/src/reclaim/reclaim_api.c | |||
@@ -1,22 +1,22 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of GNUnet. | 2 | This file is part of GNUnet. |
3 | Copyright (C) 2016 GNUnet e.V. | 3 | Copyright (C) 2016 GNUnet e.V. |
4 | 4 | ||
5 | GNUnet is free software: you can redistribute it and/or modify it | 5 | GNUnet is free software: you can redistribute it and/or modify it |
6 | under the terms of the GNU Affero General Public License as published | 6 | under the terms of the GNU Affero General Public License as published |
7 | by the Free Software Foundation, either version 3 of the License, | 7 | by the Free Software Foundation, either version 3 of the License, |
8 | or (at your option) any later version. | 8 | or (at your option) any later version. |
9 | 9 | ||
10 | GNUnet is distributed in the hope that it will be useful, but | 10 | GNUnet is distributed in the hope that it will be useful, but |
11 | WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Affero General Public License for more details. | 13 | Affero General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Affero General Public License | 15 | You should have received a copy of the GNU Affero General Public License |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
17 | 17 | ||
18 | SPDX-License-Identifier: AGPL3.0-or-later | 18 | SPDX-License-Identifier: AGPL3.0-or-later |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file reclaim/reclaim_api.c | 22 | * @file reclaim/reclaim_api.c |
@@ -24,9 +24,7 @@ | |||
24 | * @author Martin Schanzenbach | 24 | * @author Martin Schanzenbach |
25 | */ | 25 | */ |
26 | #include "platform.h" | 26 | #include "platform.h" |
27 | |||
28 | #include "gnunet_util_lib.h" | 27 | #include "gnunet_util_lib.h" |
29 | |||
30 | #include "gnunet_constants.h" | 28 | #include "gnunet_constants.h" |
31 | #include "gnunet_mq_lib.h" | 29 | #include "gnunet_mq_lib.h" |
32 | #include "gnunet_protocols.h" | 30 | #include "gnunet_protocols.h" |
@@ -351,9 +349,9 @@ force_reconnect (struct GNUNET_RECLAIM_Handle *handle) | |||
351 | GNUNET_MQ_destroy (handle->mq); | 349 | GNUNET_MQ_destroy (handle->mq); |
352 | handle->mq = NULL; | 350 | handle->mq = NULL; |
353 | handle->reconnect_backoff = | 351 | handle->reconnect_backoff = |
354 | GNUNET_TIME_STD_BACKOFF (handle->reconnect_backoff); | 352 | GNUNET_TIME_STD_BACKOFF (handle->reconnect_backoff); |
355 | handle->reconnect_task = GNUNET_SCHEDULER_add_delayed ( | 353 | handle->reconnect_task = GNUNET_SCHEDULER_add_delayed ( |
356 | handle->reconnect_backoff, &reconnect_task, handle); | 354 | handle->reconnect_backoff, &reconnect_task, handle); |
357 | } | 355 | } |
358 | 356 | ||
359 | 357 | ||
@@ -498,7 +496,7 @@ handle_consume_ticket_result (void *cls, | |||
498 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs; | 496 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs; |
499 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; | 497 | struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; |
500 | attrs = | 498 | attrs = |
501 | GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char *)&msg[1], attrs_len); | 499 | GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char *)&msg[1], attrs_len); |
502 | if (NULL != op->ar_cb) { | 500 | if (NULL != op->ar_cb) { |
503 | if (NULL == attrs) { | 501 | if (NULL == attrs) { |
504 | op->ar_cb (op->cls, &msg->identity, NULL); | 502 | op->ar_cb (op->cls, &msg->identity, NULL); |
@@ -735,29 +733,29 @@ static void | |||
735 | reconnect (struct GNUNET_RECLAIM_Handle *h) | 733 | reconnect (struct GNUNET_RECLAIM_Handle *h) |
736 | { | 734 | { |
737 | struct GNUNET_MQ_MessageHandler handlers[] = { | 735 | struct GNUNET_MQ_MessageHandler handlers[] = { |
738 | GNUNET_MQ_hd_fixed_size (success_response, | 736 | GNUNET_MQ_hd_fixed_size (success_response, |
739 | GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE, | 737 | GNUNET_MESSAGE_TYPE_RECLAIM_SUCCESS_RESPONSE, |
740 | struct SuccessResultMessage, h), | 738 | struct SuccessResultMessage, h), |
741 | GNUNET_MQ_hd_var_size (attribute_result, | 739 | GNUNET_MQ_hd_var_size (attribute_result, |
742 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT, | 740 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT, |
743 | struct AttributeResultMessage, h), | 741 | struct AttributeResultMessage, h), |
744 | GNUNET_MQ_hd_var_size (ticket_result, | 742 | GNUNET_MQ_hd_var_size (ticket_result, |
745 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, | 743 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, |
746 | struct TicketResultMessage, h), | 744 | struct TicketResultMessage, h), |
747 | GNUNET_MQ_hd_var_size (consume_ticket_result, | 745 | GNUNET_MQ_hd_var_size (consume_ticket_result, |
748 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT, | 746 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT, |
749 | struct ConsumeTicketResultMessage, h), | 747 | struct ConsumeTicketResultMessage, h), |
750 | GNUNET_MQ_hd_fixed_size (revoke_ticket_result, | 748 | GNUNET_MQ_hd_fixed_size (revoke_ticket_result, |
751 | GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT, | 749 | GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET_RESULT, |
752 | struct RevokeTicketResultMessage, h), | 750 | struct RevokeTicketResultMessage, h), |
753 | GNUNET_MQ_handler_end ()}; | 751 | GNUNET_MQ_handler_end ()}; |
754 | struct GNUNET_RECLAIM_Operation *op; | 752 | struct GNUNET_RECLAIM_Operation *op; |
755 | 753 | ||
756 | GNUNET_assert (NULL == h->mq); | 754 | GNUNET_assert (NULL == h->mq); |
757 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to reclaim service.\n"); | 755 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Connecting to reclaim service.\n"); |
758 | 756 | ||
759 | h->mq = | 757 | h->mq = |
760 | GNUNET_CLIENT_connect (h->cfg, "reclaim", handlers, &mq_error_handler, h); | 758 | GNUNET_CLIENT_connect (h->cfg, "reclaim", handlers, &mq_error_handler, h); |
761 | if (NULL == h->mq) | 759 | if (NULL == h->mq) |
762 | return; | 760 | return; |
763 | for (op = h->op_head; NULL != op; op = op->next) | 761 | for (op = h->op_head; NULL != op; op = op->next) |
@@ -840,11 +838,11 @@ GNUNET_RECLAIM_disconnect (struct GNUNET_RECLAIM_Handle *h) | |||
840 | */ | 838 | */ |
841 | struct GNUNET_RECLAIM_Operation * | 839 | struct GNUNET_RECLAIM_Operation * |
842 | GNUNET_RECLAIM_attribute_store ( | 840 | GNUNET_RECLAIM_attribute_store ( |
843 | struct GNUNET_RECLAIM_Handle *h, | 841 | struct GNUNET_RECLAIM_Handle *h, |
844 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 842 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, |
845 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, | 843 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, |
846 | const struct GNUNET_TIME_Relative *exp_interval, | 844 | const struct GNUNET_TIME_Relative *exp_interval, |
847 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls) | 845 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls) |
848 | { | 846 | { |
849 | struct GNUNET_RECLAIM_Operation *op; | 847 | struct GNUNET_RECLAIM_Operation *op; |
850 | struct AttributeStoreMessage *sam; | 848 | struct AttributeStoreMessage *sam; |
@@ -885,10 +883,10 @@ GNUNET_RECLAIM_attribute_store ( | |||
885 | */ | 883 | */ |
886 | struct GNUNET_RECLAIM_Operation * | 884 | struct GNUNET_RECLAIM_Operation * |
887 | GNUNET_RECLAIM_attribute_delete ( | 885 | GNUNET_RECLAIM_attribute_delete ( |
888 | struct GNUNET_RECLAIM_Handle *h, | 886 | struct GNUNET_RECLAIM_Handle *h, |
889 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 887 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, |
890 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, | 888 | const struct GNUNET_RECLAIM_ATTRIBUTE_Claim *attr, |
891 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls) | 889 | GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls) |
892 | { | 890 | { |
893 | struct GNUNET_RECLAIM_Operation *op; | 891 | struct GNUNET_RECLAIM_Operation *op; |
894 | struct AttributeDeleteMessage *dam; | 892 | struct AttributeDeleteMessage *dam; |
@@ -940,11 +938,11 @@ GNUNET_RECLAIM_attribute_delete ( | |||
940 | */ | 938 | */ |
941 | struct GNUNET_RECLAIM_AttributeIterator * | 939 | struct GNUNET_RECLAIM_AttributeIterator * |
942 | GNUNET_RECLAIM_get_attributes_start ( | 940 | GNUNET_RECLAIM_get_attributes_start ( |
943 | struct GNUNET_RECLAIM_Handle *h, | 941 | struct GNUNET_RECLAIM_Handle *h, |
944 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 942 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, |
945 | GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, | 943 | GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, |
946 | GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, | 944 | GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, |
947 | GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls) | 945 | GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls) |
948 | { | 946 | { |
949 | struct GNUNET_RECLAIM_AttributeIterator *it; | 947 | struct GNUNET_RECLAIM_AttributeIterator *it; |
950 | struct GNUNET_MQ_Envelope *env; | 948 | struct GNUNET_MQ_Envelope *env; |
@@ -989,7 +987,7 @@ GNUNET_RECLAIM_get_attributes_next (struct GNUNET_RECLAIM_AttributeIterator *it) | |||
989 | struct GNUNET_MQ_Envelope *env; | 987 | struct GNUNET_MQ_Envelope *env; |
990 | 988 | ||
991 | env = | 989 | env = |
992 | GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT); | 990 | GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT); |
993 | msg->id = htonl (it->r_id); | 991 | msg->id = htonl (it->r_id); |
994 | GNUNET_MQ_send (h->mq, env); | 992 | GNUNET_MQ_send (h->mq, env); |
995 | } | 993 | } |
@@ -1034,11 +1032,11 @@ GNUNET_RECLAIM_get_attributes_stop (struct GNUNET_RECLAIM_AttributeIterator *it) | |||
1034 | */ | 1032 | */ |
1035 | struct GNUNET_RECLAIM_Operation * | 1033 | struct GNUNET_RECLAIM_Operation * |
1036 | GNUNET_RECLAIM_ticket_issue ( | 1034 | GNUNET_RECLAIM_ticket_issue ( |
1037 | struct GNUNET_RECLAIM_Handle *h, | 1035 | struct GNUNET_RECLAIM_Handle *h, |
1038 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, | 1036 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, |
1039 | const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, | 1037 | const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, |
1040 | const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, | 1038 | const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, |
1041 | GNUNET_RECLAIM_TicketCallback cb, void *cb_cls) | 1039 | GNUNET_RECLAIM_TicketCallback cb, void *cb_cls) |
1042 | { | 1040 | { |
1043 | struct GNUNET_RECLAIM_Operation *op; | 1041 | struct GNUNET_RECLAIM_Operation *op; |
1044 | struct IssueTicketMessage *tim; | 1042 | struct IssueTicketMessage *tim; |
@@ -1080,10 +1078,10 @@ GNUNET_RECLAIM_ticket_issue ( | |||
1080 | */ | 1078 | */ |
1081 | struct GNUNET_RECLAIM_Operation * | 1079 | struct GNUNET_RECLAIM_Operation * |
1082 | GNUNET_RECLAIM_ticket_consume ( | 1080 | GNUNET_RECLAIM_ticket_consume ( |
1083 | struct GNUNET_RECLAIM_Handle *h, | 1081 | struct GNUNET_RECLAIM_Handle *h, |
1084 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 1082 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, |
1085 | const struct GNUNET_RECLAIM_Ticket *ticket, | 1083 | const struct GNUNET_RECLAIM_Ticket *ticket, |
1086 | GNUNET_RECLAIM_AttributeResult cb, void *cb_cls) | 1084 | GNUNET_RECLAIM_AttributeResult cb, void *cb_cls) |
1087 | { | 1085 | { |
1088 | struct GNUNET_RECLAIM_Operation *op; | 1086 | struct GNUNET_RECLAIM_Operation *op; |
1089 | struct ConsumeTicketMessage *ctm; | 1087 | struct ConsumeTicketMessage *ctm; |
@@ -1095,8 +1093,8 @@ GNUNET_RECLAIM_ticket_consume ( | |||
1095 | op->r_id = h->r_id_gen++; | 1093 | op->r_id = h->r_id_gen++; |
1096 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | 1094 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); |
1097 | op->env = | 1095 | op->env = |
1098 | GNUNET_MQ_msg_extra (ctm, sizeof (const struct GNUNET_RECLAIM_Ticket), | 1096 | GNUNET_MQ_msg_extra (ctm, sizeof (const struct GNUNET_RECLAIM_Ticket), |
1099 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET); | 1097 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET); |
1100 | ctm->identity = *identity; | 1098 | ctm->identity = *identity; |
1101 | ctm->id = htonl (op->r_id); | 1099 | ctm->id = htonl (op->r_id); |
1102 | 1100 | ||
@@ -1128,11 +1126,11 @@ GNUNET_RECLAIM_ticket_consume ( | |||
1128 | */ | 1126 | */ |
1129 | struct GNUNET_RECLAIM_TicketIterator * | 1127 | struct GNUNET_RECLAIM_TicketIterator * |
1130 | GNUNET_RECLAIM_ticket_iteration_start ( | 1128 | GNUNET_RECLAIM_ticket_iteration_start ( |
1131 | struct GNUNET_RECLAIM_Handle *h, | 1129 | struct GNUNET_RECLAIM_Handle *h, |
1132 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 1130 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, |
1133 | GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, | 1131 | GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, |
1134 | GNUNET_RECLAIM_TicketCallback proc, void *proc_cls, | 1132 | GNUNET_RECLAIM_TicketCallback proc, void *proc_cls, |
1135 | GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls) | 1133 | GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls) |
1136 | { | 1134 | { |
1137 | struct GNUNET_RECLAIM_TicketIterator *it; | 1135 | struct GNUNET_RECLAIM_TicketIterator *it; |
1138 | struct GNUNET_MQ_Envelope *env; | 1136 | struct GNUNET_MQ_Envelope *env; |
@@ -1196,7 +1194,7 @@ GNUNET_RECLAIM_ticket_iteration_stop (struct GNUNET_RECLAIM_TicketIterator *it) | |||
1196 | 1194 | ||
1197 | if (NULL != h->mq) { | 1195 | if (NULL != h->mq) { |
1198 | env = | 1196 | env = |
1199 | GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP); | 1197 | GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_STOP); |
1200 | msg->id = htonl (it->r_id); | 1198 | msg->id = htonl (it->r_id); |
1201 | GNUNET_MQ_send (h->mq, env); | 1199 | GNUNET_MQ_send (h->mq, env); |
1202 | } | 1200 | } |
@@ -1219,10 +1217,10 @@ GNUNET_RECLAIM_ticket_iteration_stop (struct GNUNET_RECLAIM_TicketIterator *it) | |||
1219 | */ | 1217 | */ |
1220 | struct GNUNET_RECLAIM_Operation * | 1218 | struct GNUNET_RECLAIM_Operation * |
1221 | GNUNET_RECLAIM_ticket_revoke ( | 1219 | GNUNET_RECLAIM_ticket_revoke ( |
1222 | struct GNUNET_RECLAIM_Handle *h, | 1220 | struct GNUNET_RECLAIM_Handle *h, |
1223 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, | 1221 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, |
1224 | const struct GNUNET_RECLAIM_Ticket *ticket, | 1222 | const struct GNUNET_RECLAIM_Ticket *ticket, |
1225 | GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls) | 1223 | GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls) |
1226 | { | 1224 | { |
1227 | struct GNUNET_RECLAIM_Operation *op; | 1225 | struct GNUNET_RECLAIM_Operation *op; |
1228 | struct RevokeTicketMessage *msg; | 1226 | struct RevokeTicketMessage *msg; |