diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-02-06 18:38:02 +0100 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-02-09 20:38:11 +0100 |
commit | 02daf09b5348ffa894621f59ba0d3497a74ff669 (patch) | |
tree | 1a6bb5d7ae751808c8e93c349ac4ba73d00b9aa7 /src/reclaim/reclaim_api.c | |
parent | 5fb277e8d012d687f4d2d032571cd4b57946bbfb (diff) | |
download | gnunet-02daf09b5348ffa894621f59ba0d3497a74ff669.tar.gz gnunet-02daf09b5348ffa894621f59ba0d3497a74ff669.zip |
bugfixes
Diffstat (limited to 'src/reclaim/reclaim_api.c')
-rw-r--r-- | src/reclaim/reclaim_api.c | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/src/reclaim/reclaim_api.c b/src/reclaim/reclaim_api.c index afab33320..5f52aa57b 100644 --- a/src/reclaim/reclaim_api.c +++ b/src/reclaim/reclaim_api.c | |||
@@ -632,7 +632,7 @@ handle_consume_ticket_result (void *cls, | |||
632 | &ale->attestation->id)) | 632 | &ale->attestation->id)) |
633 | { | 633 | { |
634 | op->atr_cb (op->cls, &msg->identity, | 634 | op->atr_cb (op->cls, &msg->identity, |
635 | le->attribute, ale->attestation); | 635 | le->attribute, ale->attestation); |
636 | break; | 636 | break; |
637 | } | 637 | } |
638 | 638 | ||
@@ -641,11 +641,13 @@ handle_consume_ticket_result (void *cls, | |||
641 | else // No attestations | 641 | else // No attestations |
642 | { | 642 | { |
643 | op->atr_cb (op->cls, &msg->identity, | 643 | op->atr_cb (op->cls, &msg->identity, |
644 | le->attribute, NULL); | 644 | le->attribute, NULL); |
645 | } | 645 | } |
646 | } | 646 | } |
647 | GNUNET_RECLAIM_attribute_list_destroy (attrs); | 647 | if (NULL != attrs) |
648 | GNUNET_RECLAIM_attestation_list_destroy (attests); | 648 | GNUNET_RECLAIM_attribute_list_destroy (attrs); |
649 | if (NULL != attests) | ||
650 | GNUNET_RECLAIM_attestation_list_destroy (attests); | ||
649 | attrs = NULL; | 651 | attrs = NULL; |
650 | attests = NULL; | 652 | attests = NULL; |
651 | } | 653 | } |
@@ -775,10 +777,13 @@ check_attestation_result (void *cls, const struct AttestationResultMessage *msg) | |||
775 | { | 777 | { |
776 | size_t msg_len; | 778 | size_t msg_len; |
777 | size_t attr_len; | 779 | size_t attr_len; |
780 | size_t attest_len; | ||
778 | 781 | ||
779 | msg_len = ntohs (msg->header.size); | 782 | msg_len = ntohs (msg->header.size); |
780 | attr_len = ntohs (msg->attestation_len); | 783 | attest_len = ntohs (msg->attestation_len); |
781 | if (msg_len != sizeof(struct AttestationResultMessage) + attr_len) | 784 | attr_len = ntohs (msg->attributes_len); |
785 | if (msg_len != sizeof(struct AttestationResultMessage) | ||
786 | + attr_len + attest_len) | ||
782 | { | 787 | { |
783 | GNUNET_break (0); | 788 | GNUNET_break (0); |
784 | return GNUNET_SYSERR; | 789 | return GNUNET_SYSERR; |
@@ -851,6 +856,7 @@ handle_attestation_result (void *cls, const struct | |||
851 | att = GNUNET_RECLAIM_attestation_deserialize ((char *) &msg[1], att_len); | 856 | att = GNUNET_RECLAIM_attestation_deserialize ((char *) &msg[1], att_len); |
852 | char *read_ptr = ((char *) &msg[1]) + att_len; | 857 | char *read_ptr = ((char *) &msg[1]) + att_len; |
853 | attrs = GNUNET_RECLAIM_attribute_list_deserialize (read_ptr, attrs_len); | 858 | attrs = GNUNET_RECLAIM_attribute_list_deserialize (read_ptr, attrs_len); |
859 | |||
854 | if (NULL != it) | 860 | if (NULL != it) |
855 | { | 861 | { |
856 | if (NULL != it->proc) | 862 | if (NULL != it->proc) |
@@ -862,7 +868,8 @@ handle_attestation_result (void *cls, const struct | |||
862 | op->at_cb (op->cls, &msg->identity, att, attrs); | 868 | op->at_cb (op->cls, &msg->identity, att, attrs); |
863 | } | 869 | } |
864 | GNUNET_free (att); | 870 | GNUNET_free (att); |
865 | GNUNET_RECLAIM_attribute_list_destroy (attrs); | 871 | if (NULL != attrs) |
872 | GNUNET_RECLAIM_attribute_list_destroy (attrs); | ||
866 | return; | 873 | return; |
867 | } | 874 | } |
868 | GNUNET_assert (0); | 875 | GNUNET_assert (0); |
@@ -1429,7 +1436,8 @@ GNUNET_RECLAIM_get_attestations_start ( | |||
1429 | ait->identity = *identity; | 1436 | ait->identity = *identity; |
1430 | GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait); | 1437 | GNUNET_CONTAINER_DLL_insert_tail (h->ait_head, h->ait_tail, ait); |
1431 | env = | 1438 | env = |
1432 | GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START); | 1439 | GNUNET_MQ_msg (msg, |
1440 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_START); | ||
1433 | msg->id = htonl (rid); | 1441 | msg->id = htonl (rid); |
1434 | msg->identity = *identity; | 1442 | msg->identity = *identity; |
1435 | if (NULL == h->mq) | 1443 | if (NULL == h->mq) |
@@ -1447,7 +1455,8 @@ GNUNET_RECLAIM_get_attestations_start ( | |||
1447 | * @param it the iterator | 1455 | * @param it the iterator |
1448 | */ | 1456 | */ |
1449 | void | 1457 | void |
1450 | GNUNET_RECLAIM_get_attestations_next (struct GNUNET_RECLAIM_AttestationIterator *ait) | 1458 | GNUNET_RECLAIM_get_attestations_next (struct |
1459 | GNUNET_RECLAIM_AttestationIterator *ait) | ||
1451 | { | 1460 | { |
1452 | struct GNUNET_RECLAIM_Handle *h = ait->h; | 1461 | struct GNUNET_RECLAIM_Handle *h = ait->h; |
1453 | struct AttestationIterationNextMessage *msg; | 1462 | struct AttestationIterationNextMessage *msg; |
@@ -1468,7 +1477,8 @@ GNUNET_RECLAIM_get_attestations_next (struct GNUNET_RECLAIM_AttestationIterator | |||
1468 | * @param it the iterator | 1477 | * @param it the iterator |
1469 | */ | 1478 | */ |
1470 | void | 1479 | void |
1471 | GNUNET_RECLAIM_get_attestations_stop (struct GNUNET_RECLAIM_AttestationIterator *ait) | 1480 | GNUNET_RECLAIM_get_attestations_stop (struct |
1481 | GNUNET_RECLAIM_AttestationIterator *ait) | ||
1472 | { | 1482 | { |
1473 | struct GNUNET_RECLAIM_Handle *h = ait->h; | 1483 | struct GNUNET_RECLAIM_Handle *h = ait->h; |
1474 | struct GNUNET_MQ_Envelope *env; | 1484 | struct GNUNET_MQ_Envelope *env; |
@@ -1477,7 +1487,8 @@ GNUNET_RECLAIM_get_attestations_stop (struct GNUNET_RECLAIM_AttestationIterator | |||
1477 | if (NULL != h->mq) | 1487 | if (NULL != h->mq) |
1478 | { | 1488 | { |
1479 | env = | 1489 | env = |
1480 | GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP); | 1490 | GNUNET_MQ_msg (msg, |
1491 | GNUNET_MESSAGE_TYPE_RECLAIM_ATTESTATION_ITERATION_STOP); | ||
1481 | msg->id = htonl (ait->r_id); | 1492 | msg->id = htonl (ait->r_id); |
1482 | GNUNET_MQ_send (h->mq, env); | 1493 | GNUNET_MQ_send (h->mq, env); |
1483 | } | 1494 | } |
@@ -1485,7 +1496,6 @@ GNUNET_RECLAIM_get_attestations_stop (struct GNUNET_RECLAIM_AttestationIterator | |||
1485 | } | 1496 | } |
1486 | 1497 | ||
1487 | 1498 | ||
1488 | |||
1489 | /** | 1499 | /** |
1490 | * Issues a ticket to another relying party. The identity may use | 1500 | * Issues a ticket to another relying party. The identity may use |
1491 | * @GNUNET_RECLAIM_ticket_consume to consume the ticket | 1501 | * @GNUNET_RECLAIM_ticket_consume to consume the ticket |