diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-02-04 22:50:32 +0100 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-02-09 20:38:10 +0100 |
commit | 065ecd9a0f92ecafd6c552494a6310b92cc08597 (patch) | |
tree | 0b3ca58f4d2a04278033788063d0b432e90c92aa | |
parent | 73de82ef85076f0421af025887f0053e6c652b09 (diff) | |
download | gnunet-065ecd9a0f92ecafd6c552494a6310b92cc08597.tar.gz gnunet-065ecd9a0f92ecafd6c552494a6310b92cc08597.zip |
bugfixes
-rw-r--r-- | src/include/Makefile.am | 2 | ||||
-rw-r--r-- | src/include/gnunet_protocols.h | 6 | ||||
-rw-r--r-- | src/reclaim/gnunet-reclaim.c | 59 | ||||
-rw-r--r-- | src/reclaim/gnunet-service-reclaim.c | 73 | ||||
-rw-r--r-- | src/reclaim/reclaim_api.c | 2 |
5 files changed, 67 insertions, 75 deletions
diff --git a/src/include/Makefile.am b/src/include/Makefile.am index b53f2420d..69a493f1e 100644 --- a/src/include/Makefile.am +++ b/src/include/Makefile.am | |||
@@ -57,7 +57,7 @@ gnunetinclude_HEADERS = \ | |||
57 | gnunet_identity_service.h \ | 57 | gnunet_identity_service.h \ |
58 | gnunet_abe_lib.h \ | 58 | gnunet_abe_lib.h \ |
59 | gnunet_reclaim_attribute_lib.h \ | 59 | gnunet_reclaim_attribute_lib.h \ |
60 | gnunet_reclaim_attribute_plugin.h \ | 60 | gnunet_reclaim_plugin.h \ |
61 | gnunet_reclaim_service.h \ | 61 | gnunet_reclaim_service.h \ |
62 | gnunet_json_lib.h \ | 62 | gnunet_json_lib.h \ |
63 | gnunet_load_lib.h \ | 63 | gnunet_load_lib.h \ |
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index d92015787..e67e35f38 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -2720,11 +2720,11 @@ extern "C" { | |||
2720 | 2720 | ||
2721 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT 979 | 2721 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT 979 |
2722 | 2722 | ||
2723 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START 963 | 2723 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START 980 |
2724 | 2724 | ||
2725 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP 964 | 2725 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP 981 |
2726 | 2726 | ||
2727 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT 965 | 2727 | #define GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_NEXT 982 |
2728 | 2728 | ||
2729 | 2729 | ||
2730 | /************************************************** | 2730 | /************************************************** |
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c index 35c1258f5..3e31fef4c 100644 --- a/src/reclaim/gnunet-reclaim.c +++ b/src/reclaim/gnunet-reclaim.c | |||
@@ -208,6 +208,8 @@ do_cleanup (void *cls) | |||
208 | GNUNET_RECLAIM_cancel (reclaim_op); | 208 | GNUNET_RECLAIM_cancel (reclaim_op); |
209 | if (NULL != attr_iterator) | 209 | if (NULL != attr_iterator) |
210 | GNUNET_RECLAIM_get_attributes_stop (attr_iterator); | 210 | GNUNET_RECLAIM_get_attributes_stop (attr_iterator); |
211 | if (NULL != attest_iterator) | ||
212 | GNUNET_RECLAIM_get_attestations_stop (attest_iterator); | ||
211 | if (NULL != ticket_iterator) | 213 | if (NULL != ticket_iterator) |
212 | GNUNET_RECLAIM_ticket_iteration_stop (ticket_iterator); | 214 | GNUNET_RECLAIM_ticket_iteration_stop (ticket_iterator); |
213 | if (NULL != reclaim_handle) | 215 | if (NULL != reclaim_handle) |
@@ -467,7 +469,6 @@ iter_finished (void *cls) | |||
467 | { | 469 | { |
468 | claim->attestation = attestation; | 470 | claim->attestation = attestation; |
469 | } | 471 | } |
470 | else | ||
471 | reclaim_op = GNUNET_RECLAIM_attribute_store (reclaim_handle, | 472 | reclaim_op = GNUNET_RECLAIM_attribute_store (reclaim_handle, |
472 | pkey, | 473 | pkey, |
473 | claim, | 474 | claim, |
@@ -569,13 +570,14 @@ static void | |||
569 | attest_iter_finished (void *cls) | 570 | attest_iter_finished (void *cls) |
570 | { | 571 | { |
571 | attest_iterator = NULL; | 572 | attest_iterator = NULL; |
572 | //Add new attestation | 573 | |
574 | // Add new attestation | ||
573 | if ((NULL != attestation_name) && | 575 | if ((NULL != attestation_name) && |
574 | (NULL != attr_value)) | 576 | (NULL != attr_value)) |
575 | { | 577 | { |
576 | struct GNUNET_RECLAIM_Attestation *attestation = | 578 | struct GNUNET_RECLAIM_Attestation *attestation = |
577 | GNUNET_RECLAIM_attestation_new (attestation_name, | 579 | GNUNET_RECLAIM_attestation_new (attestation_name, |
578 | GNUNET_RECLAIM_ATTESTATION_TYPE_JWT, //FIXME hardcoded | 580 | GNUNET_RECLAIM_ATTESTATION_TYPE_JWT, // FIXME hardcoded |
579 | attr_value, | 581 | attr_value, |
580 | strlen (attr_value)); | 582 | strlen (attr_value)); |
581 | reclaim_op = GNUNET_RECLAIM_attestation_store (reclaim_handle, | 583 | reclaim_op = GNUNET_RECLAIM_attestation_store (reclaim_handle, |
@@ -587,19 +589,20 @@ attest_iter_finished (void *cls) | |||
587 | return; | 589 | return; |
588 | 590 | ||
589 | } | 591 | } |
590 | if (! list_attestations) | 592 | if (list_attestations) |
591 | { | 593 | { |
592 | attr_iterator = GNUNET_RECLAIM_get_attributes_start (reclaim_handle, | 594 | cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); |
593 | pkey, | 595 | return; |
594 | &iter_error, | ||
595 | NULL, | ||
596 | &iter_cb, | ||
597 | NULL, | ||
598 | &iter_finished, | ||
599 | NULL); | ||
600 | |||
601 | } | 596 | } |
602 | cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL); | 597 | attr_iterator = GNUNET_RECLAIM_get_attributes_start (reclaim_handle, |
598 | pkey, | ||
599 | &iter_error, | ||
600 | NULL, | ||
601 | &iter_cb, | ||
602 | NULL, | ||
603 | &iter_finished, | ||
604 | NULL); | ||
605 | |||
603 | } | 606 | } |
604 | 607 | ||
605 | 608 | ||
@@ -620,7 +623,7 @@ attest_iter_cb (void *cls, | |||
620 | attest_str = GNUNET_RECLAIM_attestation_value_to_string (attest->type, | 623 | attest_str = GNUNET_RECLAIM_attestation_value_to_string (attest->type, |
621 | attest->data, | 624 | attest->data, |
622 | attest->data_size); | 625 | attest->data_size); |
623 | attest_type = GNUNET_RECLAIM_attribute_number_to_typename (attest->type); | 626 | attest_type = GNUNET_RECLAIM_attestation_number_to_typename (attest->type); |
624 | id = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(attest->id)); | 627 | id = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(attest->id)); |
625 | fprintf (stdout, | 628 | fprintf (stdout, |
626 | "Name: %s; Value: %s (%s); Flag %u; ID: %s\n", | 629 | "Name: %s; Value: %s (%s); Flag %u; ID: %s\n", |
@@ -662,19 +665,6 @@ start_process () | |||
662 | NULL); | 665 | NULL); |
663 | return; | 666 | return; |
664 | } | 667 | } |
665 | if (list_attestations) | ||
666 | { | ||
667 | attest_iterator = GNUNET_RECLAIM_get_attestations_start (reclaim_handle, | ||
668 | pkey, | ||
669 | &iter_error, | ||
670 | NULL, | ||
671 | &attest_iter_cb, | ||
672 | NULL, | ||
673 | & | ||
674 | attest_iter_finished, | ||
675 | NULL); | ||
676 | return; | ||
677 | } | ||
678 | 668 | ||
679 | if ((NULL != rp) && | 669 | if ((NULL != rp) && |
680 | (GNUNET_OK != | 670 | (GNUNET_OK != |
@@ -697,6 +687,16 @@ start_process () | |||
697 | 687 | ||
698 | attr_list = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); | 688 | attr_list = GNUNET_new (struct GNUNET_RECLAIM_AttributeList); |
699 | claim = NULL; | 689 | claim = NULL; |
690 | attest_iterator = GNUNET_RECLAIM_get_attestations_start (reclaim_handle, | ||
691 | pkey, | ||
692 | &iter_error, | ||
693 | NULL, | ||
694 | &attest_iter_cb, | ||
695 | NULL, | ||
696 | & | ||
697 | attest_iter_finished, | ||
698 | NULL); | ||
699 | |||
700 | } | 700 | } |
701 | 701 | ||
702 | 702 | ||
@@ -799,7 +799,8 @@ main (int argc, char *const argv[]) | |||
799 | GNUNET_GETOPT_option_string ('I', | 799 | GNUNET_GETOPT_option_string ('I', |
800 | "Attestation ID", | 800 | "Attestation ID", |
801 | "ATTESTATION_ID", | 801 | "ATTESTATION_ID", |
802 | gettext_noop ("Attestation to use for attribute"), | 802 | gettext_noop ( |
803 | "Attestation to use for attribute"), | ||
803 | &attestation_id), | 804 | &attestation_id), |
804 | GNUNET_GETOPT_option_string ('N', | 805 | GNUNET_GETOPT_option_string ('N', |
805 | "attestation-name", | 806 | "attestation-name", |
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c index f6fd04eeb..61d029665 100644 --- a/src/reclaim/gnunet-service-reclaim.c +++ b/src/reclaim/gnunet-service-reclaim.c | |||
@@ -1718,31 +1718,26 @@ attr_iter_cb (void *cls, | |||
1718 | struct GNUNET_MQ_Envelope *env; | 1718 | struct GNUNET_MQ_Envelope *env; |
1719 | char *data_tmp; | 1719 | char *data_tmp; |
1720 | 1720 | ||
1721 | if (rd_count == 0) | 1721 | if ((rd_count != 1) || |
1722 | (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE != rd->record_type)) | ||
1722 | { | 1723 | { |
1723 | GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1); | 1724 | GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1); |
1724 | return; | 1725 | return; |
1725 | } | 1726 | } |
1726 | 1727 | struct AttributeResultMessage *arm; | |
1727 | for (int i = 0; i<rd_count; i++) | 1728 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n", |
1728 | { | 1729 | label); |
1729 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE != rd[i].record_type) | 1730 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1730 | continue; | 1731 | "Sending ATTRIBUTE_RESULT message\n"); |
1731 | struct AttributeResultMessage *arm; | 1732 | env = GNUNET_MQ_msg_extra (arm, |
1732 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attribute under: %s\n", | 1733 | rd->data_size, |
1733 | label); | 1734 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); |
1734 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1735 | arm->id = htonl (ai->request_id); |
1735 | "Sending ATTRIBUTE_RESULT message\n"); | 1736 | arm->attr_len = htons (rd->data_size); |
1736 | env = GNUNET_MQ_msg_extra (arm, | 1737 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); |
1737 | rd[i].data_size, | 1738 | data_tmp = (char *) &arm[1]; |
1738 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); | 1739 | GNUNET_memcpy (data_tmp, rd->data, rd->data_size); |
1739 | arm->id = htonl (ai->request_id); | 1740 | GNUNET_MQ_send (ai->client->mq, env); |
1740 | arm->attr_len = htons (rd[i].data_size); | ||
1741 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); | ||
1742 | data_tmp = (char *) &arm[1]; | ||
1743 | GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size); | ||
1744 | GNUNET_MQ_send (ai->client->mq, env); | ||
1745 | } | ||
1746 | } | 1741 | } |
1747 | 1742 | ||
1748 | 1743 | ||
@@ -1907,31 +1902,27 @@ attest_iter_cb (void *cls, | |||
1907 | struct GNUNET_MQ_Envelope *env; | 1902 | struct GNUNET_MQ_Envelope *env; |
1908 | char *data_tmp; | 1903 | char *data_tmp; |
1909 | 1904 | ||
1910 | if (rd_count == 0) | 1905 | if ((rd_count != 1) || |
1906 | (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION != rd->record_type)) | ||
1911 | { | 1907 | { |
1912 | GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1); | 1908 | GNUNET_NAMESTORE_zone_iterator_next (ai->ns_it, 1); |
1913 | return; | 1909 | return; |
1914 | } | 1910 | } |
1915 | 1911 | ||
1916 | for (int i = 0; i<rd_count; i++) | 1912 | struct AttestationResultMessage *arm; |
1917 | { | 1913 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n", |
1918 | if (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTESTATION != rd[i].record_type) | 1914 | label); |
1919 | continue; | 1915 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1920 | struct AttestationResultMessage *arm; | 1916 | "Sending ATTESTATION_RESULT message\n"); |
1921 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found attestation under: %s\n", | 1917 | env = GNUNET_MQ_msg_extra (arm, |
1922 | label); | 1918 | rd->data_size, |
1923 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1919 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT); |
1924 | "Sending ATTESTATION_RESULT message\n"); | 1920 | arm->id = htonl (ai->request_id); |
1925 | env = GNUNET_MQ_msg_extra (arm, | 1921 | arm->attestation_len = htons (rd->data_size); |
1926 | rd[i].data_size, | 1922 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); |
1927 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_RESULT); | 1923 | data_tmp = (char *) &arm[1]; |
1928 | arm->id = htonl (ai->request_id); | 1924 | GNUNET_memcpy (data_tmp, rd->data, rd->data_size); |
1929 | arm->attestation_len = htons (rd[i].data_size); | 1925 | GNUNET_MQ_send (ai->client->mq, env); |
1930 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &arm->identity); | ||
1931 | data_tmp = (char *) &arm[1]; | ||
1932 | GNUNET_memcpy (data_tmp, rd[i].data, rd[i].data_size); | ||
1933 | GNUNET_MQ_send (ai->client->mq, env); | ||
1934 | } | ||
1935 | } | 1926 | } |
1936 | 1927 | ||
1937 | 1928 | ||
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c index 89b9ea0f7..3820550c9 100644 --- a/src/reclaim/reclaim_api.c +++ b/src/reclaim/reclaim_api.c | |||
@@ -1423,7 +1423,7 @@ GNUNET_RECLAIM_get_attestations_start ( | |||
1423 | ait->identity = *identity; | 1423 | ait->identity = *identity; |
1424 | GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait); | 1424 | GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait); |
1425 | env = | 1425 | env = |
1426 | GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START); | 1426 | GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START); |
1427 | msg->id = htonl (rid); | 1427 | msg->id = htonl (rid); |
1428 | msg->identity = *identity; | 1428 | msg->identity = *identity; |
1429 | if (NULL == h->mq) | 1429 | if (NULL == h->mq) |