aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/gnunet-service-reclaim.c
diff options
context:
space:
mode:
authorSchanzenbach, Martin <mschanzenbach@posteo.de>2019-06-05 00:19:09 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-06-05 00:19:09 +0200
commit2af1b568199c62152fe7892ec33579aed326c136 (patch)
treebbb5b8f17aa875fc3d8862602268295bc6709b7a /src/reclaim/gnunet-service-reclaim.c
parent761cdce49f33607b0e8e1ef0c4275bf8d7e82c02 (diff)
downloadgnunet-2af1b568199c62152fe7892ec33579aed326c136.tar.gz
gnunet-2af1b568199c62152fe7892ec33579aed326c136.zip
fix message sizes; pending test
Diffstat (limited to 'src/reclaim/gnunet-service-reclaim.c')
-rw-r--r--src/reclaim/gnunet-service-reclaim.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c
index 322063fd9..52dc12725 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -746,7 +746,7 @@ check_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *im)
746 uint16_t size; 746 uint16_t size;
747 747
748 size = ntohs (im->header.size); 748 size = ntohs (im->header.size);
749 if (size <= sizeof (struct RevokeTicketMessage)) { 749 if (size != sizeof (struct RevokeTicketMessage)) {
750 GNUNET_break (0); 750 GNUNET_break (0);
751 return GNUNET_SYSERR; 751 return GNUNET_SYSERR;
752 } 752 }
@@ -765,16 +765,14 @@ handle_revoke_ticket_message (void *cls, const struct RevokeTicketMessage *rm)
765{ 765{
766 struct TicketRevocationOperation *rop; 766 struct TicketRevocationOperation *rop;
767 struct IdpClient *idp = cls; 767 struct IdpClient *idp = cls;
768 struct GNUNET_RECLAIM_Ticket *ticket;
769 768
770 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n"); 769 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received REVOKE_TICKET message\n");
771 rop = GNUNET_new (struct TicketRevocationOperation); 770 rop = GNUNET_new (struct TicketRevocationOperation);
772 ticket = (struct GNUNET_RECLAIM_Ticket *)&rm[1];
773 rop->r_id = ntohl (rm->id); 771 rop->r_id = ntohl (rm->id);
774 rop->client = idp; 772 rop->client = idp;
775 GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head, idp->revoke_op_tail, rop); 773 GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head, idp->revoke_op_tail, rop);
776 rop->rh 774 rop->rh
777 = RECLAIM_TICKETS_revoke (ticket, &rm->identity, &revoke_result_cb, rop); 775 = RECLAIM_TICKETS_revoke (&rm->ticket, &rm->identity, &revoke_result_cb, rop);
778 GNUNET_SERVICE_client_continue (idp->client); 776 GNUNET_SERVICE_client_continue (idp->client);
779} 777}
780 778
@@ -834,7 +832,7 @@ check_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
834 uint16_t size; 832 uint16_t size;
835 833
836 size = ntohs (cm->header.size); 834 size = ntohs (cm->header.size);
837 if (size <= sizeof (struct ConsumeTicketMessage)) { 835 if (size != sizeof (struct ConsumeTicketMessage)) {
838 GNUNET_break (0); 836 GNUNET_break (0);
839 return GNUNET_SYSERR; 837 return GNUNET_SYSERR;
840 } 838 }
@@ -852,16 +850,14 @@ static void
852handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm) 850handle_consume_ticket_message (void *cls, const struct ConsumeTicketMessage *cm)
853{ 851{
854 struct ConsumeTicketOperation *cop; 852 struct ConsumeTicketOperation *cop;
855 struct GNUNET_RECLAIM_Ticket *ticket;
856 struct IdpClient *idp = cls; 853 struct IdpClient *idp = cls;
857 854
858 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n"); 855 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received CONSUME_TICKET message\n");
859 cop = GNUNET_new (struct ConsumeTicketOperation); 856 cop = GNUNET_new (struct ConsumeTicketOperation);
860 cop->r_id = ntohl (cm->id); 857 cop->r_id = ntohl (cm->id);
861 cop->client = idp; 858 cop->client = idp;
862 ticket = (struct GNUNET_RECLAIM_Ticket *)&cm[1];
863 cop->ch 859 cop->ch
864 = RECLAIM_TICKETS_consume (&cm->identity, ticket, &consume_result_cb, cop); 860 = RECLAIM_TICKETS_consume (&cm->identity, &cm->ticket, &consume_result_cb, cop);
865 GNUNET_CONTAINER_DLL_insert (idp->consume_op_head, idp->consume_op_tail, cop); 861 GNUNET_CONTAINER_DLL_insert (idp->consume_op_head, idp->consume_op_tail, cop);
866 GNUNET_SERVICE_client_continue (idp->client); 862 GNUNET_SERVICE_client_continue (idp->client);
867} 863}
@@ -1493,17 +1489,14 @@ ticket_iter_cb (void *cls, struct GNUNET_RECLAIM_Ticket *ticket)
1493 struct GNUNET_MQ_Envelope *env; 1489 struct GNUNET_MQ_Envelope *env;
1494 struct TicketResultMessage *trm; 1490 struct TicketResultMessage *trm;
1495 1491
1492 env = GNUNET_MQ_msg (trm, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
1496 if (NULL == ticket) { 1493 if (NULL == ticket) {
1497 /* send empty response to indicate end of list */ 1494 /* send empty response to indicate end of list */
1498 env = GNUNET_MQ_msg (trm, GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
1499 GNUNET_CONTAINER_DLL_remove (ti->client->ticket_iter_head, 1495 GNUNET_CONTAINER_DLL_remove (ti->client->ticket_iter_head,
1500 ti->client->ticket_iter_tail, 1496 ti->client->ticket_iter_tail,
1501 ti); 1497 ti);
1502 } else { 1498 } else {
1503 env = GNUNET_MQ_msg_extra (trm, 1499 trm->ticket = *ticket;
1504 sizeof (struct GNUNET_RECLAIM_Ticket),
1505 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
1506 memcpy (&trm[1], ticket, sizeof (struct GNUNET_RECLAIM_Ticket));
1507 } 1500 }
1508 trm->id = htonl (ti->r_id); 1501 trm->id = htonl (ti->r_id);
1509 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n"); 1502 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending TICKET_RESULT message\n");