aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/gnunet-service-reclaim.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reclaim/gnunet-service-reclaim.c')
-rw-r--r--src/reclaim/gnunet-service-reclaim.c369
1 files changed, 144 insertions, 225 deletions
diff --git a/src/reclaim/gnunet-service-reclaim.c b/src/reclaim/gnunet-service-reclaim.c
index f3a6e2073..b963b0a9b 100644
--- a/src/reclaim/gnunet-service-reclaim.c
+++ b/src/reclaim/gnunet-service-reclaim.c
@@ -30,12 +30,12 @@
30#include "gnunet_identity_service.h" 30#include "gnunet_identity_service.h"
31#include "gnunet_gnsrecord_lib.h" 31#include "gnunet_gnsrecord_lib.h"
32#include "gnunet_namestore_service.h" 32#include "gnunet_namestore_service.h"
33#include "gnunet_credential_service.h"
34#include "gnunet_statistics_service.h" 33#include "gnunet_statistics_service.h"
35#include "gnunet_gns_service.h" 34#include "gnunet_gns_service.h"
36#include "gnunet_reclaim_plugin.h" 35#include "gnunet_reclaim_plugin.h"
37#include "gnunet_reclaim_attribute_lib.h" 36#include "gnunet_reclaim_attribute_lib.h"
38#include "gnunet_signatures.h" 37#include "gnunet_signatures.h"
38#include "gnunet-service-reclaim_tickets.h"
39#include "reclaim.h" 39#include "reclaim.h"
40 40
41/** 41/**
@@ -89,21 +89,6 @@ static struct GNUNET_NAMESTORE_Handle *nsh;
89static struct GNUNET_GNS_Handle *gns_handle; 89static struct GNUNET_GNS_Handle *gns_handle;
90 90
91/** 91/**
92 * Credential handle
93 */
94static struct GNUNET_CREDENTIAL_Handle *credential_handle;
95
96/**
97 * Namestore qe
98 */
99static struct GNUNET_NAMESTORE_QueueEntry *ns_qe;
100
101/**
102 * Namestore iterator
103 */
104static struct GNUNET_NAMESTORE_ZoneIterator *ns_it;
105
106/**
107 * Timeout task 92 * Timeout task
108 */ 93 */
109static struct GNUNET_SCHEDULER_Task *timeout_task; 94static struct GNUNET_SCHEDULER_Task *timeout_task;
@@ -268,12 +253,12 @@ struct IdpClient
268 /** 253 /**
269 * Head of DLL of ticket issue ops 254 * Head of DLL of ticket issue ops
270 */ 255 */
271 struct TicketIssueHandle *issue_op_head; 256 struct TicketIssueOperation *issue_op_head;
272 257
273 /** 258 /**
274 * Tail of DLL of ticket issue ops 259 * Tail of DLL of ticket issue ops
275 */ 260 */
276 struct TicketIssueHandle *issue_op_tail; 261 struct TicketIssueOperation *issue_op_tail;
277 262
278 /** 263 /**
279 * Head of DLL of ticket consume ops 264 * Head of DLL of ticket consume ops
@@ -543,19 +528,19 @@ struct TicketRevocationHandle
543 528
544 529
545/** 530/**
546 * Ticket issue request handle 531 * Ticket issue operation handle
547 */ 532 */
548struct TicketIssueHandle 533struct TicketIssueOperation
549{ 534{
550 /** 535 /**
551 * DLL 536 * DLL
552 */ 537 */
553 struct TicketIssueHandle *prev; 538 struct TicketIssueOperation *prev;
554 539
555 /** 540 /**
556 * DLL 541 * DLL
557 */ 542 */
558 struct TicketIssueHandle *next; 543 struct TicketIssueOperation *next;
559 544
560 /** 545 /**
561 * Client connection 546 * Client connection
@@ -563,26 +548,6 @@ struct TicketIssueHandle
563 struct IdpClient *client; 548 struct IdpClient *client;
564 549
565 /** 550 /**
566 * Attributes to issue
567 */
568 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
569
570 /**
571 * Issuer Key
572 */
573 struct GNUNET_CRYPTO_EcdsaPrivateKey identity;
574
575 /**
576 * Ticket to issue
577 */
578 struct GNUNET_RECLAIM_Ticket ticket;
579
580 /**
581 * QueueEntry
582 */
583 struct GNUNET_NAMESTORE_QueueEntry *ns_qe;
584
585 /**
586 * request id 551 * request id
587 */ 552 */
588 uint32_t r_id; 553 uint32_t r_id;
@@ -644,12 +609,6 @@ cleanup()
644 GNUNET_IDENTITY_disconnect (identity_handle); 609 GNUNET_IDENTITY_disconnect (identity_handle);
645 if (NULL != gns_handle) 610 if (NULL != gns_handle)
646 GNUNET_GNS_disconnect (gns_handle); 611 GNUNET_GNS_disconnect (gns_handle);
647 if (NULL != credential_handle)
648 GNUNET_CREDENTIAL_disconnect (credential_handle);
649 if (NULL != ns_it)
650 GNUNET_NAMESTORE_zone_iteration_stop (ns_it);
651 if (NULL != ns_qe)
652 GNUNET_NAMESTORE_cancel (ns_qe);
653 if (NULL != nsh) 612 if (NULL != nsh)
654 GNUNET_NAMESTORE_disconnect (nsh); 613 GNUNET_NAMESTORE_disconnect (nsh);
655} 614}
@@ -691,83 +650,136 @@ create_sym_key_from_ecdh (const struct GNUNET_HashCode *new_key_hash,
691 return GNUNET_OK; 650 return GNUNET_OK;
692} 651}
693 652
694/**
695 * Cleanup ticket consume handle
696 * @param handle the handle to clean up
697 */
698static void
699cleanup_ticket_issue_handle (struct TicketIssueHandle *handle)
700{
701 if (NULL != handle->attrs)
702 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (handle->attrs);
703 if (NULL != handle->ns_qe)
704 GNUNET_NAMESTORE_cancel (handle->ns_qe);
705 GNUNET_free (handle);
706}
707
708 653
709static void 654static void
710send_ticket_result (struct IdpClient *client, 655send_ticket_result (const struct IdpClient *client,
711 uint32_t r_id, 656 uint32_t r_id,
712 const struct GNUNET_RECLAIM_Ticket *ticket, 657 const struct GNUNET_RECLAIM_Ticket *ticket,
713 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs) 658 uint32_t success)
714{ 659{
715 struct TicketResultMessage *irm; 660 struct TicketResultMessage *irm;
716 struct GNUNET_MQ_Envelope *env; 661 struct GNUNET_MQ_Envelope *env;
717 struct GNUNET_RECLAIM_Ticket *ticket_buf; 662 struct GNUNET_RECLAIM_Ticket *ticket_buf;
718 663
719 /* store ticket in DB */ 664 if (NULL != ticket)
720 if (GNUNET_OK != TKT_database->store_ticket (TKT_database->cls,
721 ticket,
722 attrs))
723 { 665 {
724 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 666 env = GNUNET_MQ_msg_extra (irm,
725 "Unable to store ticket after issue\n"); 667 sizeof (struct GNUNET_RECLAIM_Ticket),
726 GNUNET_break (0); 668 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
669 ticket_buf = (struct GNUNET_RECLAIM_Ticket *)&irm[1];
670 *ticket_buf = *ticket;
671 } else {
672 env = GNUNET_MQ_msg (irm,
673 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
727 } 674 }
728 675 //TODO add success member
729 env = GNUNET_MQ_msg_extra (irm,
730 sizeof (struct GNUNET_RECLAIM_Ticket),
731 GNUNET_MESSAGE_TYPE_RECLAIM_TICKET_RESULT);
732 ticket_buf = (struct GNUNET_RECLAIM_Ticket *)&irm[1];
733 *ticket_buf = *ticket;
734 irm->id = htonl (r_id); 676 irm->id = htonl (r_id);
735 GNUNET_MQ_send (client->mq, 677 GNUNET_MQ_send (client->mq,
736 env); 678 env);
737} 679}
738 680
681
739static void 682static void
740store_ticket_issue_cont (void *cls, 683issue_ticket_result_cb (void *cls,
741 int32_t success, 684 struct GNUNET_RECLAIM_Ticket *ticket,
742 const char *emsg) 685 uint32_t success,
686 const char* emsg)
743{ 687{
744 struct TicketIssueHandle *handle = cls; 688 struct TicketIssueOperation *tio = cls;
745 689 if (GNUNET_OK != success)
746 handle->ns_qe = NULL;
747 GNUNET_CONTAINER_DLL_remove (handle->client->issue_op_head,
748 handle->client->issue_op_tail,
749 handle);
750 if (GNUNET_SYSERR == success)
751 { 690 {
752 cleanup_ticket_issue_handle (handle); 691 send_ticket_result (tio->client,
753 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", 692 tio->r_id,
754 "Unknown Error\n"); 693 NULL,
755 GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); 694 GNUNET_SYSERR);
695 GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head,
696 tio->client->issue_op_tail,
697 tio);
698 GNUNET_free (tio);
699 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
700 "Error issuing ticket: %s\n",
701 emsg);
756 return; 702 return;
757 } 703 }
758 send_ticket_result (handle->client, 704 send_ticket_result (tio->client,
759 handle->r_id, 705 tio->r_id,
760 &handle->ticket, 706 ticket,
761 handle->attrs); 707 GNUNET_SYSERR);
762 cleanup_ticket_issue_handle (handle); 708 GNUNET_CONTAINER_DLL_remove (tio->client->issue_op_head,
709 tio->client->issue_op_tail,
710 tio);
711 GNUNET_free (tio);
712}
713
714static int
715check_issue_ticket_message (void *cls,
716 const struct IssueTicketMessage *im)
717{
718 uint16_t size;
719
720 size = ntohs (im->header.size);
721 if (size <= sizeof (struct IssueTicketMessage))
722 {
723 GNUNET_break (0);
724 return GNUNET_SYSERR;
725 }
726 return GNUNET_OK;
763} 727}
764 728
729static void
730handle_issue_ticket_message (void *cls,
731 const struct IssueTicketMessage *im)
732{
733 struct TicketIssueOperation *tio;
734 struct IdpClient *idp = cls;
735 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs;
736 size_t attrs_len;
737
738 tio = GNUNET_new (struct TicketIssueOperation);
739 attrs_len = ntohs (im->attr_len);
740 attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char*)&im[1], attrs_len);
741 tio->r_id = ntohl (im->id);
742 tio->client = idp;
743 GNUNET_CONTAINER_DLL_insert (idp->issue_op_head,
744 idp->issue_op_tail,
745 tio);
746 RECLAIM_TICKETS_issue_ticket (&im->identity,
747 attrs,
748 &im->rp,
749 &issue_ticket_result_cb,
750 tio);
751 GNUNET_SERVICE_client_continue (idp->client);
752 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (attrs);
753}
754
755/**********************************************************
756 * Revocation
757 **********************************************************/
758
759/**
760 * Cleanup revoke handle
761 *
762 * @param rh the ticket revocation handle
763 */
764static void
765cleanup_revoke_ticket_handle (struct TicketRevocationHandle *rh)
766{
767 if (NULL != rh->attrs)
768 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (rh->attrs);
769 if (NULL != rh->rvk_attrs)
770 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (rh->rvk_attrs);
771 if (NULL != rh->ns_qe)
772 GNUNET_NAMESTORE_cancel (rh->ns_qe);
773 if (NULL != rh->ns_it)
774 GNUNET_NAMESTORE_zone_iteration_stop (rh->ns_it);
775 GNUNET_free (rh);
776}
765 777
766static int 778static int
767serialize_authz_record (const struct GNUNET_RECLAIM_Ticket *ticket, 779serialize_authz_record (const struct GNUNET_RECLAIM_Ticket *ticket,
768 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs, 780 const struct GNUNET_RECLAIM_ATTRIBUTE_ClaimList *attrs,
769 struct GNUNET_CRYPTO_EcdhePrivateKey **ecdh_privkey, 781 struct GNUNET_CRYPTO_EcdhePrivateKey **ecdh_privkey,
770 char **result) 782 char **result)
771{ 783{
772 struct GNUNET_CRYPTO_EcdhePublicKey ecdh_pubkey; 784 struct GNUNET_CRYPTO_EcdhePublicKey ecdh_pubkey;
773 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le; 785 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
@@ -833,111 +845,6 @@ serialize_authz_record (const struct GNUNET_RECLAIM_Ticket *ticket,
833} 845}
834 846
835 847
836
837static void
838issue_ticket (struct TicketIssueHandle *ih)
839{
840 struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey;
841 struct GNUNET_GNSRECORD_Data code_record[1];
842 char *authz_record_data;
843 size_t authz_record_len;
844 char *label;
845
846 //TODO rename function
847 authz_record_len = serialize_authz_record (&ih->ticket,
848 ih->attrs,
849 &ecdhe_privkey,
850 &authz_record_data);
851 code_record[0].data = authz_record_data;
852 code_record[0].data_size = authz_record_len;
853 code_record[0].expiration_time = GNUNET_TIME_UNIT_DAYS.rel_value_us;
854 code_record[0].record_type = GNUNET_GNSRECORD_TYPE_RECLAIM_AUTHZ;
855 code_record[0].flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
856
857 label = GNUNET_STRINGS_data_to_string_alloc (&ih->ticket.rnd,
858 sizeof (uint64_t));
859 //Publish record
860 ih->ns_qe = GNUNET_NAMESTORE_records_store (nsh,
861 &ih->identity,
862 label,
863 1,
864 code_record,
865 &store_ticket_issue_cont,
866 ih);
867 GNUNET_free (ecdhe_privkey);
868 GNUNET_free (label);
869 GNUNET_free (authz_record_data);
870}
871
872
873static int
874check_issue_ticket_message(void *cls,
875 const struct IssueTicketMessage *im)
876{
877 uint16_t size;
878
879 size = ntohs (im->header.size);
880 if (size <= sizeof (struct IssueTicketMessage))
881 {
882 GNUNET_break (0);
883 return GNUNET_SYSERR;
884 }
885 return GNUNET_OK;
886}
887
888
889static void
890handle_issue_ticket_message (void *cls,
891 const struct IssueTicketMessage *im)
892{
893 struct TicketIssueHandle *ih;
894 struct IdpClient *idp = cls;
895 size_t attrs_len;
896
897 ih = GNUNET_new (struct TicketIssueHandle);
898 attrs_len = ntohs (im->attr_len);
899 ih->attrs = GNUNET_RECLAIM_ATTRIBUTE_list_deserialize ((char*)&im[1], attrs_len);
900 ih->r_id = ntohl (im->id);
901 ih->client = idp;
902 ih->identity = im->identity;
903 GNUNET_CRYPTO_ecdsa_key_get_public (&ih->identity,
904 &ih->ticket.identity);
905 ih->ticket.audience = im->rp;
906 ih->ticket.rnd =
907 GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG,
908 UINT64_MAX);
909 GNUNET_CONTAINER_DLL_insert (idp->issue_op_head,
910 idp->issue_op_tail,
911 ih);
912 issue_ticket (ih);
913 GNUNET_SERVICE_client_continue (idp->client);
914
915}
916
917/**********************************************************
918 * Revocation
919 **********************************************************/
920
921/**
922 * Cleanup revoke handle
923 *
924 * @param rh the ticket revocation handle
925 */
926static void
927cleanup_revoke_ticket_handle (struct TicketRevocationHandle *rh)
928{
929 if (NULL != rh->attrs)
930 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (rh->attrs);
931 if (NULL != rh->rvk_attrs)
932 GNUNET_RECLAIM_ATTRIBUTE_list_destroy (rh->rvk_attrs);
933 if (NULL != rh->ns_qe)
934 GNUNET_NAMESTORE_cancel (rh->ns_qe);
935 if (NULL != rh->ns_it)
936 GNUNET_NAMESTORE_zone_iteration_stop (rh->ns_it);
937 GNUNET_free (rh);
938}
939
940
941/** 848/**
942 * Send revocation result 849 * Send revocation result
943 * 850 *
@@ -1086,8 +993,6 @@ ticket_reissue_proc (void *cls,
1086 993
1087 rh->offset++; 994 rh->offset++;
1088 GNUNET_SCHEDULER_add_now (&reissue_next, rh); 995 GNUNET_SCHEDULER_add_now (&reissue_next, rh);
1089
1090
1091 return; 996 return;
1092 } 997 }
1093 998
@@ -1186,6 +1091,7 @@ check_attr_cb (void *cls,
1186{ 1091{
1187 struct TicketRevocationHandle *rh = cls; 1092 struct TicketRevocationHandle *rh = cls;
1188 struct TicketAttributeUpdateEntry *tue; 1093 struct TicketAttributeUpdateEntry *tue;
1094 struct GNUNET_RECLAIM_ATTRIBUTE_ClaimListEntry *le;
1189 struct GNUNET_GNSRECORD_Data rd[1]; 1095 struct GNUNET_GNSRECORD_Data rd[1];
1190 char* buf; 1096 char* buf;
1191 size_t buf_size; 1097 size_t buf_size;
@@ -1193,6 +1099,16 @@ check_attr_cb (void *cls,
1193 1099
1194 rh->ns_qe = NULL; 1100 rh->ns_qe = NULL;
1195 if (1 != rd_count) { 1101 if (1 != rd_count) {
1102 le = rh->attrs->list_head;
1103 GNUNET_CONTAINER_DLL_remove (rh->attrs->list_head,
1104 rh->attrs->list_tail,
1105 le);
1106 GNUNET_assert (NULL != rh->rvk_attrs);
1107 GNUNET_CONTAINER_DLL_insert (rh->rvk_attrs->list_head,
1108 rh->rvk_attrs->list_tail,
1109 le);
1110 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1111 "Re-encrypting next attribute\n");
1196 GNUNET_SCHEDULER_add_now (&reenc_next_attribute, 1112 GNUNET_SCHEDULER_add_now (&reenc_next_attribute,
1197 rh); 1113 rh);
1198 return; 1114 return;
@@ -1213,7 +1129,7 @@ check_attr_cb (void *cls,
1213 rh->attrs->list_head->claim->id = tue->new_id; 1129 rh->attrs->list_head->claim->id = tue->new_id;
1214 new_label = GNUNET_STRINGS_data_to_string_alloc (&tue->new_id, 1130 new_label = GNUNET_STRINGS_data_to_string_alloc (&tue->new_id,
1215 sizeof (uint64_t)); 1131 sizeof (uint64_t));
1216 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1132 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1217 "New attr id %s\n", new_label); 1133 "New attr id %s\n", new_label);
1218 rd[0].data_size = buf_size; 1134 rd[0].data_size = buf_size;
1219 rd[0].data = buf; 1135 rd[0].data = buf;
@@ -1247,6 +1163,7 @@ reenc_next_attribute (void *cls)
1247 /* First check if attribute still exists */ 1163 /* First check if attribute still exists */
1248 label = GNUNET_STRINGS_data_to_string_alloc (&rh->attrs->list_head->claim->id, 1164 label = GNUNET_STRINGS_data_to_string_alloc (&rh->attrs->list_head->claim->id,
1249 sizeof (uint64_t)); 1165 sizeof (uint64_t));
1166 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ID: %lu\n", rh->attrs->list_head->claim->id);
1250 rh->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh, 1167 rh->ns_qe = GNUNET_NAMESTORE_records_lookup (nsh,
1251 &rh->identity, 1168 &rh->identity,
1252 label, 1169 label,
@@ -1308,7 +1225,7 @@ process_attributes_to_update (void *cls,
1308 struct TicketRevocationHandle *rh = cls; 1225 struct TicketRevocationHandle *rh = cls;
1309 1226
1310 rh->attrs = GNUNET_RECLAIM_ATTRIBUTE_list_dup (attrs); 1227 rh->attrs = GNUNET_RECLAIM_ATTRIBUTE_list_dup (attrs);
1311 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1228 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1312 "Revocation Phase I: Collecting attributes\n"); 1229 "Revocation Phase I: Collecting attributes\n");
1313 /* Reencrypt all attributes with new key */ 1230 /* Reencrypt all attributes with new key */
1314 if (NULL == rh->attrs->list_head) 1231 if (NULL == rh->attrs->list_head)
@@ -1318,7 +1235,7 @@ process_attributes_to_update (void *cls,
1318 cleanup_revoke_ticket_handle (rh); 1235 cleanup_revoke_ticket_handle (rh);
1319 return; 1236 return;
1320 } else { 1237 } else {
1321 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1238 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1322 "Revocation Phase II: Re-encrypting attributes\n"); 1239 "Revocation Phase II: Re-encrypting attributes\n");
1323 reenc_next_attribute (rh); 1240 reenc_next_attribute (rh);
1324 } 1241 }
@@ -1463,16 +1380,16 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count,
1463 /* Else we are done */ 1380 /* Else we are done */
1464 1381
1465 /** Store ticket in DB 1382 /** Store ticket in DB
1466 * TODO: Store in GNS 1383 * TODO: Store in GNS?
1467 */ 1384 */
1468 if (GNUNET_OK != TKT_database->store_ticket (TKT_database->cls, 1385 /**if (GNUNET_OK != TKT_database->store_ticket (TKT_database->cls,
1469 &handle->ticket, 1386 &handle->ticket,
1470 handle->attrs)) 1387 handle->attrs))
1471 { 1388 {
1472 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1389 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1473 "Unable to store ticket after consume\n"); 1390 "Unable to store ticket after consume\n");
1474 GNUNET_break (0); 1391 GNUNET_break (0);
1475 } 1392 }*/
1476 1393
1477 GNUNET_SCHEDULER_cancel (handle->kill_task); 1394 GNUNET_SCHEDULER_cancel (handle->kill_task);
1478 attrs_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (handle->attrs); 1395 attrs_len = GNUNET_RECLAIM_ATTRIBUTE_list_serialize_get_size (handle->attrs);
@@ -1775,7 +1692,7 @@ handle_attribute_store_message (void *cls,
1775 1692
1776 ash = GNUNET_new (struct AttributeStoreHandle); 1693 ash = GNUNET_new (struct AttributeStoreHandle);
1777 ash->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char*)&sam[1], 1694 ash->claim = GNUNET_RECLAIM_ATTRIBUTE_deserialize ((char*)&sam[1],
1778 data_len); 1695 data_len);
1779 1696
1780 ash->r_id = ntohl (sam->id); 1697 ash->r_id = ntohl (sam->id);
1781 ash->identity = sam->identity; 1698 ash->identity = sam->identity;
@@ -2028,7 +1945,7 @@ ticket_iterate_proc (void *cls,
2028 send_ticket_result (proc->ti->client, 1945 send_ticket_result (proc->ti->client,
2029 proc->ti->r_id, 1946 proc->ti->r_id,
2030 ticket, 1947 ticket,
2031 attrs); 1948 GNUNET_OK);
2032 1949
2033} 1950}
2034 1951
@@ -2180,6 +2097,13 @@ run (void *cls,
2180 2097
2181 stats = GNUNET_STATISTICS_create ("reclaim", cfg); 2098 stats = GNUNET_STATISTICS_create ("reclaim", cfg);
2182 2099
2100 if (GNUNET_OK != RECLAIM_TICKETS_init (cfg))
2101 {
2102 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
2103 "Unable to initialized TICKETS subsystem.\n");
2104 GNUNET_SCHEDULER_shutdown ();
2105 return;
2106 }
2183 //Connect to identity and namestore services 2107 //Connect to identity and namestore services
2184 nsh = GNUNET_NAMESTORE_connect (cfg); 2108 nsh = GNUNET_NAMESTORE_connect (cfg);
2185 if (NULL == nsh) 2109 if (NULL == nsh)
@@ -2192,11 +2116,6 @@ run (void *cls,
2192 { 2116 {
2193 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to gns"); 2117 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to gns");
2194 } 2118 }
2195 credential_handle = GNUNET_CREDENTIAL_connect (cfg);
2196 if (NULL == credential_handle)
2197 {
2198 GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "error connecting to credential");
2199 }
2200 identity_handle = GNUNET_IDENTITY_connect (cfg, 2119 identity_handle = GNUNET_IDENTITY_connect (cfg,
2201 NULL, 2120 NULL,
2202 NULL); 2121 NULL);
@@ -2256,7 +2175,7 @@ client_disconnect_cb (void *cls,
2256 struct AttributeIterator *ai; 2175 struct AttributeIterator *ai;
2257 struct TicketIteration *ti; 2176 struct TicketIteration *ti;
2258 struct TicketRevocationHandle *rh; 2177 struct TicketRevocationHandle *rh;
2259 struct TicketIssueHandle *iss; 2178 struct TicketIssueOperation *iss;
2260 struct ConsumeTicketHandle *ct; 2179 struct ConsumeTicketHandle *ct;
2261 struct AttributeStoreHandle *as; 2180 struct AttributeStoreHandle *as;
2262 2181
@@ -2271,7 +2190,7 @@ client_disconnect_cb (void *cls,
2271 GNUNET_CONTAINER_DLL_remove (idp->issue_op_head, 2190 GNUNET_CONTAINER_DLL_remove (idp->issue_op_head,
2272 idp->issue_op_tail, 2191 idp->issue_op_tail,
2273 iss); 2192 iss);
2274 cleanup_ticket_issue_handle (iss); 2193 GNUNET_free (iss);
2275 } 2194 }
2276 while (NULL != (ct = idp->consume_op_head)) 2195 while (NULL != (ct = idp->consume_op_head))
2277 { 2196 {