diff options
author | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2018-04-10 16:34:38 +0200 |
---|---|---|
committer | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2018-04-10 16:34:38 +0200 |
commit | 96a9530a14cff303959c2251829100a1e62954ce (patch) | |
tree | 20dc209a3c49a29d57d00d7be466b6bd4915e5ba /src/identity-provider | |
parent | de72aeb9ffa09576f7df749ef5ef2cf3391adec2 (diff) | |
download | gnunet-96a9530a14cff303959c2251829100a1e62954ce.tar.gz gnunet-96a9530a14cff303959c2251829100a1e62954ce.zip |
fix request handling
Diffstat (limited to 'src/identity-provider')
-rw-r--r-- | src/identity-provider/gnunet-service-identity-provider.c | 216 |
1 files changed, 178 insertions, 38 deletions
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c index 5fc9a11e2..572202c3f 100644 --- a/src/identity-provider/gnunet-service-identity-provider.c +++ b/src/identity-provider/gnunet-service-identity-provider.c | |||
@@ -297,14 +297,14 @@ struct IdpClient | |||
297 | * Attribute iteration operations in | 297 | * Attribute iteration operations in |
298 | * progress initiated by this client | 298 | * progress initiated by this client |
299 | */ | 299 | */ |
300 | struct AttributeIterator *op_head; | 300 | struct AttributeIterator *attr_iter_head; |
301 | 301 | ||
302 | /** | 302 | /** |
303 | * Tail of the DLL of | 303 | * Tail of the DLL of |
304 | * Attribute iteration operations | 304 | * Attribute iteration operations |
305 | * in progress initiated by this client | 305 | * in progress initiated by this client |
306 | */ | 306 | */ |
307 | struct AttributeIterator *op_tail; | 307 | struct AttributeIterator *attr_iter_tail; |
308 | 308 | ||
309 | /** | 309 | /** |
310 | * Head of DLL of ticket iteration ops | 310 | * Head of DLL of ticket iteration ops |
@@ -316,22 +316,59 @@ struct IdpClient | |||
316 | */ | 316 | */ |
317 | struct TicketIteration *ticket_iter_tail; | 317 | struct TicketIteration *ticket_iter_tail; |
318 | 318 | ||
319 | |||
320 | /** | 319 | /** |
321 | * Head of DLL of ticket revocation ops | 320 | * Head of DLL of ticket revocation ops |
322 | */ | 321 | */ |
323 | struct TicketRevocationHandle *revocation_list_head; | 322 | struct TicketRevocationHandle *revoke_op_head; |
324 | 323 | ||
325 | /** | 324 | /** |
326 | * Tail of DLL of ticket revocation ops | 325 | * Tail of DLL of ticket revocation ops |
327 | */ | 326 | */ |
328 | struct TicketRevocationHandle *revocation_list_tail; | 327 | struct TicketRevocationHandle *revoke_op_tail; |
329 | }; | 328 | |
329 | /** | ||
330 | * Head of DLL of ticket issue ops | ||
331 | */ | ||
332 | struct TicketIssueHandle *issue_op_head; | ||
333 | |||
334 | /** | ||
335 | * Tail of DLL of ticket issue ops | ||
336 | */ | ||
337 | struct TicketIssueHandle *issue_op_tail; | ||
338 | |||
339 | /** | ||
340 | * Head of DLL of ticket consume ops | ||
341 | */ | ||
342 | struct ConsumeTicketHandle *consume_op_head; | ||
343 | |||
344 | /** | ||
345 | * Tail of DLL of ticket consume ops | ||
346 | */ | ||
347 | struct ConsumeTicketHandle *consume_op_tail; | ||
348 | |||
349 | /** | ||
350 | * Head of DLL of attribute store ops | ||
351 | */ | ||
352 | struct AttributeStoreHandle *store_op_head; | ||
330 | 353 | ||
354 | /** | ||
355 | * Tail of DLL of attribute store ops | ||
356 | */ | ||
357 | struct AttributeStoreHandle *store_op_tail; | ||
331 | 358 | ||
359 | }; | ||
332 | 360 | ||
333 | struct AttributeStoreHandle | 361 | struct AttributeStoreHandle |
334 | { | 362 | { |
363 | /** | ||
364 | * DLL | ||
365 | */ | ||
366 | struct AttributeStoreHandle *next; | ||
367 | |||
368 | /** | ||
369 | * DLL | ||
370 | */ | ||
371 | struct AttributeStoreHandle *prev; | ||
335 | 372 | ||
336 | /** | 373 | /** |
337 | * Client connection | 374 | * Client connection |
@@ -380,6 +417,15 @@ struct ParallelLookup; | |||
380 | 417 | ||
381 | struct ConsumeTicketHandle | 418 | struct ConsumeTicketHandle |
382 | { | 419 | { |
420 | /** | ||
421 | * DLL | ||
422 | */ | ||
423 | struct ConsumeTicketHandle *next; | ||
424 | |||
425 | /** | ||
426 | * DLL | ||
427 | */ | ||
428 | struct ConsumeTicketHandle *prev; | ||
383 | 429 | ||
384 | /** | 430 | /** |
385 | * Client connection | 431 | * Client connection |
@@ -476,12 +522,12 @@ struct TicketRevocationHandle | |||
476 | /** | 522 | /** |
477 | * DLL | 523 | * DLL |
478 | */ | 524 | */ |
479 | struct TicketRevocationHandle *next; | 525 | struct TicketRevocationHandle *prev; |
480 | 526 | ||
481 | /** | 527 | /** |
482 | * DLL | 528 | * DLL |
483 | */ | 529 | */ |
484 | struct TicketRevocationHandle *prev; | 530 | struct TicketRevocationHandle *next; |
485 | 531 | ||
486 | /** | 532 | /** |
487 | * Client connection | 533 | * Client connection |
@@ -541,6 +587,15 @@ struct TicketRevocationHandle | |||
541 | */ | 587 | */ |
542 | struct TicketIssueHandle | 588 | struct TicketIssueHandle |
543 | { | 589 | { |
590 | /** | ||
591 | * DLL | ||
592 | */ | ||
593 | struct TicketIssueHandle *prev; | ||
594 | |||
595 | /** | ||
596 | * DLL | ||
597 | */ | ||
598 | struct TicketIssueHandle *next; | ||
544 | 599 | ||
545 | /** | 600 | /** |
546 | * Client connection | 601 | * Client connection |
@@ -610,6 +665,7 @@ cleanup() | |||
610 | { | 665 | { |
611 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 666 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
612 | "Cleaning up\n"); | 667 | "Cleaning up\n"); |
668 | |||
613 | if (NULL != stats) | 669 | if (NULL != stats) |
614 | { | 670 | { |
615 | GNUNET_STATISTICS_destroy (stats, GNUNET_NO); | 671 | GNUNET_STATISTICS_destroy (stats, GNUNET_NO); |
@@ -799,6 +855,10 @@ create_sym_key_from_ecdh(const struct GNUNET_HashCode *new_key_hash, | |||
799 | return GNUNET_OK; | 855 | return GNUNET_OK; |
800 | } | 856 | } |
801 | 857 | ||
858 | /** | ||
859 | * Cleanup ticket consume handle | ||
860 | * @param handle the handle to clean up | ||
861 | */ | ||
802 | static void | 862 | static void |
803 | cleanup_ticket_issue_handle (struct TicketIssueHandle *handle) | 863 | cleanup_ticket_issue_handle (struct TicketIssueHandle *handle) |
804 | { | 864 | { |
@@ -848,6 +908,9 @@ store_ticket_issue_cont (void *cls, | |||
848 | struct TicketIssueHandle *handle = cls; | 908 | struct TicketIssueHandle *handle = cls; |
849 | 909 | ||
850 | handle->ns_qe = NULL; | 910 | handle->ns_qe = NULL; |
911 | GNUNET_CONTAINER_DLL_remove (handle->client->issue_op_head, | ||
912 | handle->client->issue_op_tail, | ||
913 | handle); | ||
851 | if (GNUNET_SYSERR == success) | 914 | if (GNUNET_SYSERR == success) |
852 | { | 915 | { |
853 | cleanup_ticket_issue_handle (handle); | 916 | cleanup_ticket_issue_handle (handle); |
@@ -887,7 +950,7 @@ serialize_abe_keyinfo2 (const struct GNUNET_IDENTITY_PROVIDER_Ticket *ticket, | |||
887 | ssize_t enc_size; | 950 | ssize_t enc_size; |
888 | 951 | ||
889 | size = GNUNET_ABE_cpabe_serialize_key (rp_key, | 952 | size = GNUNET_ABE_cpabe_serialize_key (rp_key, |
890 | (void**)&serialized_key); | 953 | (void**)&serialized_key); |
891 | attrs_str_len = 0; | 954 | attrs_str_len = 0; |
892 | for (le = attrs->list_head; NULL != le; le = le->next) { | 955 | for (le = attrs->list_head; NULL != le; le = le->next) { |
893 | attrs_str_len += strlen (le->claim->name) + 1; | 956 | attrs_str_len += strlen (le->claim->name) + 1; |
@@ -978,7 +1041,7 @@ issue_ticket_after_abe_bootstrap (void *cls, | |||
978 | } | 1041 | } |
979 | attrs[i] = NULL; | 1042 | attrs[i] = NULL; |
980 | rp_key = GNUNET_ABE_cpabe_create_key (abe_key, | 1043 | rp_key = GNUNET_ABE_cpabe_create_key (abe_key, |
981 | attrs); | 1044 | attrs); |
982 | 1045 | ||
983 | //TODO review this wireformat | 1046 | //TODO review this wireformat |
984 | code_record_len = serialize_abe_keyinfo2 (&ih->ticket, | 1047 | code_record_len = serialize_abe_keyinfo2 (&ih->ticket, |
@@ -1009,7 +1072,7 @@ issue_ticket_after_abe_bootstrap (void *cls, | |||
1009 | GNUNET_free (attrs); | 1072 | GNUNET_free (attrs); |
1010 | GNUNET_free (code_record_data); | 1073 | GNUNET_free (code_record_data); |
1011 | GNUNET_ABE_cpabe_delete_key (rp_key, | 1074 | GNUNET_ABE_cpabe_delete_key (rp_key, |
1012 | GNUNET_YES); | 1075 | GNUNET_YES); |
1013 | GNUNET_ABE_cpabe_delete_master_key (abe_key); | 1076 | GNUNET_ABE_cpabe_delete_master_key (abe_key); |
1014 | } | 1077 | } |
1015 | 1078 | ||
@@ -1050,6 +1113,9 @@ handle_issue_ticket_message (void *cls, | |||
1050 | ih->ticket.rnd = | 1113 | ih->ticket.rnd = |
1051 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, | 1114 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, |
1052 | UINT64_MAX); | 1115 | UINT64_MAX); |
1116 | GNUNET_CONTAINER_DLL_insert (idp->issue_op_head, | ||
1117 | idp->issue_op_tail, | ||
1118 | ih); | ||
1053 | bootstrap_abe (&ih->identity, &issue_ticket_after_abe_bootstrap, ih, GNUNET_NO); | 1119 | bootstrap_abe (&ih->identity, &issue_ticket_after_abe_bootstrap, ih, GNUNET_NO); |
1054 | GNUNET_SERVICE_client_continue (idp->client); | 1120 | GNUNET_SERVICE_client_continue (idp->client); |
1055 | 1121 | ||
@@ -1100,8 +1166,8 @@ send_revocation_finished (struct TicketRevocationHandle *rh, | |||
1100 | trm->success = htonl (success); | 1166 | trm->success = htonl (success); |
1101 | GNUNET_MQ_send (rh->client->mq, | 1167 | GNUNET_MQ_send (rh->client->mq, |
1102 | env); | 1168 | env); |
1103 | GNUNET_CONTAINER_DLL_remove (rh->client->revocation_list_head, | 1169 | GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head, |
1104 | rh->client->revocation_list_tail, | 1170 | rh->client->revoke_op_tail, |
1105 | rh); | 1171 | rh); |
1106 | } | 1172 | } |
1107 | 1173 | ||
@@ -1142,6 +1208,9 @@ reissue_ticket_cont (void *cls, | |||
1142 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", | 1208 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", |
1143 | "Unknown Error\n"); | 1209 | "Unknown Error\n"); |
1144 | send_revocation_finished (rh, GNUNET_SYSERR); | 1210 | send_revocation_finished (rh, GNUNET_SYSERR); |
1211 | GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head, | ||
1212 | rh->client->revoke_op_tail, | ||
1213 | rh); | ||
1145 | cleanup_revoke_ticket_handle (rh); | 1214 | cleanup_revoke_ticket_handle (rh); |
1146 | return; | 1215 | return; |
1147 | } | 1216 | } |
@@ -1248,7 +1317,7 @@ ticket_reissue_proc (void *cls, | |||
1248 | } | 1317 | } |
1249 | attr_arr[i] = NULL; | 1318 | attr_arr[i] = NULL; |
1250 | rp_key = GNUNET_ABE_cpabe_create_key (rh->abe_key, | 1319 | rp_key = GNUNET_ABE_cpabe_create_key (rh->abe_key, |
1251 | attr_arr); | 1320 | attr_arr); |
1252 | 1321 | ||
1253 | //TODO review this wireformat | 1322 | //TODO review this wireformat |
1254 | code_record_len = serialize_abe_keyinfo2 (ticket, | 1323 | code_record_len = serialize_abe_keyinfo2 (ticket, |
@@ -1307,6 +1376,9 @@ revocation_reissue_tickets (struct TicketRevocationHandle *rh) | |||
1307 | if (GNUNET_NO == ret) | 1376 | if (GNUNET_NO == ret) |
1308 | { | 1377 | { |
1309 | send_revocation_finished (rh, GNUNET_OK); | 1378 | send_revocation_finished (rh, GNUNET_OK); |
1379 | GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head, | ||
1380 | rh->client->revoke_op_tail, | ||
1381 | rh); | ||
1310 | cleanup_revoke_ticket_handle (rh); | 1382 | cleanup_revoke_ticket_handle (rh); |
1311 | return; | 1383 | return; |
1312 | } | 1384 | } |
@@ -1322,6 +1394,9 @@ check_attr_error (void *cls) | |||
1322 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1394 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1323 | "Unable to check for existing attribute\n"); | 1395 | "Unable to check for existing attribute\n"); |
1324 | send_revocation_finished (rh, GNUNET_SYSERR); | 1396 | send_revocation_finished (rh, GNUNET_SYSERR); |
1397 | GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head, | ||
1398 | rh->client->revoke_op_tail, | ||
1399 | rh); | ||
1325 | cleanup_revoke_ticket_handle (rh); | 1400 | cleanup_revoke_ticket_handle (rh); |
1326 | } | 1401 | } |
1327 | 1402 | ||
@@ -1352,7 +1427,7 @@ check_attr_cb (void *cls, | |||
1352 | size_t buf_size; | 1427 | size_t buf_size; |
1353 | char* policy; | 1428 | char* policy; |
1354 | uint32_t attr_ver; | 1429 | uint32_t attr_ver; |
1355 | 1430 | ||
1356 | if (1 != rd_count) { | 1431 | if (1 != rd_count) { |
1357 | GNUNET_SCHEDULER_add_now (&reenc_next_attribute, | 1432 | GNUNET_SCHEDULER_add_now (&reenc_next_attribute, |
1358 | rh); | 1433 | rh); |
@@ -1385,6 +1460,9 @@ check_attr_cb (void *cls, | |||
1385 | policy); | 1460 | policy); |
1386 | GNUNET_free (policy); | 1461 | GNUNET_free (policy); |
1387 | send_revocation_finished (rh, GNUNET_SYSERR); | 1462 | send_revocation_finished (rh, GNUNET_SYSERR); |
1463 | GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head, | ||
1464 | rh->client->revoke_op_tail, | ||
1465 | rh); | ||
1388 | cleanup_revoke_ticket_handle (rh); | 1466 | cleanup_revoke_ticket_handle (rh); |
1389 | return; | 1467 | return; |
1390 | } | 1468 | } |
@@ -1495,6 +1573,9 @@ process_attributes_to_update (void *cls, | |||
1495 | { | 1573 | { |
1496 | /* No attributes to reencrypt */ | 1574 | /* No attributes to reencrypt */ |
1497 | send_revocation_finished (rh, GNUNET_OK); | 1575 | send_revocation_finished (rh, GNUNET_OK); |
1576 | GNUNET_CONTAINER_DLL_remove (rh->client->revoke_op_head, | ||
1577 | rh->client->revoke_op_tail, | ||
1578 | rh); | ||
1498 | cleanup_revoke_ticket_handle (rh); | 1579 | cleanup_revoke_ticket_handle (rh); |
1499 | return; | 1580 | return; |
1500 | } else { | 1581 | } else { |
@@ -1553,15 +1634,18 @@ handle_revoke_ticket_message (void *cls, | |||
1553 | rh->identity = rm->identity; | 1634 | rh->identity = rm->identity; |
1554 | GNUNET_CRYPTO_ecdsa_key_get_public (&rh->identity, | 1635 | GNUNET_CRYPTO_ecdsa_key_get_public (&rh->identity, |
1555 | &rh->ticket.identity); | 1636 | &rh->ticket.identity); |
1556 | GNUNET_CONTAINER_DLL_insert (idp->revocation_list_head, | 1637 | GNUNET_CONTAINER_DLL_insert (idp->revoke_op_head, |
1557 | idp->revocation_list_tail, | 1638 | idp->revoke_op_tail, |
1558 | rh); | 1639 | rh); |
1559 | bootstrap_abe (&rh->identity, &get_ticket_after_abe_bootstrap, rh, GNUNET_NO); | 1640 | bootstrap_abe (&rh->identity, &get_ticket_after_abe_bootstrap, rh, GNUNET_NO); |
1560 | GNUNET_SERVICE_client_continue (idp->client); | 1641 | GNUNET_SERVICE_client_continue (idp->client); |
1561 | 1642 | ||
1562 | } | 1643 | } |
1563 | 1644 | ||
1564 | 1645 | /** | |
1646 | * Cleanup ticket consume handle | ||
1647 | * @param handle the handle to clean up | ||
1648 | */ | ||
1565 | static void | 1649 | static void |
1566 | cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle) | 1650 | cleanup_consume_ticket_handle (struct ConsumeTicketHandle *handle) |
1567 | { | 1651 | { |
@@ -1695,6 +1779,9 @@ process_parallel_lookup2 (void *cls, uint32_t rd_count, | |||
1695 | GNUNET_IDENTITY_ATTRIBUTE_list_serialize (handle->attrs, | 1779 | GNUNET_IDENTITY_ATTRIBUTE_list_serialize (handle->attrs, |
1696 | data_tmp); | 1780 | data_tmp); |
1697 | GNUNET_MQ_send (handle->client->mq, env); | 1781 | GNUNET_MQ_send (handle->client->mq, env); |
1782 | GNUNET_CONTAINER_DLL_remove (handle->client->consume_op_head, | ||
1783 | handle->client->consume_op_tail, | ||
1784 | handle); | ||
1698 | cleanup_consume_ticket_handle (handle); | 1785 | cleanup_consume_ticket_handle (handle); |
1699 | } | 1786 | } |
1700 | 1787 | ||
@@ -1706,7 +1793,7 @@ abort_parallel_lookups2 (void *cls) | |||
1706 | struct ParallelLookup *tmp; | 1793 | struct ParallelLookup *tmp; |
1707 | struct AttributeResultMessage *arm; | 1794 | struct AttributeResultMessage *arm; |
1708 | struct GNUNET_MQ_Envelope *env; | 1795 | struct GNUNET_MQ_Envelope *env; |
1709 | 1796 | ||
1710 | handle->kill_task = NULL; | 1797 | handle->kill_task = NULL; |
1711 | for (lu = handle->parallel_lookups_head; | 1798 | for (lu = handle->parallel_lookups_head; |
1712 | NULL != lu;) { | 1799 | NULL != lu;) { |
@@ -1749,6 +1836,9 @@ process_consume_abe_key (void *cls, uint32_t rd_count, | |||
1749 | "Number of keys %d != 1.", | 1836 | "Number of keys %d != 1.", |
1750 | rd_count); | 1837 | rd_count); |
1751 | cleanup_consume_ticket_handle (handle); | 1838 | cleanup_consume_ticket_handle (handle); |
1839 | GNUNET_CONTAINER_DLL_remove (handle->client->consume_op_head, | ||
1840 | handle->client->consume_op_tail, | ||
1841 | handle); | ||
1752 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 1842 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
1753 | return; | 1843 | return; |
1754 | } | 1844 | } |
@@ -1847,13 +1937,23 @@ handle_consume_ticket_message (void *cls, | |||
1847 | GNUNET_GNS_LO_DEFAULT, | 1937 | GNUNET_GNS_LO_DEFAULT, |
1848 | &process_consume_abe_key, | 1938 | &process_consume_abe_key, |
1849 | ch); | 1939 | ch); |
1940 | GNUNET_CONTAINER_DLL_insert (idp->consume_op_head, | ||
1941 | idp->consume_op_tail, | ||
1942 | ch); | ||
1850 | GNUNET_free (rnd_label); | 1943 | GNUNET_free (rnd_label); |
1851 | GNUNET_SERVICE_client_continue (idp->client); | 1944 | GNUNET_SERVICE_client_continue (idp->client); |
1852 | } | 1945 | } |
1853 | 1946 | ||
1947 | /** | ||
1948 | * Cleanup attribute store handle | ||
1949 | * | ||
1950 | * @param handle handle to clean up | ||
1951 | */ | ||
1854 | static void | 1952 | static void |
1855 | cleanup_as_handle (struct AttributeStoreHandle *handle) | 1953 | cleanup_as_handle (struct AttributeStoreHandle *handle) |
1856 | { | 1954 | { |
1955 | if (NULL != handle->ns_qe) | ||
1956 | GNUNET_NAMESTORE_cancel (handle->ns_qe); | ||
1857 | if (NULL != handle->claim) | 1957 | if (NULL != handle->claim) |
1858 | GNUNET_free (handle->claim); | 1958 | GNUNET_free (handle->claim); |
1859 | if (NULL != handle->abe_key) | 1959 | if (NULL != handle->abe_key) |
@@ -1869,6 +1969,11 @@ attr_store_cont (void *cls, | |||
1869 | struct AttributeStoreHandle *as_handle = cls; | 1969 | struct AttributeStoreHandle *as_handle = cls; |
1870 | struct GNUNET_MQ_Envelope *env; | 1970 | struct GNUNET_MQ_Envelope *env; |
1871 | struct AttributeStoreResultMessage *acr_msg; | 1971 | struct AttributeStoreResultMessage *acr_msg; |
1972 | |||
1973 | as_handle->ns_qe = NULL; | ||
1974 | GNUNET_CONTAINER_DLL_remove (as_handle->client->store_op_head, | ||
1975 | as_handle->client->store_op_tail, | ||
1976 | as_handle); | ||
1872 | 1977 | ||
1873 | if (GNUNET_SYSERR == success) | 1978 | if (GNUNET_SYSERR == success) |
1874 | { | 1979 | { |
@@ -1931,6 +2036,10 @@ attr_store_task (void *cls) | |||
1931 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 2036 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1932 | "Failed to encrypt with policy %s\n", | 2037 | "Failed to encrypt with policy %s\n", |
1933 | policy); | 2038 | policy); |
2039 | GNUNET_CONTAINER_DLL_remove (as_handle->client->store_op_head, | ||
2040 | as_handle->client->store_op_tail, | ||
2041 | as_handle); | ||
2042 | |||
1934 | cleanup_as_handle (as_handle); | 2043 | cleanup_as_handle (as_handle); |
1935 | GNUNET_free (buf); | 2044 | GNUNET_free (buf); |
1936 | GNUNET_free (policy); | 2045 | GNUNET_free (policy); |
@@ -2015,17 +2124,17 @@ handle_attribute_store_message (void *cls, | |||
2015 | 2124 | ||
2016 | GNUNET_SERVICE_client_continue (idp->client); | 2125 | GNUNET_SERVICE_client_continue (idp->client); |
2017 | as_handle->client = idp; | 2126 | as_handle->client = idp; |
2127 | GNUNET_CONTAINER_DLL_insert (idp->store_op_head, | ||
2128 | idp->store_op_tail, | ||
2129 | as_handle); | ||
2018 | bootstrap_abe (&as_handle->identity, &store_after_abe_bootstrap, as_handle, GNUNET_NO); | 2130 | bootstrap_abe (&as_handle->identity, &store_after_abe_bootstrap, as_handle, GNUNET_NO); |
2019 | } | 2131 | } |
2020 | 2132 | ||
2021 | static void | 2133 | static void |
2022 | cleanup_iter_handle (struct AttributeIterator *ai) | 2134 | cleanup_attribute_iter_handle (struct AttributeIterator *ai) |
2023 | { | 2135 | { |
2024 | if (NULL != ai->abe_key) | 2136 | if (NULL != ai->abe_key) |
2025 | GNUNET_ABE_cpabe_delete_master_key (ai->abe_key); | 2137 | GNUNET_ABE_cpabe_delete_master_key (ai->abe_key); |
2026 | GNUNET_CONTAINER_DLL_remove (ai->client->op_head, | ||
2027 | ai->client->op_tail, | ||
2028 | ai); | ||
2029 | GNUNET_free (ai); | 2138 | GNUNET_free (ai); |
2030 | } | 2139 | } |
2031 | 2140 | ||
@@ -2036,7 +2145,10 @@ attr_iter_error (void *cls) | |||
2036 | //TODO | 2145 | //TODO |
2037 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 2146 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
2038 | "Failed to iterate over attributes\n"); | 2147 | "Failed to iterate over attributes\n"); |
2039 | cleanup_iter_handle (ai); | 2148 | GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head, |
2149 | ai->client->attr_iter_tail, | ||
2150 | ai); | ||
2151 | cleanup_attribute_iter_handle (ai); | ||
2040 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 2152 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
2041 | } | 2153 | } |
2042 | 2154 | ||
@@ -2052,7 +2164,10 @@ attr_iter_finished (void *cls) | |||
2052 | arm->id = htonl (ai->request_id); | 2164 | arm->id = htonl (ai->request_id); |
2053 | arm->attr_len = htons (0); | 2165 | arm->attr_len = htons (0); |
2054 | GNUNET_MQ_send (ai->client->mq, env); | 2166 | GNUNET_MQ_send (ai->client->mq, env); |
2055 | cleanup_iter_handle (ai); | 2167 | GNUNET_CONTAINER_DLL_remove (ai->client->attr_iter_head, |
2168 | ai->client->attr_iter_tail, | ||
2169 | ai); | ||
2170 | cleanup_attribute_iter_handle (ai); | ||
2056 | } | 2171 | } |
2057 | 2172 | ||
2058 | static void | 2173 | static void |
@@ -2163,8 +2278,8 @@ handle_iteration_start (void *cls, | |||
2163 | ai->client = idp; | 2278 | ai->client = idp; |
2164 | ai->identity = ais_msg->identity; | 2279 | ai->identity = ais_msg->identity; |
2165 | 2280 | ||
2166 | GNUNET_CONTAINER_DLL_insert (idp->op_head, | 2281 | GNUNET_CONTAINER_DLL_insert (idp->attr_iter_head, |
2167 | idp->op_tail, | 2282 | idp->attr_iter_tail, |
2168 | ai); | 2283 | ai); |
2169 | bootstrap_abe (&ai->identity, &iterate_after_abe_bootstrap, ai, GNUNET_NO); | 2284 | bootstrap_abe (&ai->identity, &iterate_after_abe_bootstrap, ai, GNUNET_NO); |
2170 | GNUNET_SERVICE_client_continue (idp->client); | 2285 | GNUNET_SERVICE_client_continue (idp->client); |
@@ -2183,7 +2298,7 @@ handle_iteration_stop (void *cls, | |||
2183 | "Received `%s' message\n", | 2298 | "Received `%s' message\n", |
2184 | "ATTRIBUTE_ITERATION_STOP"); | 2299 | "ATTRIBUTE_ITERATION_STOP"); |
2185 | rid = ntohl (ais_msg->id); | 2300 | rid = ntohl (ais_msg->id); |
2186 | for (ai = idp->op_head; NULL != ai; ai = ai->next) | 2301 | for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next) |
2187 | if (ai->request_id == rid) | 2302 | if (ai->request_id == rid) |
2188 | break; | 2303 | break; |
2189 | if (NULL == ai) | 2304 | if (NULL == ai) |
@@ -2192,8 +2307,8 @@ handle_iteration_stop (void *cls, | |||
2192 | GNUNET_SERVICE_client_drop (idp->client); | 2307 | GNUNET_SERVICE_client_drop (idp->client); |
2193 | return; | 2308 | return; |
2194 | } | 2309 | } |
2195 | GNUNET_CONTAINER_DLL_remove (idp->op_head, | 2310 | GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, |
2196 | idp->op_tail, | 2311 | idp->attr_iter_tail, |
2197 | ai); | 2312 | ai); |
2198 | GNUNET_free (ai); | 2313 | GNUNET_free (ai); |
2199 | GNUNET_SERVICE_client_continue (idp->client); | 2314 | GNUNET_SERVICE_client_continue (idp->client); |
@@ -2211,7 +2326,7 @@ handle_iteration_next (void *cls, | |||
2211 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 2326 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
2212 | "Received ATTRIBUTE_ITERATION_NEXT message\n"); | 2327 | "Received ATTRIBUTE_ITERATION_NEXT message\n"); |
2213 | rid = ntohl (ais_msg->id); | 2328 | rid = ntohl (ais_msg->id); |
2214 | for (ai = idp->op_head; NULL != ai; ai = ai->next) | 2329 | for (ai = idp->attr_iter_head; NULL != ai; ai = ai->next) |
2215 | if (ai->request_id == rid) | 2330 | if (ai->request_id == rid) |
2216 | break; | 2331 | break; |
2217 | if (NULL == ai) | 2332 | if (NULL == ai) |
@@ -2530,6 +2645,9 @@ client_disconnect_cb (void *cls, | |||
2530 | struct AttributeIterator *ai; | 2645 | struct AttributeIterator *ai; |
2531 | struct TicketIteration *ti; | 2646 | struct TicketIteration *ti; |
2532 | struct TicketRevocationHandle *rh; | 2647 | struct TicketRevocationHandle *rh; |
2648 | struct TicketIssueHandle *iss; | ||
2649 | struct ConsumeTicketHandle *ct; | ||
2650 | struct AttributeStoreHandle *as; | ||
2533 | 2651 | ||
2534 | //TODO other operations | 2652 | //TODO other operations |
2535 | 2653 | ||
@@ -2537,17 +2655,39 @@ client_disconnect_cb (void *cls, | |||
2537 | "Client %p disconnected\n", | 2655 | "Client %p disconnected\n", |
2538 | client); | 2656 | client); |
2539 | 2657 | ||
2540 | while (NULL != (ai = idp->op_head)) | 2658 | while (NULL != (iss = idp->issue_op_head)) |
2659 | { | ||
2660 | GNUNET_CONTAINER_DLL_remove (idp->issue_op_head, | ||
2661 | idp->issue_op_tail, | ||
2662 | iss); | ||
2663 | cleanup_ticket_issue_handle (iss); | ||
2664 | } | ||
2665 | while (NULL != (ct = idp->consume_op_head)) | ||
2666 | { | ||
2667 | GNUNET_CONTAINER_DLL_remove (idp->consume_op_head, | ||
2668 | idp->consume_op_tail, | ||
2669 | ct); | ||
2670 | cleanup_consume_ticket_handle (ct); | ||
2671 | } | ||
2672 | while (NULL != (as = idp->store_op_head)) | ||
2673 | { | ||
2674 | GNUNET_CONTAINER_DLL_remove (idp->store_op_head, | ||
2675 | idp->store_op_tail, | ||
2676 | as); | ||
2677 | cleanup_as_handle (as); | ||
2678 | } | ||
2679 | |||
2680 | while (NULL != (ai = idp->attr_iter_head)) | ||
2541 | { | 2681 | { |
2542 | GNUNET_CONTAINER_DLL_remove (idp->op_head, | 2682 | GNUNET_CONTAINER_DLL_remove (idp->attr_iter_head, |
2543 | idp->op_tail, | 2683 | idp->attr_iter_tail, |
2544 | ai); | 2684 | ai); |
2545 | GNUNET_free (ai); | 2685 | cleanup_attribute_iter_handle (ai); |
2546 | } | 2686 | } |
2547 | while (NULL != (rh = idp->revocation_list_head)) | 2687 | while (NULL != (rh = idp->revoke_op_head)) |
2548 | { | 2688 | { |
2549 | GNUNET_CONTAINER_DLL_remove (idp->revocation_list_head, | 2689 | GNUNET_CONTAINER_DLL_remove (idp->revoke_op_head, |
2550 | idp->revocation_list_tail, | 2690 | idp->revoke_op_tail, |
2551 | rh); | 2691 | rh); |
2552 | cleanup_revoke_ticket_handle (rh); | 2692 | cleanup_revoke_ticket_handle (rh); |
2553 | } | 2693 | } |