diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2022-10-29 18:06:26 +0900 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2022-10-29 18:06:26 +0900 |
commit | 0f2da4636e108c70697c589d9e38781f2bafefba (patch) | |
tree | 0e831befd71d4323596cdae55e8431df7720c531 /src/reclaim/gnunet-service-reclaim.c | |
parent | 4e2259f14be320c8e2fe2a672a473e09677269c4 (diff) | |
download | gnunet-0f2da4636e108c70697c589d9e38781f2bafefba.tar.gz gnunet-0f2da4636e108c70697c589d9e38781f2bafefba.zip |
IDENTITY
This commit is a major rework of the unclean GNUNET_IDENTITY_*Key
structures and its use in serialized objects (e.g. RPC messages).
The structures are now no longer to be used directly but instead through
their serialization helper functions whenever needed.
Diffstat (limited to 'src/reclaim/gnunet-service-reclaim.c')
-rw-r--r-- | src/reclaim/gnunet-service-reclaim.c | 410 |
1 files changed, 359 insertions, 51 deletions
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c index 5c484e55d..ea97f8749 100644 --- a/src/reclaim/gnunet-service-reclaim.c +++ b/src/reclaim/gnunet-service-reclaim.c | |||
@@ -657,18 +657,27 @@ send_ticket_result (const struct IdpClient *client, | |||
657 | struct TicketResultMessage *irm; | 657 | struct TicketResultMessage *irm; |
658 | struct GNUNET_MQ_Envelope *env; | 658 | struct GNUNET_MQ_Envelope *env; |
659 | size_t pres_len = 0; | 659 | size_t pres_len = 0; |
660 | size_t tkt_len = 0; | ||
661 | ssize_t written; | ||
662 | char *buf; | ||
660 | 663 | ||
661 | if (NULL != presentations) | 664 | if (NULL != presentations) |
662 | { | 665 | { |
663 | pres_len = | 666 | pres_len = |
664 | GNUNET_RECLAIM_presentation_list_serialize_get_size (presentations); | 667 | GNUNET_RECLAIM_presentation_list_serialize_get_size (presentations); |
665 | } | 668 | } |
669 | if (NULL != ticket) | ||
670 | tkt_len = GNUNET_RECLAIM_ticket_serialize_get_size (ticket); | ||
666 | env = GNUNET_MQ_msg_extra (irm, | 671 | env = GNUNET_MQ_msg_extra (irm, |
667 | pres_len, | 672 | pres_len + tkt_len, |
668 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); | 673 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); |
674 | buf = (char*) &irm[1]; | ||
669 | if (NULL != ticket) | 675 | if (NULL != ticket) |
670 | { | 676 | { |
671 | irm->ticket = *ticket; | 677 | irm->tkt_len = htonl (tkt_len); |
678 | written = GNUNET_RECLAIM_write_ticket_to_buffer (ticket, buf, tkt_len); | ||
679 | GNUNET_assert (0 <= written); | ||
680 | buf += written; | ||
672 | } | 681 | } |
673 | // TODO add success member | 682 | // TODO add success member |
674 | irm->id = htonl (r_id); | 683 | irm->id = htonl (r_id); |
@@ -676,7 +685,7 @@ send_ticket_result (const struct IdpClient *client, | |||
676 | if (NULL != presentations) | 685 | if (NULL != presentations) |
677 | { | 686 | { |
678 | GNUNET_RECLAIM_presentation_list_serialize (presentations, | 687 | GNUNET_RECLAIM_presentation_list_serialize (presentations, |
679 | (char*) &irm[1]); | 688 | buf); |
680 | } | 689 | } |
681 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n"); | 690 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n"); |
682 | GNUNET_MQ_send (client->mq, env); | 691 | GNUNET_MQ_send (client->mq, env); |
@@ -732,11 +741,15 @@ check_issue_ticket_message (void *cls, const struct IssueTicketMessage *im) | |||
732 | { | 741 | { |
733 | uint16_t size; | 742 | uint16_t size; |
734 | size_t attrs_len; | 743 | size_t attrs_len; |
744 | size_t key_len; | ||
745 | size_t pkey_len; | ||
735 | 746 | ||
736 | size = ntohs (im->header.size); | 747 | size = ntohs (im->header.size); |
737 | attrs_len = ntohs (im->attr_len); | 748 | attrs_len = ntohs (im->attr_len); |
738 | 749 | key_len = ntohl (im->key_len); | |
739 | if (attrs_len > size - sizeof(struct IssueTicketMessage)) | 750 | pkey_len = ntohl (im->pkey_len); |
751 | if (size != attrs_len + key_len + pkey_len + sizeof(struct | ||
752 | IssueTicketMessage)) | ||
740 | { | 753 | { |
741 | GNUNET_break (0); | 754 | GNUNET_break (0); |
742 | return GNUNET_SYSERR; | 755 | return GNUNET_SYSERR; |
@@ -758,12 +771,43 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im) | |||
758 | struct IdpClient *idp = cls; | 771 | struct IdpClient *idp = cls; |
759 | struct GNUNET_RECLAIM_AttributeList *attrs; | 772 | struct GNUNET_RECLAIM_AttributeList *attrs; |
760 | struct GNUNET_RECLAIM_AttributeListEntry *le; | 773 | struct GNUNET_RECLAIM_AttributeListEntry *le; |
774 | struct GNUNET_IDENTITY_PrivateKey identity; | ||
775 | struct GNUNET_IDENTITY_PublicKey rp; | ||
761 | size_t attrs_len; | 776 | size_t attrs_len; |
777 | size_t key_len; | ||
778 | size_t pkey_len; | ||
779 | size_t read; | ||
780 | char *buf; | ||
762 | 781 | ||
763 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n"); | 782 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ISSUE_TICKET message\n"); |
783 | key_len = ntohl (im->key_len); | ||
784 | buf = (char *) &im[1]; | ||
785 | if ((GNUNET_SYSERR == | ||
786 | GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, | ||
787 | &identity, &read)) || | ||
788 | (read != key_len)) | ||
789 | { | ||
790 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
791 | "Failed to read private key\n"); | ||
792 | GNUNET_SERVICE_client_drop (idp->client); | ||
793 | return; | ||
794 | } | ||
795 | buf += read; | ||
796 | pkey_len = ntohl (im->pkey_len); | ||
797 | if ((GNUNET_SYSERR == | ||
798 | GNUNET_IDENTITY_read_public_key_from_buffer (buf, pkey_len, | ||
799 | &rp, &read)) || | ||
800 | (read != pkey_len)) | ||
801 | { | ||
802 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
803 | "Failed to read public key\n"); | ||
804 | GNUNET_SERVICE_client_drop (idp->client); | ||
805 | return; | ||
806 | } | ||
807 | buf += read; | ||
764 | tio = GNUNET_new (struct TicketIssueOperation); | 808 | tio = GNUNET_new (struct TicketIssueOperation); |
765 | attrs_len = ntohs (im->attr_len); | 809 | attrs_len = ntohs (im->attr_len); |
766 | attrs = GNUNET_RECLAIM_attribute_list_deserialize ((char *) &im[1], | 810 | attrs = GNUNET_RECLAIM_attribute_list_deserialize (buf, |
767 | attrs_len); | 811 | attrs_len); |
768 | for (le = attrs->list_head; NULL != le; le = le->next) | 812 | for (le = attrs->list_head; NULL != le; le = le->next) |
769 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 813 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -772,9 +816,9 @@ handle_issue_ticket_message (void *cls, const struct IssueTicketMessage *im) | |||
772 | tio->r_id = ntohl (im->id); | 816 | tio->r_id = ntohl (im->id); |
773 | tio->client = idp; | 817 | tio->client = idp; |
774 | GNUNET_CONTAINER_DLL_insert (idp->issue_op_head, idp->issue_op_tail, tio); | 818 | GNUNET_CONTAINER_DLL_insert (idp->issue_op_head, idp->issue_op_tail, tio); |
775 | RECLAIM_TICKETS_issue (&im->identity, | 819 | RECLAIM_TICKETS_issue (&identity, |
776 | attrs, | 820 | attrs, |
777 | &im->rp, | 821 | &rp, |
778 | &issue_ticket_result_cb, | 822 | &issue_ticket_result_cb, |
779 | tio); | 823 | tio); |
780 | GNUNET_SERVICE_client_continue (idp->client); | 824 | GNUNET_SERVICE_client_continue (idp->client); |
@@ -846,15 +890,44 @@ handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm) | |||
846 | { | 890 | { |
847 | struct TicketRevocationOperation *rop; | 891 | struct TicketRevocationOperation *rop; |
848 | struct IdpClient *idp = cls; | 892 | struct IdpClient *idp = cls; |
893 | struct GNUNET_IDENTITY_PrivateKey identity; | ||
894 | struct GNUNET_RECLAIM_Ticket ticket; | ||
895 | size_t key_len; | ||
896 | size_t tkt_len; | ||
897 | size_t read; | ||
898 | char *buf; | ||
849 | 899 | ||
850 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n"); | 900 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n"); |
901 | key_len = ntohl (rm->key_len); | ||
902 | buf = (char *) &rm[1]; | ||
903 | if ((GNUNET_SYSERR == | ||
904 | GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, | ||
905 | &identity, &read)) || | ||
906 | (read != key_len)) | ||
907 | { | ||
908 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
909 | "Failed to read private key\n"); | ||
910 | GNUNET_SERVICE_client_drop (idp->client); | ||
911 | return; | ||
912 | } | ||
913 | buf += read; | ||
914 | tkt_len = ntohl (rm->tkt_len); | ||
915 | if ((GNUNET_SYSERR == | ||
916 | GNUNET_RECLAIM_read_ticket_from_buffer (buf, key_len, | ||
917 | &ticket, &read)) || | ||
918 | (read != tkt_len)) | ||
919 | { | ||
920 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
921 | "Failed to read ticket\n"); | ||
922 | GNUNET_SERVICE_client_drop (idp->client); | ||
923 | return; | ||
924 | } | ||
851 | rop = GNUNET_new (struct TicketRevocationOperation); | 925 | rop = GNUNET_new (struct TicketRevocationOperation); |
852 | rop->r_id = ntohl (rm->id); | 926 | rop->r_id = ntohl (rm->id); |
853 | rop->client = idp; | 927 | rop->client = idp; |
854 | GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head, idp->revoke_op_tail, rop); | 928 | GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head, idp->revoke_op_tail, rop); |
855 | rop->rh | 929 | rop->rh |
856 | = RECLAIM_TICKETS_revoke (&rm->ticket, &rm->identity, &revoke_result_cb, | 930 | = RECLAIM_TICKETS_revoke (&ticket, &identity, &revoke_result_cb, rop); |
857 | rop); | ||
858 | GNUNET_SERVICE_client_continue (idp->client); | 931 | GNUNET_SERVICE_client_continue (idp->client); |
859 | } | 932 | } |
860 | 933 | ||
@@ -882,6 +955,8 @@ consume_result_cb (void *cls, | |||
882 | char *data_tmp; | 955 | char *data_tmp; |
883 | size_t attrs_len = 0; | 956 | size_t attrs_len = 0; |
884 | size_t pres_len = 0; | 957 | size_t pres_len = 0; |
958 | size_t key_len; | ||
959 | ssize_t written; | ||
885 | 960 | ||
886 | if (GNUNET_OK != success) | 961 | if (GNUNET_OK != success) |
887 | { | 962 | { |
@@ -890,17 +965,23 @@ consume_result_cb (void *cls, | |||
890 | attrs_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs); | 965 | attrs_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs); |
891 | pres_len = GNUNET_RECLAIM_presentation_list_serialize_get_size ( | 966 | pres_len = GNUNET_RECLAIM_presentation_list_serialize_get_size ( |
892 | presentations); | 967 | presentations); |
968 | key_len = GNUNET_IDENTITY_public_key_get_length (identity); | ||
893 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 969 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
894 | "Sending CONSUME_TICKET_RESULT message\n"); | 970 | "Sending CONSUME_TICKET_RESULT message\n"); |
895 | env = GNUNET_MQ_msg_extra (crm, | 971 | env = GNUNET_MQ_msg_extra (crm, |
896 | attrs_len + pres_len, | 972 | attrs_len + pres_len + key_len, |
897 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT); | 973 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET_RESULT); |
898 | crm->id = htonl (cop->r_id); | 974 | crm->id = htonl (cop->r_id); |
899 | crm->attrs_len = htons (attrs_len); | 975 | crm->attrs_len = htons (attrs_len); |
900 | crm->presentations_len = htons (pres_len); | 976 | crm->presentations_len = htons (pres_len); |
901 | crm->identity = *identity; | 977 | crm->key_len = htonl (key_len); |
902 | crm->result = htonl (success); | 978 | crm->result = htonl (success); |
903 | data_tmp = (char *) &crm[1]; | 979 | data_tmp = (char *) &crm[1]; |
980 | written = GNUNET_IDENTITY_write_public_key_to_buffer (identity, | ||
981 | data_tmp, | ||
982 | key_len); | ||
983 | GNUNET_assert (0 <= written); | ||
984 | data_tmp += written; | ||
904 | GNUNET_RECLAIM_attribute_list_serialize (attrs, data_tmp); | 985 | GNUNET_RECLAIM_attribute_list_serialize (attrs, data_tmp); |
905 | data_tmp += attrs_len; | 986 | data_tmp += attrs_len; |
906 | GNUNET_RECLAIM_presentation_list_serialize (presentations, data_tmp); | 987 | GNUNET_RECLAIM_presentation_list_serialize (presentations, data_tmp); |
@@ -924,7 +1005,7 @@ check_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm) | |||
924 | uint16_t size; | 1005 | uint16_t size; |
925 | 1006 | ||
926 | size = ntohs (cm->header.size); | 1007 | size = ntohs (cm->header.size); |
927 | if (size != sizeof(struct ConsumeTicketMessage)) | 1008 | if (size <= sizeof(struct ConsumeTicketMessage)) |
928 | { | 1009 | { |
929 | GNUNET_break (0); | 1010 | GNUNET_break (0); |
930 | return GNUNET_SYSERR; | 1011 | return GNUNET_SYSERR; |
@@ -944,13 +1025,43 @@ handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm) | |||
944 | { | 1025 | { |
945 | struct ConsumeTicketOperation *cop; | 1026 | struct ConsumeTicketOperation *cop; |
946 | struct IdpClient *idp = cls; | 1027 | struct IdpClient *idp = cls; |
1028 | struct GNUNET_IDENTITY_PrivateKey identity; | ||
1029 | struct GNUNET_RECLAIM_Ticket ticket; | ||
1030 | size_t key_len; | ||
1031 | size_t tkt_len; | ||
1032 | size_t read; | ||
1033 | char *buf; | ||
947 | 1034 | ||
948 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n"); | 1035 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n"); |
1036 | key_len = ntohl (cm->key_len); | ||
1037 | buf = (char *) &cm[1]; | ||
1038 | if ((GNUNET_SYSERR == | ||
1039 | GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, | ||
1040 | &identity, &read)) || | ||
1041 | (read != key_len)) | ||
1042 | { | ||
1043 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1044 | "Failed to read private key\n"); | ||
1045 | GNUNET_SERVICE_client_drop (idp->client); | ||
1046 | return; | ||
1047 | } | ||
1048 | buf += read; | ||
1049 | tkt_len = ntohl (cm->tkt_len); | ||
1050 | if ((GNUNET_SYSERR == | ||
1051 | GNUNET_RECLAIM_read_ticket_from_buffer (buf, tkt_len, | ||
1052 | &ticket, &read)) || | ||
1053 | (read != tkt_len)) | ||
1054 | { | ||
1055 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1056 | "Failed to read ticket\n"); | ||
1057 | GNUNET_SERVICE_client_drop (idp->client); | ||
1058 | return; | ||
1059 | } | ||
949 | cop = GNUNET_new (struct ConsumeTicketOperation); | 1060 | cop = GNUNET_new (struct ConsumeTicketOperation); |
950 | cop->r_id = ntohl (cm->id); | 1061 | cop->r_id = ntohl (cm->id); |
951 | cop->client = idp; | 1062 | cop->client = idp; |
952 | cop->ch | 1063 | cop->ch |
953 | = RECLAIM_TICKETS_consume (&cm->identity, &cm->ticket, &consume_result_cb, | 1064 | = RECLAIM_TICKETS_consume (&identity, &ticket, &consume_result_cb, |
954 | cop); | 1065 | cop); |
955 | GNUNET_CONTAINER_DLL_insert (idp->consume_op_head, idp->consume_op_tail, cop); | 1066 | GNUNET_CONTAINER_DLL_insert (idp->consume_op_head, idp->consume_op_tail, cop); |
956 | GNUNET_SERVICE_client_continue (idp->client); | 1067 | GNUNET_SERVICE_client_continue (idp->client); |
@@ -1077,21 +1188,37 @@ handle_attribute_store_message (void *cls, | |||
1077 | { | 1188 | { |
1078 | struct AttributeStoreHandle *ash; | 1189 | struct AttributeStoreHandle *ash; |
1079 | struct IdpClient *idp = cls; | 1190 | struct IdpClient *idp = cls; |
1191 | struct GNUNET_IDENTITY_PrivateKey identity; | ||
1080 | size_t data_len; | 1192 | size_t data_len; |
1193 | size_t key_len; | ||
1194 | size_t read; | ||
1195 | char *buf; | ||
1081 | 1196 | ||
1082 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_STORE message\n"); | 1197 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_STORE message\n"); |
1083 | 1198 | ||
1084 | data_len = ntohs (sam->attr_len); | 1199 | data_len = ntohs (sam->attr_len); |
1085 | 1200 | key_len = ntohl (sam->key_len); | |
1201 | buf = (char *) &sam[1]; | ||
1202 | if ((GNUNET_SYSERR == | ||
1203 | GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, | ||
1204 | &identity, &read)) || | ||
1205 | (read != key_len)) | ||
1206 | { | ||
1207 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1208 | "Failed to read private key\n"); | ||
1209 | GNUNET_SERVICE_client_drop (idp->client); | ||
1210 | return; | ||
1211 | } | ||
1212 | buf += read; | ||
1086 | ash = GNUNET_new (struct AttributeStoreHandle); | 1213 | ash = GNUNET_new (struct AttributeStoreHandle); |
1087 | GNUNET_RECLAIM_attribute_deserialize ((char *) &sam[1], | 1214 | GNUNET_RECLAIM_attribute_deserialize (buf, |
1088 | data_len, | 1215 | data_len, |
1089 | &ash->claim); | 1216 | &ash->claim); |
1090 | 1217 | ||
1091 | ash->r_id = ntohl (sam->id); | 1218 | ash->r_id = ntohl (sam->id); |
1092 | ash->identity = sam->identity; | 1219 | ash->identity = identity; |
1093 | ash->exp.rel_value_us = GNUNET_ntohll (sam->exp); | 1220 | ash->exp.rel_value_us = GNUNET_ntohll (sam->exp); |
1094 | GNUNET_IDENTITY_key_get_public (&sam->identity, &ash->identity_pkey); | 1221 | GNUNET_IDENTITY_key_get_public (&identity, &ash->identity_pkey); |
1095 | 1222 | ||
1096 | GNUNET_SERVICE_client_continue (idp->client); | 1223 | GNUNET_SERVICE_client_continue (idp->client); |
1097 | ash->client = idp; | 1224 | ash->client = idp; |
@@ -1262,20 +1389,36 @@ handle_credential_store_message (void *cls, | |||
1262 | { | 1389 | { |
1263 | struct AttributeStoreHandle *ash; | 1390 | struct AttributeStoreHandle *ash; |
1264 | struct IdpClient *idp = cls; | 1391 | struct IdpClient *idp = cls; |
1392 | struct GNUNET_IDENTITY_PrivateKey identity; | ||
1265 | size_t data_len; | 1393 | size_t data_len; |
1394 | size_t key_len; | ||
1395 | size_t read; | ||
1396 | char *buf; | ||
1266 | 1397 | ||
1267 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_STORE message\n"); | 1398 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_STORE message\n"); |
1268 | 1399 | ||
1269 | data_len = ntohs (sam->attr_len); | 1400 | data_len = ntohs (sam->attr_len); |
1270 | 1401 | key_len = ntohl (sam->key_len); | |
1402 | buf = (char *) &sam[1]; | ||
1403 | if ((GNUNET_SYSERR == | ||
1404 | GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, | ||
1405 | &identity, &read)) || | ||
1406 | (read != key_len)) | ||
1407 | { | ||
1408 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1409 | "Failed to read private key\n"); | ||
1410 | GNUNET_SERVICE_client_drop (idp->client); | ||
1411 | return; | ||
1412 | } | ||
1413 | buf += read; | ||
1271 | ash = GNUNET_new (struct AttributeStoreHandle); | 1414 | ash = GNUNET_new (struct AttributeStoreHandle); |
1272 | ash->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &sam[1], | 1415 | ash->credential = GNUNET_RECLAIM_credential_deserialize (buf, |
1273 | data_len); | 1416 | data_len); |
1274 | 1417 | ||
1275 | ash->r_id = ntohl (sam->id); | 1418 | ash->r_id = ntohl (sam->id); |
1276 | ash->identity = sam->identity; | 1419 | ash->identity = identity; |
1277 | ash->exp.rel_value_us = GNUNET_ntohll (sam->exp); | 1420 | ash->exp.rel_value_us = GNUNET_ntohll (sam->exp); |
1278 | GNUNET_IDENTITY_key_get_public (&sam->identity, &ash->identity_pkey); | 1421 | GNUNET_IDENTITY_key_get_public (&identity, &ash->identity_pkey); |
1279 | 1422 | ||
1280 | GNUNET_SERVICE_client_continue (idp->client); | 1423 | GNUNET_SERVICE_client_continue (idp->client); |
1281 | ash->client = idp; | 1424 | ash->client = idp; |
@@ -1717,20 +1860,36 @@ handle_attribute_delete_message (void *cls, | |||
1717 | { | 1860 | { |
1718 | struct AttributeDeleteHandle *adh; | 1861 | struct AttributeDeleteHandle *adh; |
1719 | struct IdpClient *idp = cls; | 1862 | struct IdpClient *idp = cls; |
1863 | struct GNUNET_IDENTITY_PrivateKey identity; | ||
1720 | size_t data_len; | 1864 | size_t data_len; |
1865 | size_t key_len; | ||
1866 | size_t read; | ||
1867 | char *buf; | ||
1721 | 1868 | ||
1722 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_DELETE message\n"); | 1869 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received ATTRIBUTE_DELETE message\n"); |
1723 | 1870 | ||
1724 | data_len = ntohs (dam->attr_len); | 1871 | data_len = ntohs (dam->attr_len); |
1725 | 1872 | key_len = ntohl (dam->key_len); | |
1873 | buf = (char *) &dam[1]; | ||
1874 | if ((GNUNET_SYSERR == | ||
1875 | GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, | ||
1876 | &identity, &read)) || | ||
1877 | (read != key_len)) | ||
1878 | { | ||
1879 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1880 | "Failed to read private key\n"); | ||
1881 | GNUNET_SERVICE_client_drop (idp->client); | ||
1882 | return; | ||
1883 | } | ||
1884 | buf += read; | ||
1726 | adh = GNUNET_new (struct AttributeDeleteHandle); | 1885 | adh = GNUNET_new (struct AttributeDeleteHandle); |
1727 | GNUNET_RECLAIM_attribute_deserialize ((char *) &dam[1], | 1886 | GNUNET_RECLAIM_attribute_deserialize (buf, |
1728 | data_len, | 1887 | data_len, |
1729 | &adh->claim); | 1888 | &adh->claim); |
1730 | adh->credential = NULL; | 1889 | adh->credential = NULL; |
1731 | 1890 | ||
1732 | adh->r_id = ntohl (dam->id); | 1891 | adh->r_id = ntohl (dam->id); |
1733 | adh->identity = dam->identity; | 1892 | adh->identity = identity; |
1734 | adh->label | 1893 | adh->label |
1735 | = GNUNET_STRINGS_data_to_string_alloc (&adh->claim->id, | 1894 | = GNUNET_STRINGS_data_to_string_alloc (&adh->claim->id, |
1736 | sizeof(adh->claim->id)); | 1895 | sizeof(adh->claim->id)); |
@@ -1808,19 +1967,35 @@ handle_credential_delete_message (void *cls, | |||
1808 | { | 1967 | { |
1809 | struct AttributeDeleteHandle *adh; | 1968 | struct AttributeDeleteHandle *adh; |
1810 | struct IdpClient *idp = cls; | 1969 | struct IdpClient *idp = cls; |
1970 | struct GNUNET_IDENTITY_PrivateKey identity; | ||
1811 | size_t data_len; | 1971 | size_t data_len; |
1972 | size_t key_len; | ||
1973 | size_t read; | ||
1974 | char *buf; | ||
1812 | 1975 | ||
1813 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_DELETE message\n"); | 1976 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CREDENTIAL_DELETE message\n"); |
1814 | 1977 | ||
1815 | data_len = ntohs (dam->attr_len); | 1978 | data_len = ntohs (dam->attr_len); |
1816 | 1979 | key_len = ntohl (dam->key_len); | |
1980 | buf = (char *) &dam[1]; | ||
1981 | if ((GNUNET_SYSERR == | ||
1982 | GNUNET_IDENTITY_read_private_key_from_buffer (buf, key_len, | ||
1983 | &identity, &read)) || | ||
1984 | (read != key_len)) | ||
1985 | { | ||
1986 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
1987 | "Failed to read private key\n"); | ||
1988 | GNUNET_SERVICE_client_drop (idp->client); | ||
1989 | return; | ||
1990 | } | ||
1991 | buf += read; | ||
1817 | adh = GNUNET_new (struct AttributeDeleteHandle); | 1992 | adh = GNUNET_new (struct AttributeDeleteHandle); |
1818 | adh->credential = GNUNET_RECLAIM_credential_deserialize ((char *) &dam[1], | 1993 | adh->credential = GNUNET_RECLAIM_credential_deserialize (buf, |
1819 | data_len); | 1994 | data_len); |
1820 | adh->claim = NULL; | 1995 | adh->claim = NULL; |
1821 | 1996 | ||
1822 | adh->r_id = ntohl (dam->id); | 1997 | adh->r_id = ntohl (dam->id); |
1823 | adh->identity = dam->identity; | 1998 | adh->identity = identity; |
1824 | adh->label | 1999 | adh->label |
1825 | = GNUNET_STRINGS_data_to_string_alloc (&adh->credential->id, | 2000 | = GNUNET_STRINGS_data_to_string_alloc (&adh->credential->id, |
1826 | sizeof(adh->credential->id)); | 2001 | sizeof(adh->credential->id)); |
@@ -1858,6 +2033,7 @@ attr_iter_finished (void *cls) | |||
1858 | env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); | 2033 | env = GNUNET_MQ_msg (arm, GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); |
1859 | arm->id = htonl (ai->request_id); | 2034 | arm->id = htonl (ai->request_id); |
1860 | arm->attr_len = htons (0); | 2035 | arm->attr_len = htons (0); |
2036 | arm->pkey_len = htonl (0); | ||
1861 | GNUNET_MQ_send (ai->client->mq, env); | 2037 | GNUNET_MQ_send (ai->client->mq, env); |
1862 | GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head, | 2038 | GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head, |
1863 | ai->client->attr_iter_tail, | 2039 | ai->client->attr_iter_tail, |
@@ -1899,7 +2075,10 @@ attr_iter_cb (void *cls, | |||
1899 | { | 2075 | { |
1900 | struct Iterator *ai = cls; | 2076 | struct Iterator *ai = cls; |
1901 | struct GNUNET_MQ_Envelope *env; | 2077 | struct GNUNET_MQ_Envelope *env; |
2078 | struct GNUNET_IDENTITY_PublicKey identity; | ||
1902 | char *data_tmp; | 2079 | char *data_tmp; |
2080 | size_t key_len; | ||
2081 | ssize_t written; | ||
1903 | 2082 | ||
1904 | if ((rd_count != 1) || | 2083 | if ((rd_count != 1) || |
1905 | (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE != rd->record_type)) | 2084 | (GNUNET_GNSRECORD_TYPE_RECLAIM_ATTRIBUTE != rd->record_type)) |
@@ -1912,18 +2091,44 @@ attr_iter_cb (void *cls, | |||
1912 | label); | 2091 | label); |
1913 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2092 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1914 | "Sending ATTRIBUTE_RESULT message\n"); | 2093 | "Sending ATTRIBUTE_RESULT message\n"); |
2094 | GNUNET_IDENTITY_key_get_public (zone, &identity); | ||
2095 | key_len = GNUNET_IDENTITY_public_key_get_length (&identity); | ||
1915 | env = GNUNET_MQ_msg_extra (arm, | 2096 | env = GNUNET_MQ_msg_extra (arm, |
1916 | rd->data_size, | 2097 | rd->data_size + key_len, |
1917 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); | 2098 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_RESULT); |
1918 | arm->id = htonl (ai->request_id); | 2099 | arm->id = htonl (ai->request_id); |
1919 | arm->attr_len = htons (rd->data_size); | 2100 | arm->attr_len = htons (rd->data_size); |
1920 | GNUNET_IDENTITY_key_get_public (zone, &arm->identity); | ||
1921 | data_tmp = (char *) &arm[1]; | 2101 | data_tmp = (char *) &arm[1]; |
2102 | arm->pkey_len = htonl (key_len); | ||
2103 | written = GNUNET_IDENTITY_write_public_key_to_buffer (&identity, | ||
2104 | data_tmp, | ||
2105 | key_len); | ||
2106 | GNUNET_assert (0 <= written); | ||
2107 | data_tmp += written; | ||
1922 | GNUNET_memcpy (data_tmp, rd->data, rd->data_size); | 2108 | GNUNET_memcpy (data_tmp, rd->data, rd->data_size); |
1923 | GNUNET_MQ_send (ai->client->mq, env); | 2109 | GNUNET_MQ_send (ai->client->mq, env); |
1924 | } | 2110 | } |
1925 | 2111 | ||
1926 | 2112 | ||
2113 | static enum GNUNET_GenericReturnValue | ||
2114 | check_iteration_start ( | ||
2115 | void *cls, | ||
2116 | const struct AttributeIterationStartMessage *ais_msg) | ||
2117 | { | ||
2118 | uint16_t size; | ||
2119 | size_t key_len; | ||
2120 | |||
2121 | size = ntohs (ais_msg->header.size); | ||
2122 | key_len = ntohs (ais_msg->key_len); | ||
2123 | |||
2124 | if (size < key_len + sizeof(*ais_msg)) | ||
2125 | { | ||
2126 | GNUNET_break (0); | ||
2127 | return GNUNET_SYSERR; | ||
2128 | } | ||
2129 | return GNUNET_OK; | ||
2130 | } | ||
2131 | |||
1927 | /** | 2132 | /** |
1928 | * Iterate over zone to get attributes | 2133 | * Iterate over zone to get attributes |
1929 | * | 2134 | * |
@@ -1936,13 +2141,29 @@ handle_iteration_start (void *cls, | |||
1936 | { | 2141 | { |
1937 | struct IdpClient *idp = cls; | 2142 | struct IdpClient *idp = cls; |
1938 | struct Iterator *ai; | 2143 | struct Iterator *ai; |
2144 | struct GNUNET_IDENTITY_PrivateKey identity; | ||
2145 | size_t key_len; | ||
2146 | size_t read; | ||
1939 | 2147 | ||
1940 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2148 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1941 | "Received ATTRIBUTE_ITERATION_START message\n"); | 2149 | "Received ATTRIBUTE_ITERATION_START message\n"); |
2150 | key_len = ntohl (ais_msg->key_len); | ||
2151 | if ((GNUNET_SYSERR == | ||
2152 | GNUNET_IDENTITY_read_private_key_from_buffer (&ais_msg[1], | ||
2153 | key_len, | ||
2154 | &identity, | ||
2155 | &read)) || | ||
2156 | (read != key_len)) | ||
2157 | { | ||
2158 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
2159 | "Failed to read private key.\n"); | ||
2160 | GNUNET_SERVICE_client_drop (idp->client); | ||
2161 | return; | ||
2162 | } | ||
1942 | ai = GNUNET_new (struct Iterator); | 2163 | ai = GNUNET_new (struct Iterator); |
1943 | ai->request_id = ntohl (ais_msg->id); | 2164 | ai->request_id = ntohl (ais_msg->id); |
1944 | ai->client = idp; | 2165 | ai->client = idp; |
1945 | ai->identity = ais_msg->identity; | 2166 | ai->identity = identity; |
1946 | 2167 | ||
1947 | GNUNET_CONTAINER_DLL_insert (idp->attr_iter_head, idp->attr_iter_tail, ai); | 2168 | GNUNET_CONTAINER_DLL_insert (idp->attr_iter_head, idp->attr_iter_tail, ai); |
1948 | ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (nsh, | 2169 | ai->ns_it = GNUNET_NAMESTORE_zone_iteration_start (nsh, |
@@ -2084,7 +2305,10 @@ cred_iter_cb (void *cls, | |||
2084 | struct Iterator *ai = cls; | 2305 | struct Iterator *ai = cls; |
2085 | struct GNUNET_MQ_Envelope *env; | 2306 | struct GNUNET_MQ_Envelope *env; |
2086 | struct CredentialResultMessage *arm; | 2307 | struct CredentialResultMessage *arm; |
2308 | struct GNUNET_IDENTITY_PublicKey identity; | ||
2087 | char *data_tmp; | 2309 | char *data_tmp; |
2310 | size_t key_len; | ||
2311 | ssize_t written; | ||
2088 | 2312 | ||
2089 | if ((rd_count != 1) || | 2313 | if ((rd_count != 1) || |
2090 | (GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL != rd->record_type)) | 2314 | (GNUNET_GNSRECORD_TYPE_RECLAIM_CREDENTIAL != rd->record_type)) |
@@ -2096,18 +2320,42 @@ cred_iter_cb (void *cls, | |||
2096 | label); | 2320 | label); |
2097 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2321 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2098 | "Sending CREDENTIAL_RESULT message\n"); | 2322 | "Sending CREDENTIAL_RESULT message\n"); |
2323 | GNUNET_IDENTITY_key_get_public (zone, &identity); | ||
2324 | key_len = GNUNET_IDENTITY_public_key_get_length (&identity); | ||
2099 | env = GNUNET_MQ_msg_extra (arm, | 2325 | env = GNUNET_MQ_msg_extra (arm, |
2100 | rd->data_size, | 2326 | rd->data_size + key_len, |
2101 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT); | 2327 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_RESULT); |
2102 | arm->id = htonl (ai->request_id); | 2328 | arm->id = htonl (ai->request_id); |
2103 | arm->credential_len = htons (rd->data_size); | 2329 | arm->credential_len = htons (rd->data_size); |
2104 | GNUNET_IDENTITY_key_get_public (zone, &arm->identity); | ||
2105 | data_tmp = (char *) &arm[1]; | 2330 | data_tmp = (char *) &arm[1]; |
2331 | written = GNUNET_IDENTITY_write_public_key_to_buffer (&identity, | ||
2332 | data_tmp, | ||
2333 | key_len); | ||
2334 | GNUNET_assert (written >= 0); | ||
2335 | data_tmp += written; | ||
2106 | GNUNET_memcpy (data_tmp, rd->data, rd->data_size); | 2336 | GNUNET_memcpy (data_tmp, rd->data, rd->data_size); |
2107 | |||
2108 | GNUNET_MQ_send (ai->client->mq, env); | 2337 | GNUNET_MQ_send (ai->client->mq, env); |
2109 | } | 2338 | } |
2110 | 2339 | ||
2340 | static enum GNUNET_GenericReturnValue | ||
2341 | check_credential_iteration_start ( | ||
2342 | void *cls, | ||
2343 | const struct CredentialIterationStartMessage *cis_msg) | ||
2344 | { | ||
2345 | uint16_t size; | ||
2346 | size_t key_len; | ||
2347 | |||
2348 | size = ntohs (cis_msg->header.size); | ||
2349 | key_len = ntohs (cis_msg->key_len); | ||
2350 | |||
2351 | if (size < key_len + sizeof(*cis_msg)) | ||
2352 | { | ||
2353 | GNUNET_break (0); | ||
2354 | return GNUNET_SYSERR; | ||
2355 | } | ||
2356 | return GNUNET_OK; | ||
2357 | } | ||
2358 | |||
2111 | 2359 | ||
2112 | /** | 2360 | /** |
2113 | * Iterate over zone to get attributes | 2361 | * Iterate over zone to get attributes |
@@ -2122,13 +2370,29 @@ handle_credential_iteration_start (void *cls, | |||
2122 | { | 2370 | { |
2123 | struct IdpClient *idp = cls; | 2371 | struct IdpClient *idp = cls; |
2124 | struct Iterator *ai; | 2372 | struct Iterator *ai; |
2373 | struct GNUNET_IDENTITY_PrivateKey identity; | ||
2374 | size_t key_len; | ||
2375 | size_t read; | ||
2125 | 2376 | ||
2126 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2377 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2127 | "Received CREDENTIAL_ITERATION_START message\n"); | 2378 | "Received CREDENTIAL_ITERATION_START message\n"); |
2379 | key_len = ntohl (ais_msg->key_len); | ||
2380 | if ((GNUNET_SYSERR == | ||
2381 | GNUNET_IDENTITY_read_private_key_from_buffer (&ais_msg[1], | ||
2382 | key_len, | ||
2383 | &identity, | ||
2384 | &read)) || | ||
2385 | (read != key_len)) | ||
2386 | { | ||
2387 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
2388 | "Failed to read private key.\n"); | ||
2389 | GNUNET_SERVICE_client_drop (idp->client); | ||
2390 | return; | ||
2391 | } | ||
2128 | ai = GNUNET_new (struct Iterator); | 2392 | ai = GNUNET_new (struct Iterator); |
2129 | ai->request_id = ntohl (ais_msg->id); | 2393 | ai->request_id = ntohl (ais_msg->id); |
2130 | ai->client = idp; | 2394 | ai->client = idp; |
2131 | ai->identity = ais_msg->identity; | 2395 | ai->identity = identity; |
2132 | 2396 | ||
2133 | GNUNET_CONTAINER_DLL_insert (idp->cred_iter_head, idp->cred_iter_tail, | 2397 | GNUNET_CONTAINER_DLL_insert (idp->cred_iter_head, idp->cred_iter_tail, |
2134 | ai); | 2398 | ai); |
@@ -2227,8 +2491,16 @@ ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket) | |||
2227 | struct TicketIteration *ti = cls; | 2491 | struct TicketIteration *ti = cls; |
2228 | struct GNUNET_MQ_Envelope *env; | 2492 | struct GNUNET_MQ_Envelope *env; |
2229 | struct TicketResultMessage *trm; | 2493 | struct TicketResultMessage *trm; |
2494 | size_t tkt_len; | ||
2230 | 2495 | ||
2231 | env = GNUNET_MQ_msg (trm, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); | 2496 | if (NULL == ticket) |
2497 | tkt_len = 0; | ||
2498 | else | ||
2499 | tkt_len = GNUNET_RECLAIM_ticket_serialize_get_size (ticket); | ||
2500 | |||
2501 | env = GNUNET_MQ_msg_extra (trm, | ||
2502 | tkt_len, | ||
2503 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT); | ||
2232 | if (NULL == ticket) | 2504 | if (NULL == ticket) |
2233 | { | 2505 | { |
2234 | /* send empty response to indicate end of list */ | 2506 | /* send empty response to indicate end of list */ |
@@ -2238,8 +2510,11 @@ ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket) | |||
2238 | } | 2510 | } |
2239 | else | 2511 | else |
2240 | { | 2512 | { |
2241 | trm->ticket = *ticket; | 2513 | GNUNET_RECLAIM_write_ticket_to_buffer (ticket, |
2514 | &trm[1], | ||
2515 | tkt_len); | ||
2242 | } | 2516 | } |
2517 | trm->tkt_len = htonl (tkt_len); | ||
2243 | trm->id = htonl (ti->r_id); | 2518 | trm->id = htonl (ti->r_id); |
2244 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n"); | 2519 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n"); |
2245 | GNUNET_MQ_send (ti->client->mq, env); | 2520 | GNUNET_MQ_send (ti->client->mq, env); |
@@ -2247,6 +2522,24 @@ ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket) | |||
2247 | GNUNET_free (ti); | 2522 | GNUNET_free (ti); |
2248 | } | 2523 | } |
2249 | 2524 | ||
2525 | static enum GNUNET_GenericReturnValue | ||
2526 | check_ticket_iteration_start ( | ||
2527 | void *cls, | ||
2528 | const struct TicketIterationStartMessage *tis_msg) | ||
2529 | { | ||
2530 | uint16_t size; | ||
2531 | size_t key_len; | ||
2532 | |||
2533 | size = ntohs (tis_msg->header.size); | ||
2534 | key_len = ntohs (tis_msg->key_len); | ||
2535 | |||
2536 | if (size < key_len + sizeof(*tis_msg)) | ||
2537 | { | ||
2538 | GNUNET_break (0); | ||
2539 | return GNUNET_SYSERR; | ||
2540 | } | ||
2541 | return GNUNET_OK; | ||
2542 | } | ||
2250 | 2543 | ||
2251 | /** | 2544 | /** |
2252 | * Client requests a ticket iteration | 2545 | * Client requests a ticket iteration |
@@ -2259,20 +2552,35 @@ handle_ticket_iteration_start ( | |||
2259 | void *cls, | 2552 | void *cls, |
2260 | const struct TicketIterationStartMessage *tis_msg) | 2553 | const struct TicketIterationStartMessage *tis_msg) |
2261 | { | 2554 | { |
2555 | struct GNUNET_IDENTITY_PrivateKey identity; | ||
2262 | struct IdpClient *client = cls; | 2556 | struct IdpClient *client = cls; |
2263 | struct TicketIteration *ti; | 2557 | struct TicketIteration *ti; |
2558 | size_t key_len; | ||
2559 | size_t read; | ||
2264 | 2560 | ||
2265 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2561 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2266 | "Received TICKET_ITERATION_START message\n"); | 2562 | "Received TICKET_ITERATION_START message\n"); |
2563 | key_len = ntohl (tis_msg->key_len); | ||
2564 | if ((GNUNET_SYSERR == | ||
2565 | GNUNET_IDENTITY_read_private_key_from_buffer (&tis_msg[1], | ||
2566 | key_len, | ||
2567 | &identity, | ||
2568 | &read)) || | ||
2569 | (read != key_len)) | ||
2570 | { | ||
2571 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
2572 | "Failed to read private key\n"); | ||
2573 | GNUNET_SERVICE_client_drop (client->client); | ||
2574 | return; | ||
2575 | } | ||
2267 | ti = GNUNET_new (struct TicketIteration); | 2576 | ti = GNUNET_new (struct TicketIteration); |
2268 | ti->r_id = ntohl (tis_msg->id); | 2577 | ti->r_id = ntohl (tis_msg->id); |
2269 | ti->client = client; | 2578 | ti->client = client; |
2270 | |||
2271 | GNUNET_CONTAINER_DLL_insert (client->ticket_iter_head, | 2579 | GNUNET_CONTAINER_DLL_insert (client->ticket_iter_head, |
2272 | client->ticket_iter_tail, | 2580 | client->ticket_iter_tail, |
2273 | ti); | 2581 | ti); |
2274 | ti->iter | 2582 | ti->iter |
2275 | = RECLAIM_TICKETS_iteration_start (&tis_msg->identity, &ticket_iter_cb, ti); | 2583 | = RECLAIM_TICKETS_iteration_start (&identity, &ticket_iter_cb, ti); |
2276 | GNUNET_SERVICE_client_continue (client->client); | 2584 | GNUNET_SERVICE_client_continue (client->client); |
2277 | } | 2585 | } |
2278 | 2586 | ||
@@ -2451,10 +2759,10 @@ GNUNET_SERVICE_MAIN ( | |||
2451 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE, | 2759 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_DELETE, |
2452 | struct AttributeDeleteMessage, | 2760 | struct AttributeDeleteMessage, |
2453 | NULL), | 2761 | NULL), |
2454 | GNUNET_MQ_hd_fixed_size (iteration_start, | 2762 | GNUNET_MQ_hd_var_size (iteration_start, |
2455 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, | 2763 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_START, |
2456 | struct AttributeIterationStartMessage, | 2764 | struct AttributeIterationStartMessage, |
2457 | NULL), | 2765 | NULL), |
2458 | GNUNET_MQ_hd_fixed_size (iteration_next, | 2766 | GNUNET_MQ_hd_fixed_size (iteration_next, |
2459 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, | 2767 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_NEXT, |
2460 | struct AttributeIterationNextMessage, | 2768 | struct AttributeIterationNextMessage, |
@@ -2463,10 +2771,10 @@ GNUNET_SERVICE_MAIN ( | |||
2463 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, | 2771 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTRIBUTE_ITERATION_STOP, |
2464 | struct AttributeIterationStopMessage, | 2772 | struct AttributeIterationStopMessage, |
2465 | NULL), | 2773 | NULL), |
2466 | GNUNET_MQ_hd_fixed_size (credential_iteration_start, | 2774 | GNUNET_MQ_hd_var_size (credential_iteration_start, |
2467 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START, | 2775 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START, |
2468 | struct CredentialIterationStartMessage, | 2776 | struct CredentialIterationStartMessage, |
2469 | NULL), | 2777 | NULL), |
2470 | GNUNET_MQ_hd_fixed_size (credential_iteration_next, | 2778 | GNUNET_MQ_hd_fixed_size (credential_iteration_next, |
2471 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT, | 2779 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_NEXT, |
2472 | struct CredentialIterationNextMessage, | 2780 | struct CredentialIterationNextMessage, |
@@ -2484,10 +2792,10 @@ GNUNET_SERVICE_MAIN ( | |||
2484 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, | 2792 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET, |
2485 | struct ConsumeTicketMessage, | 2793 | struct ConsumeTicketMessage, |
2486 | NULL), | 2794 | NULL), |
2487 | GNUNET_MQ_hd_fixed_size (ticket_iteration_start, | 2795 | GNUNET_MQ_hd_var_size (ticket_iteration_start, |
2488 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, | 2796 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START, |
2489 | struct TicketIterationStartMessage, | 2797 | struct TicketIterationStartMessage, |
2490 | NULL), | 2798 | NULL), |
2491 | GNUNET_MQ_hd_fixed_size (ticket_iteration_next, | 2799 | GNUNET_MQ_hd_fixed_size (ticket_iteration_next, |
2492 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT, | 2800 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_NEXT, |
2493 | struct TicketIterationNextMessage, | 2801 | struct TicketIterationNextMessage, |