diff options
Diffstat (limited to 'src/reclaim/reclaim_api.c')
-rw-r--r-- | src/reclaim/reclaim_api.c | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c index ede2daf28..1d2b9d8b4 100644 --- a/src/reclaim/reclaim_api.c +++ b/src/reclaim/reclaim_api.c | |||
@@ -731,14 +731,16 @@ handle_attestation_result (void *cls, const struct AttributeResultMessage *msg) | |||
731 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error | 731 | * @return #GNUNET_OK on success, #GNUNET_SYSERR on error |
732 | */ | 732 | */ |
733 | static int | 733 | static int |
734 | check_reference_result (void *cls, const struct AttributeResultMessage *msg) | 734 | check_reference_result (void *cls, const struct ReferenceResultMessage *msg) |
735 | { | 735 | { |
736 | size_t msg_len; | 736 | size_t msg_len; |
737 | size_t attr_len; | 737 | size_t attr_len; |
738 | size_t ref_len; | ||
738 | 739 | ||
739 | msg_len = ntohs (msg->header.size); | 740 | msg_len = ntohs (msg->header.size); |
740 | attr_len = ntohs (msg->attr_len); | 741 | attr_len = ntohs (msg->attest_len); |
741 | if (msg_len != sizeof(struct AttributeResultMessage) + attr_len) | 742 | ref_len = ntohs (msg->ref_len); |
743 | if (msg_len != sizeof(struct ReferenceResultMessage) + attr_len + ref_len) | ||
742 | { | 744 | { |
743 | GNUNET_break (0); | 745 | GNUNET_break (0); |
744 | return GNUNET_SYSERR; | 746 | return GNUNET_SYSERR; |
@@ -754,19 +756,18 @@ check_reference_result (void *cls, const struct AttributeResultMessage *msg) | |||
754 | * @param msg the message we received | 756 | * @param msg the message we received |
755 | */ | 757 | */ |
756 | static void | 758 | static void |
757 | handle_reference_result (void *cls, const struct AttributeResultMessage *msg) | 759 | handle_reference_result (void *cls, const struct ReferenceResultMessage *msg) |
758 | { | 760 | { |
759 | static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy; | 761 | static struct GNUNET_CRYPTO_EcdsaPrivateKey identity_dummy; |
760 | struct GNUNET_RECLAIM_Handle *h = cls; | 762 | struct GNUNET_RECLAIM_Handle *h = cls; |
761 | struct GNUNET_RECLAIM_AttributeIterator *it; | 763 | struct GNUNET_RECLAIM_AttributeIterator *it; |
762 | struct GNUNET_RECLAIM_Operation *op; | 764 | struct GNUNET_RECLAIM_Operation *op; |
763 | size_t attr_len; | 765 | size_t attest_len; |
766 | size_t ref_len; | ||
764 | uint32_t r_id = ntohl (msg->id); | 767 | uint32_t r_id = ntohl (msg->id); |
765 | 768 | attest_len = ntohs (msg->attest_len); | |
766 | attr_len = ntohs (msg->attr_len); | 769 | ref_len = ntohs (msg->ref_len); |
767 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing reference result.\n"); | 770 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Processing reference result.\n"); |
768 | |||
769 | |||
770 | for (it = h->it_head; NULL != it; it = it->next) | 771 | for (it = h->it_head; NULL != it; it = it->next) |
771 | if (it->r_id == r_id) | 772 | if (it->r_id == r_id) |
772 | break; | 773 | break; |
@@ -802,20 +803,24 @@ handle_reference_result (void *cls, const struct AttributeResultMessage *msg) | |||
802 | } | 803 | } |
803 | 804 | ||
804 | { | 805 | { |
805 | struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *attr; | 806 | struct GNUNET_RECLAIM_ATTESTATION_REFERENCE *ref; |
806 | attr = GNUNET_RECLAIM_ATTESTATION_REF_deserialize ((char *) &msg[1], | 807 | struct GNUNET_RECLAIM_ATTESTATION_Claim *attest; |
807 | attr_len); | 808 | attest = GNUNET_RECLAIM_ATTESTATION_deserialize ((char *) &msg[1], |
809 | attest_len); | ||
810 | ref = GNUNET_RECLAIM_ATTESTATION_REF_deserialize ((char *) &msg[2], | ||
811 | ref_len); | ||
808 | if (NULL != it) | 812 | if (NULL != it) |
809 | { | 813 | { |
810 | if (NULL != it->proc) | 814 | if (NULL != it->proc) |
811 | it->proc (it->proc_cls, &msg->identity, NULL, NULL, attr); | 815 | it->proc (it->proc_cls, &msg->identity, NULL, attest, ref); |
812 | } | 816 | } |
813 | else if (NULL != op) | 817 | else if (NULL != op) |
814 | { | 818 | { |
815 | if (NULL != op->ar_cb) | 819 | if (NULL != op->ar_cb) |
816 | op->ar_cb (op->cls, &msg->identity, NULL, NULL, attr); | 820 | op->ar_cb (op->cls, &msg->identity, NULL, attest, ref); |
817 | } | 821 | } |
818 | GNUNET_free (attr); | 822 | GNUNET_free (ref); |
823 | GNUNET_free (attest); | ||
819 | return; | 824 | return; |
820 | } | 825 | } |
821 | GNUNET_assert (0); | 826 | GNUNET_assert (0); |
@@ -945,7 +950,7 @@ reconnect (struct GNUNET_RECLAIM_Handle *h) | |||
945 | h), | 950 | h), |
946 | GNUNET_MQ_hd_var_size (reference_result, | 951 | GNUNET_MQ_hd_var_size (reference_result, |
947 | GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT, | 952 | GNUNET_MESSAGE_TYPE_RECLAIM_REFERENCE_RESULT, |
948 | struct AttributeResultMessage, | 953 | struct ReferenceResultMessage, |
949 | h), | 954 | h), |
950 | GNUNET_MQ_hd_fixed_size (ticket_result, | 955 | GNUNET_MQ_hd_fixed_size (ticket_result, |
951 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, | 956 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT, |