diff options
Diffstat (limited to 'src/service/reclaim/reclaim_api.c')
-rw-r--r-- | src/service/reclaim/reclaim_api.c | 179 |
1 files changed, 50 insertions, 129 deletions
diff --git a/src/service/reclaim/reclaim_api.c b/src/service/reclaim/reclaim_api.c index d865f0050..f1819614c 100644 --- a/src/service/reclaim/reclaim_api.c +++ b/src/service/reclaim/reclaim_api.c | |||
@@ -621,9 +621,9 @@ handle_consume_ticket_result (void *cls, | |||
621 | read_ptr = (char *) &msg[1]; | 621 | read_ptr = (char *) &msg[1]; |
622 | GNUNET_assert (GNUNET_SYSERR != | 622 | GNUNET_assert (GNUNET_SYSERR != |
623 | GNUNET_CRYPTO_read_public_key_from_buffer (read_ptr, | 623 | GNUNET_CRYPTO_read_public_key_from_buffer (read_ptr, |
624 | key_len, | 624 | key_len, |
625 | &identity, | 625 | &identity, |
626 | &read)); | 626 | &read)); |
627 | read_ptr += read; | 627 | read_ptr += read; |
628 | attrs = | 628 | attrs = |
629 | GNUNET_RECLAIM_attribute_list_deserialize (read_ptr, attrs_len); | 629 | GNUNET_RECLAIM_attribute_list_deserialize (read_ptr, attrs_len); |
@@ -646,7 +646,8 @@ handle_consume_ticket_result (void *cls, | |||
646 | { | 646 | { |
647 | if (GNUNET_YES == | 647 | if (GNUNET_YES == |
648 | GNUNET_RECLAIM_id_is_equal (&le->attribute->credential, | 648 | GNUNET_RECLAIM_id_is_equal (&le->attribute->credential, |
649 | &ple->presentation->credential_id)) | 649 | &ple->presentation->credential_id) |
650 | ) | ||
650 | { | 651 | { |
651 | op->atr_cb (op->cls, &identity, | 652 | op->atr_cb (op->cls, &identity, |
652 | le->attribute, ple->presentation); | 653 | le->attribute, ple->presentation); |
@@ -765,9 +766,9 @@ handle_attribute_result (void *cls, const struct AttributeResultMessage *msg) | |||
765 | struct GNUNET_RECLAIM_Attribute *attr; | 766 | struct GNUNET_RECLAIM_Attribute *attr; |
766 | GNUNET_assert (GNUNET_SYSERR != | 767 | GNUNET_assert (GNUNET_SYSERR != |
767 | GNUNET_CRYPTO_read_public_key_from_buffer (buf, | 768 | GNUNET_CRYPTO_read_public_key_from_buffer (buf, |
768 | key_len, | 769 | key_len, |
769 | &identity, | 770 | &identity, |
770 | &read)); | 771 | &read)); |
771 | buf += read; | 772 | buf += read; |
772 | GNUNET_RECLAIM_attribute_deserialize (buf, attr_len, &attr); | 773 | GNUNET_RECLAIM_attribute_deserialize (buf, attr_len, &attr); |
773 | if (NULL != it) | 774 | if (NULL != it) |
@@ -854,9 +855,9 @@ handle_credential_result (void *cls, const struct | |||
854 | { | 855 | { |
855 | GNUNET_assert (GNUNET_SYSERR != | 856 | GNUNET_assert (GNUNET_SYSERR != |
856 | GNUNET_CRYPTO_read_public_key_from_buffer (buf, | 857 | GNUNET_CRYPTO_read_public_key_from_buffer (buf, |
857 | key_len, | 858 | key_len, |
858 | &identity, | 859 | &identity, |
859 | &read)); | 860 | &read)); |
860 | buf += read; | 861 | buf += read; |
861 | } | 862 | } |
862 | if (0 == key_len) | 863 | if (0 == key_len) |
@@ -918,11 +919,13 @@ check_ticket_result (void *cls, const struct TicketResultMessage *msg) | |||
918 | size_t msg_len; | 919 | size_t msg_len; |
919 | size_t pres_len; | 920 | size_t pres_len; |
920 | size_t tkt_len; | 921 | size_t tkt_len; |
922 | size_t rp_uri_len; | ||
921 | 923 | ||
922 | msg_len = ntohs (msg->header.size); | 924 | msg_len = ntohs (msg->header.size); |
923 | pres_len = ntohs (msg->presentations_len); | 925 | pres_len = ntohs (msg->presentations_len); |
924 | tkt_len = ntohs (msg->tkt_len); | 926 | tkt_len = ntohs (msg->tkt_len); |
925 | if (msg_len != sizeof(*msg) + pres_len + tkt_len) | 927 | rp_uri_len = ntohs (msg->rp_uri_len); |
928 | if (msg_len != sizeof(*msg) + pres_len + tkt_len + rp_uri_len) | ||
926 | { | 929 | { |
927 | GNUNET_break (0); | 930 | GNUNET_break (0); |
928 | return GNUNET_SYSERR; | 931 | return GNUNET_SYSERR; |
@@ -946,13 +949,16 @@ handle_ticket_result (void *cls, const struct TicketResultMessage *msg) | |||
946 | struct GNUNET_RECLAIM_TicketIterator *it; | 949 | struct GNUNET_RECLAIM_TicketIterator *it; |
947 | struct GNUNET_RECLAIM_PresentationList *presentation; | 950 | struct GNUNET_RECLAIM_PresentationList *presentation; |
948 | uint32_t r_id = ntohl (msg->id); | 951 | uint32_t r_id = ntohl (msg->id); |
949 | struct GNUNET_RECLAIM_Ticket ticket; | 952 | struct GNUNET_RECLAIM_Ticket *ticket = NULL; |
950 | size_t pres_len; | 953 | size_t pres_len; |
951 | size_t tkt_len; | 954 | size_t tkt_len; |
952 | size_t tb_read; | 955 | size_t rp_uri_len; |
956 | size_t tb_read = 0; | ||
953 | char *buf; | 957 | char *buf; |
958 | char *rp_uri = NULL; | ||
954 | 959 | ||
955 | tkt_len = ntohs (msg->tkt_len); | 960 | tkt_len = ntohs (msg->tkt_len); |
961 | rp_uri_len = ntohs (msg->rp_uri_len); | ||
956 | pres_len = ntohs (msg->presentations_len); | 962 | pres_len = ntohs (msg->presentations_len); |
957 | for (op = handle->op_head; NULL != op; op = op->next) | 963 | for (op = handle->op_head; NULL != op; op = op->next) |
958 | if (op->r_id == r_id) | 964 | if (op->r_id == r_id) |
@@ -965,13 +971,12 @@ handle_ticket_result (void *cls, const struct TicketResultMessage *msg) | |||
965 | buf = (char*) &msg[1]; | 971 | buf = (char*) &msg[1]; |
966 | if (0 < tkt_len) | 972 | if (0 < tkt_len) |
967 | { | 973 | { |
968 | GNUNET_assert (GNUNET_SYSERR != | 974 | ticket = (struct GNUNET_RECLAIM_Ticket*) buf; |
969 | GNUNET_RECLAIM_read_ticket_from_buffer (buf, | 975 | buf += tkt_len; |
970 | tkt_len, | 976 | tb_read += tkt_len; |
971 | &ticket, | ||
972 | &tb_read)); | ||
973 | buf += tb_read; | ||
974 | } | 977 | } |
978 | if (0 < rp_uri_len) | ||
979 | rp_uri = buf; | ||
975 | if (NULL != op) | 980 | if (NULL != op) |
976 | { | 981 | { |
977 | if (0 < pres_len) | 982 | if (0 < pres_len) |
@@ -988,7 +993,7 @@ handle_ticket_result (void *cls, const struct TicketResultMessage *msg) | |||
988 | { | 993 | { |
989 | if (NULL != op->ti_cb) | 994 | if (NULL != op->ti_cb) |
990 | op->ti_cb (op->cls, | 995 | op->ti_cb (op->cls, |
991 | &ticket, | 996 | ticket, |
992 | (0 < pres_len) ? presentation : NULL); | 997 | (0 < pres_len) ? presentation : NULL); |
993 | } | 998 | } |
994 | if (0 < pres_len) | 999 | if (0 < pres_len) |
@@ -1009,7 +1014,7 @@ handle_ticket_result (void *cls, const struct TicketResultMessage *msg) | |||
1009 | else | 1014 | else |
1010 | { | 1015 | { |
1011 | if (NULL != it->tr_cb) | 1016 | if (NULL != it->tr_cb) |
1012 | it->tr_cb (it->cls, &ticket); | 1017 | it->tr_cb (it->cls, ticket, rp_uri); |
1013 | } | 1018 | } |
1014 | return; | 1019 | return; |
1015 | } | 1020 | } |
@@ -1440,7 +1445,8 @@ GNUNET_RECLAIM_get_credentials_start ( | |||
1440 | env = | 1445 | env = |
1441 | GNUNET_MQ_msg_extra (msg, | 1446 | GNUNET_MQ_msg_extra (msg, |
1442 | key_len, | 1447 | key_len, |
1443 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START); | 1448 | GNUNET_MESSAGE_TYPE_RECLAIM_CREDENTIAL_ITERATION_START) |
1449 | ; | ||
1444 | msg->id = htonl (rid); | 1450 | msg->id = htonl (rid); |
1445 | msg->key_len = htons (key_len); | 1451 | msg->key_len = htons (key_len); |
1446 | GNUNET_CRYPTO_write_private_key_to_buffer (identity, &msg[1], key_len); | 1452 | GNUNET_CRYPTO_write_private_key_to_buffer (identity, &msg[1], key_len); |
@@ -1491,7 +1497,7 @@ struct GNUNET_RECLAIM_Operation * | |||
1491 | GNUNET_RECLAIM_ticket_issue ( | 1497 | GNUNET_RECLAIM_ticket_issue ( |
1492 | struct GNUNET_RECLAIM_Handle *h, | 1498 | struct GNUNET_RECLAIM_Handle *h, |
1493 | const struct GNUNET_CRYPTO_PrivateKey *iss, | 1499 | const struct GNUNET_CRYPTO_PrivateKey *iss, |
1494 | const struct GNUNET_CRYPTO_PublicKey *rp, | 1500 | const char *rp, |
1495 | const struct GNUNET_RECLAIM_AttributeList *attrs, | 1501 | const struct GNUNET_RECLAIM_AttributeList *attrs, |
1496 | GNUNET_RECLAIM_IssueTicketCallback cb, | 1502 | GNUNET_RECLAIM_IssueTicketCallback cb, |
1497 | void *cb_cls) | 1503 | void *cb_cls) |
@@ -1510,19 +1516,20 @@ GNUNET_RECLAIM_ticket_issue ( | |||
1510 | op->cls = cb_cls; | 1516 | op->cls = cb_cls; |
1511 | op->r_id = h->r_id_gen++; | 1517 | op->r_id = h->r_id_gen++; |
1512 | key_len = GNUNET_CRYPTO_private_key_get_length (iss); | 1518 | key_len = GNUNET_CRYPTO_private_key_get_length (iss); |
1513 | rpk_len = GNUNET_CRYPTO_public_key_get_length (rp); | 1519 | rpk_len = strlen (rp) + 1; |
1514 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | 1520 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); |
1515 | attr_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs); | 1521 | attr_len = GNUNET_RECLAIM_attribute_list_serialize_get_size (attrs); |
1516 | op->env = GNUNET_MQ_msg_extra (tim, | 1522 | op->env = GNUNET_MQ_msg_extra (tim, |
1517 | attr_len + key_len + rpk_len, | 1523 | attr_len + key_len + rpk_len, |
1518 | GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET); | 1524 | GNUNET_MESSAGE_TYPE_RECLAIM_ISSUE_TICKET); |
1519 | tim->key_len = htons (key_len); | 1525 | tim->key_len = htons (key_len); |
1520 | tim->pkey_len = htons (rpk_len); | 1526 | tim->rp_uri_len = htons (rpk_len); |
1521 | buf = (char *) &tim[1]; | 1527 | buf = (char *) &tim[1]; |
1522 | written = GNUNET_CRYPTO_write_private_key_to_buffer (iss, buf, key_len); | 1528 | written = GNUNET_CRYPTO_write_private_key_to_buffer (iss, buf, key_len); |
1523 | GNUNET_assert (0 <= written); | 1529 | GNUNET_assert (0 <= written); |
1524 | buf += written; | 1530 | buf += written; |
1525 | written = GNUNET_CRYPTO_write_public_key_to_buffer (rp, buf, rpk_len); | 1531 | memcpy (buf, rp, rpk_len); |
1532 | written = rpk_len; | ||
1526 | GNUNET_assert (0 <= written); | 1533 | GNUNET_assert (0 <= written); |
1527 | buf += written; | 1534 | buf += written; |
1528 | tim->id = htonl (op->r_id); | 1535 | tim->id = htonl (op->r_id); |
@@ -1535,30 +1542,18 @@ GNUNET_RECLAIM_ticket_issue ( | |||
1535 | } | 1542 | } |
1536 | 1543 | ||
1537 | 1544 | ||
1538 | /** | ||
1539 | * Consumes an issued ticket. The ticket is persisted | ||
1540 | * and used to retrieve identity information from the issuer | ||
1541 | * | ||
1542 | * @param h the reclaim to use | ||
1543 | * @param identity the identity that is the subject of the issued ticket (the | ||
1544 | * relying party) | ||
1545 | * @param ticket the issued ticket to consume | ||
1546 | * @param cb the callback to call | ||
1547 | * @param cb_cls the callback closure | ||
1548 | * @return handle to abort the operation | ||
1549 | */ | ||
1550 | struct GNUNET_RECLAIM_Operation * | 1545 | struct GNUNET_RECLAIM_Operation * |
1551 | GNUNET_RECLAIM_ticket_consume ( | 1546 | GNUNET_RECLAIM_ticket_consume ( |
1552 | struct GNUNET_RECLAIM_Handle *h, | 1547 | struct GNUNET_RECLAIM_Handle *h, |
1553 | const struct GNUNET_CRYPTO_PrivateKey *identity, | ||
1554 | const struct GNUNET_RECLAIM_Ticket *ticket, | 1548 | const struct GNUNET_RECLAIM_Ticket *ticket, |
1549 | const char *rp_uri, | ||
1555 | GNUNET_RECLAIM_AttributeTicketResult cb, | 1550 | GNUNET_RECLAIM_AttributeTicketResult cb, |
1556 | void *cb_cls) | 1551 | void *cb_cls) |
1557 | { | 1552 | { |
1558 | struct GNUNET_RECLAIM_Operation *op; | 1553 | struct GNUNET_RECLAIM_Operation *op; |
1559 | struct ConsumeTicketMessage *ctm; | 1554 | struct ConsumeTicketMessage *ctm; |
1560 | size_t key_len; | ||
1561 | size_t tkt_len; | 1555 | size_t tkt_len; |
1556 | size_t rp_uri_len; | ||
1562 | char *buf; | 1557 | char *buf; |
1563 | 1558 | ||
1564 | op = GNUNET_new (struct GNUNET_RECLAIM_Operation); | 1559 | op = GNUNET_new (struct GNUNET_RECLAIM_Operation); |
@@ -1566,18 +1561,18 @@ GNUNET_RECLAIM_ticket_consume ( | |||
1566 | op->atr_cb = cb; | 1561 | op->atr_cb = cb; |
1567 | op->cls = cb_cls; | 1562 | op->cls = cb_cls; |
1568 | op->r_id = h->r_id_gen++; | 1563 | op->r_id = h->r_id_gen++; |
1569 | key_len = GNUNET_CRYPTO_private_key_get_length (identity); | 1564 | tkt_len = strlen (ticket->gns_name) + 1; |
1570 | tkt_len = GNUNET_RECLAIM_ticket_serialize_get_size (ticket); | 1565 | rp_uri_len = strlen (rp_uri) + 1; |
1571 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | 1566 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); |
1572 | op->env = GNUNET_MQ_msg_extra (ctm, | 1567 | op->env = GNUNET_MQ_msg_extra (ctm, |
1573 | key_len + tkt_len, | 1568 | tkt_len + rp_uri_len, |
1574 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET); | 1569 | GNUNET_MESSAGE_TYPE_RECLAIM_CONSUME_TICKET); |
1575 | ctm->key_len = htons (key_len); | ||
1576 | buf = (char*) &ctm[1]; | 1570 | buf = (char*) &ctm[1]; |
1577 | GNUNET_CRYPTO_write_private_key_to_buffer (identity, buf, key_len); | 1571 | ctm->rp_uri_len = htons (rp_uri_len); |
1578 | buf += key_len; | ||
1579 | ctm->tkt_len = htons (tkt_len); | 1572 | ctm->tkt_len = htons (tkt_len); |
1580 | GNUNET_RECLAIM_write_ticket_to_buffer (ticket, buf, tkt_len); | 1573 | memcpy (buf, ticket, tkt_len); |
1574 | buf += tkt_len; | ||
1575 | memcpy (buf, rp_uri, rp_uri_len); | ||
1581 | ctm->id = htonl (op->r_id); | 1576 | ctm->id = htonl (op->r_id); |
1582 | if (NULL != h->mq) | 1577 | if (NULL != h->mq) |
1583 | GNUNET_MQ_send_copy (h->mq, op->env); | 1578 | GNUNET_MQ_send_copy (h->mq, op->env); |
@@ -1619,12 +1614,13 @@ GNUNET_RECLAIM_ticket_iteration_start ( | |||
1619 | GNUNET_CONTAINER_DLL_insert_tail (h->ticket_it_head, h->ticket_it_tail, it); | 1614 | GNUNET_CONTAINER_DLL_insert_tail (h->ticket_it_head, h->ticket_it_tail, it); |
1620 | env = GNUNET_MQ_msg_extra (msg, | 1615 | env = GNUNET_MQ_msg_extra (msg, |
1621 | key_len, | 1616 | key_len, |
1622 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START); | 1617 | GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_ITERATION_START) |
1618 | ; | ||
1623 | msg->id = htonl (rid); | 1619 | msg->id = htonl (rid); |
1624 | msg->key_len = htons (key_len); | 1620 | msg->key_len = htons (key_len); |
1625 | GNUNET_CRYPTO_write_private_key_to_buffer (identity, | 1621 | GNUNET_CRYPTO_write_private_key_to_buffer (identity, |
1626 | &msg[1], | 1622 | &msg[1], |
1627 | key_len); | 1623 | key_len); |
1628 | if (NULL == h->mq) | 1624 | if (NULL == h->mq) |
1629 | it->env = env; | 1625 | it->env = env; |
1630 | else | 1626 | else |
@@ -1714,7 +1710,7 @@ GNUNET_RECLAIM_ticket_revoke ( | |||
1714 | op->r_id = rid; | 1710 | op->r_id = rid; |
1715 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); | 1711 | GNUNET_CONTAINER_DLL_insert_tail (h->op_head, h->op_tail, op); |
1716 | key_len = GNUNET_CRYPTO_private_key_get_length (identity); | 1712 | key_len = GNUNET_CRYPTO_private_key_get_length (identity); |
1717 | tkt_len = GNUNET_RECLAIM_ticket_serialize_get_size (ticket); | 1713 | tkt_len = strlen (ticket->gns_name) + 1; |
1718 | op->env = GNUNET_MQ_msg_extra (msg, | 1714 | op->env = GNUNET_MQ_msg_extra (msg, |
1719 | key_len + tkt_len, | 1715 | key_len + tkt_len, |
1720 | GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET); | 1716 | GNUNET_MESSAGE_TYPE_RECLAIM_REVOKE_TICKET); |
@@ -1723,13 +1719,11 @@ GNUNET_RECLAIM_ticket_revoke ( | |||
1723 | msg->tkt_len = htons (tkt_len); | 1719 | msg->tkt_len = htons (tkt_len); |
1724 | buf = (char*) &msg[1]; | 1720 | buf = (char*) &msg[1]; |
1725 | written = GNUNET_CRYPTO_write_private_key_to_buffer (identity, | 1721 | written = GNUNET_CRYPTO_write_private_key_to_buffer (identity, |
1726 | buf, | 1722 | buf, |
1727 | key_len); | 1723 | key_len); |
1728 | GNUNET_assert (0 <= written); | 1724 | GNUNET_assert (0 <= written); |
1729 | buf += written; | 1725 | buf += written; |
1730 | GNUNET_RECLAIM_write_ticket_to_buffer (ticket, | 1726 | memcpy (buf, ticket, tkt_len); |
1731 | buf, | ||
1732 | tkt_len); | ||
1733 | if (NULL != h->mq) | 1727 | if (NULL != h->mq) |
1734 | { | 1728 | { |
1735 | GNUNET_MQ_send (h->mq, op->env); | 1729 | GNUNET_MQ_send (h->mq, op->env); |
@@ -1738,78 +1732,5 @@ GNUNET_RECLAIM_ticket_revoke ( | |||
1738 | return op; | 1732 | return op; |
1739 | } | 1733 | } |
1740 | 1734 | ||
1741 | size_t | ||
1742 | GNUNET_RECLAIM_ticket_serialize_get_size (const struct | ||
1743 | GNUNET_RECLAIM_Ticket *tkt) | ||
1744 | { | ||
1745 | size_t size = sizeof (tkt->rnd); | ||
1746 | size += GNUNET_CRYPTO_public_key_get_length (&tkt->identity); | ||
1747 | size += GNUNET_CRYPTO_public_key_get_length (&tkt->audience); | ||
1748 | return size; | ||
1749 | } | ||
1750 | |||
1751 | enum GNUNET_GenericReturnValue | ||
1752 | GNUNET_RECLAIM_read_ticket_from_buffer (const void *buffer, | ||
1753 | size_t len, | ||
1754 | struct GNUNET_RECLAIM_Ticket *tkt, | ||
1755 | size_t *tb_read) | ||
1756 | { | ||
1757 | const char *tmp = buffer; | ||
1758 | size_t read = 0; | ||
1759 | size_t left = len; | ||
1760 | if (GNUNET_SYSERR == | ||
1761 | GNUNET_CRYPTO_read_public_key_from_buffer (tmp, | ||
1762 | left, | ||
1763 | &tkt->identity, | ||
1764 | &read)) | ||
1765 | return GNUNET_SYSERR; | ||
1766 | left -= read; | ||
1767 | tmp += read; | ||
1768 | if (GNUNET_SYSERR == | ||
1769 | GNUNET_CRYPTO_read_public_key_from_buffer (tmp, | ||
1770 | left, | ||
1771 | &tkt->audience, | ||
1772 | &read)) | ||
1773 | return GNUNET_SYSERR; | ||
1774 | left -= read; | ||
1775 | tmp += read; | ||
1776 | if (left < sizeof (tkt->rnd)) | ||
1777 | return GNUNET_SYSERR; | ||
1778 | memcpy (&tkt->rnd, tmp, sizeof (tkt->rnd)); | ||
1779 | *tb_read = tmp - (char*) buffer + sizeof (tkt->rnd); | ||
1780 | return GNUNET_OK; | ||
1781 | } | ||
1782 | |||
1783 | |||
1784 | ssize_t | ||
1785 | GNUNET_RECLAIM_write_ticket_to_buffer (const struct | ||
1786 | GNUNET_RECLAIM_Ticket *tkt, | ||
1787 | void *buffer, | ||
1788 | size_t len) | ||
1789 | { | ||
1790 | char *tmp = buffer; | ||
1791 | size_t left = len; | ||
1792 | ssize_t written = 0; | ||
1793 | written = GNUNET_CRYPTO_write_public_key_to_buffer (&tkt->identity, | ||
1794 | buffer, | ||
1795 | left); | ||
1796 | if (0 > written) | ||
1797 | return written; | ||
1798 | left -= written; | ||
1799 | tmp += written; | ||
1800 | written = GNUNET_CRYPTO_write_public_key_to_buffer (&tkt->audience, | ||
1801 | tmp, | ||
1802 | left); | ||
1803 | if (0 > written) | ||
1804 | return written; | ||
1805 | left -= written; | ||
1806 | tmp += written; | ||
1807 | if (left < sizeof (tkt->rnd)) | ||
1808 | return -1; | ||
1809 | memcpy (tmp, &tkt->rnd, sizeof (tkt->rnd)); | ||
1810 | return tmp - (char*) buffer + sizeof (tkt->rnd); | ||
1811 | } | ||
1812 | |||
1813 | |||
1814 | 1735 | ||
1815 | /* end of reclaim_api.c */ | 1736 | /* end of reclaim_api.c */ |