diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2016-07-12 18:00:27 +0000 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2016-07-12 18:00:27 +0000 |
commit | 458574dc2ee09ba6e11def8d31fee5ce79093bdf (patch) | |
tree | 02027fc0ae6b40a7cb4156a711ee404c2932155c /src/identity-provider | |
parent | 97d142230b783a3d667cdfedb7fc0397ce831c66 (diff) | |
download | gnunet-458574dc2ee09ba6e11def8d31fee5ce79093bdf.tar.gz gnunet-458574dc2ee09ba6e11def8d31fee5ce79093bdf.zip |
-fix fixmes
Diffstat (limited to 'src/identity-provider')
-rw-r--r-- | src/identity-provider/gnunet-service-identity-provider.c | 74 |
1 files changed, 44 insertions, 30 deletions
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c index 228e6cdc5..80c15f85f 100644 --- a/src/identity-provider/gnunet-service-identity-provider.c +++ b/src/identity-provider/gnunet-service-identity-provider.c | |||
@@ -534,9 +534,18 @@ clear_ego_attrs (void *cls, | |||
534 | static void | 534 | static void |
535 | token_collect_error_cb (void *cls) | 535 | token_collect_error_cb (void *cls) |
536 | { | 536 | { |
537 | // struct EgoEntry *ego_entry = cls; | 537 | struct EgoEntry *ego_entry = cls; |
538 | |||
539 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
540 | ">>> Updating Ego failed!\n"); | ||
541 | //Clear attribute map for ego | ||
542 | GNUNET_CONTAINER_multihashmap_iterate (ego_entry->attr_map, | ||
543 | &clear_ego_attrs, | ||
544 | ego_entry); | ||
545 | GNUNET_CONTAINER_multihashmap_clear (ego_entry->attr_map); | ||
546 | update_task = GNUNET_SCHEDULER_add_now (&update_identities, | ||
547 | ego_entry->next); | ||
538 | 548 | ||
539 | GNUNET_assert (0); // FIXME: handle properly! | ||
540 | } | 549 | } |
541 | 550 | ||
542 | 551 | ||
@@ -621,16 +630,20 @@ token_collect (void *cls, | |||
621 | rd_exp = token_record->expiration_time; | 630 | rd_exp = token_record->expiration_time; |
622 | 631 | ||
623 | GNUNET_SCHEDULER_add_now (&handle_token_update, | 632 | GNUNET_SCHEDULER_add_now (&handle_token_update, |
624 | ego_entry); | 633 | ego_entry); |
625 | } | 634 | } |
626 | 635 | ||
627 | 636 | ||
628 | static void | 637 | static void |
629 | attribute_collect_error_cb (void *cls) | 638 | attribute_collect_error_cb (void *cls) |
630 | { | 639 | { |
631 | // struct EgoEntry *ego_entry = cls; | 640 | struct EgoEntry *ego_entry = cls; |
632 | 641 | ||
633 | GNUNET_assert (0); // FIXME: handle properly! | 642 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
643 | ">>> Updating Attributes failed!\n"); | ||
644 | ego_entry->attributes_dirty = GNUNET_NO; | ||
645 | update_task = GNUNET_SCHEDULER_add_now (&update_identities, | ||
646 | ego_entry); | ||
634 | } | 647 | } |
635 | 648 | ||
636 | 649 | ||
@@ -685,8 +698,8 @@ attribute_collect (void *cls, | |||
685 | if (rd->record_type == GNUNET_GNSRECORD_TYPE_ID_ATTR) | 698 | if (rd->record_type == GNUNET_GNSRECORD_TYPE_ID_ATTR) |
686 | { | 699 | { |
687 | val_str = GNUNET_GNSRECORD_value_to_string (rd->record_type, | 700 | val_str = GNUNET_GNSRECORD_value_to_string (rd->record_type, |
688 | rd->data, | 701 | rd->data, |
689 | rd->data_size); | 702 | rd->data_size); |
690 | attr = GNUNET_malloc (sizeof (struct TokenAttr)); | 703 | attr = GNUNET_malloc (sizeof (struct TokenAttr)); |
691 | attr->name = GNUNET_strdup (lbl); | 704 | attr->name = GNUNET_strdup (lbl); |
692 | val = GNUNET_malloc (sizeof (struct TokenAttrValue)); | 705 | val = GNUNET_malloc (sizeof (struct TokenAttrValue)); |
@@ -721,9 +734,9 @@ attribute_collect (void *cls, | |||
721 | } | 734 | } |
722 | } | 735 | } |
723 | GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (ego_entry->attr_map, | 736 | GNUNET_assert (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (ego_entry->attr_map, |
724 | &key, | 737 | &key, |
725 | attr, | 738 | attr, |
726 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); | 739 | GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY)); |
727 | GNUNET_NAMESTORE_zone_iterator_next (ns_it); | 740 | GNUNET_NAMESTORE_zone_iterator_next (ns_it); |
728 | } | 741 | } |
729 | 742 | ||
@@ -795,7 +808,7 @@ init_cont () | |||
795 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, ">>> Starting Service\n"); | 808 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, ">>> Starting Service\n"); |
796 | //Initially iterate all itenties and refresh all tokens | 809 | //Initially iterate all itenties and refresh all tokens |
797 | update_task = GNUNET_SCHEDULER_add_now (&update_identities, | 810 | update_task = GNUNET_SCHEDULER_add_now (&update_identities, |
798 | ego_head); | 811 | ego_head); |
799 | } | 812 | } |
800 | 813 | ||
801 | 814 | ||
@@ -952,7 +965,7 @@ cleanup_issue_handle (struct IssueHandle *handle) | |||
952 | if (NULL != handle->scopes) | 965 | if (NULL != handle->scopes) |
953 | GNUNET_free (handle->scopes); | 966 | GNUNET_free (handle->scopes); |
954 | if (NULL != handle->token) | 967 | if (NULL != handle->token) |
955 | token_destroy (handle->token); | 968 | token_destroy (handle->token); |
956 | if (NULL != handle->ticket) | 969 | if (NULL != handle->ticket) |
957 | ticket_destroy (handle->ticket); | 970 | ticket_destroy (handle->ticket); |
958 | if (NULL != handle->label) | 971 | if (NULL != handle->label) |
@@ -1001,8 +1014,8 @@ store_token_issue_cont (void *cls, | |||
1001 | return; | 1014 | return; |
1002 | } | 1015 | } |
1003 | irm = create_issue_result_message (handle->label, | 1016 | irm = create_issue_result_message (handle->label, |
1004 | ticket_str, | 1017 | ticket_str, |
1005 | token_str); | 1018 | token_str); |
1006 | GNUNET_SERVER_notification_context_unicast (nc, | 1019 | GNUNET_SERVER_notification_context_unicast (nc, |
1007 | handle->client, | 1020 | handle->client, |
1008 | &irm->header, | 1021 | &irm->header, |
@@ -1016,16 +1029,9 @@ store_token_issue_cont (void *cls, | |||
1016 | 1029 | ||
1017 | 1030 | ||
1018 | /** | 1031 | /** |
1019 | * Build a GNUid token for identity | 1032 | * Build a token and store it |
1020 | * | 1033 | * |
1021 | * FIXME: doxygen is very wrong here! | 1034 | * @param cls the IssueHandle |
1022 | * | ||
1023 | * @param handle the handle | ||
1024 | * @param ego_entry the ego to build the token for | ||
1025 | * @param name name of the ego | ||
1026 | * @param token_aud token audience | ||
1027 | * @param token the resulting gnuid token | ||
1028 | * @return identifier string of token (label) | ||
1029 | */ | 1035 | */ |
1030 | static void | 1036 | static void |
1031 | sign_and_return_token (void *cls) | 1037 | sign_and_return_token (void *cls) |
@@ -1111,9 +1117,11 @@ sign_and_return_token (void *cls) | |||
1111 | static void | 1117 | static void |
1112 | attr_collect_error (void *cls) | 1118 | attr_collect_error (void *cls) |
1113 | { | 1119 | { |
1114 | // struct IssueHandle *handle = cls; | 1120 | struct IssueHandle *handle = cls; |
1115 | 1121 | ||
1116 | GNUNET_assert (0); // FIXME: handle error! | 1122 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Adding attribute Error!\n"); |
1123 | handle->ns_it = NULL; | ||
1124 | GNUNET_SCHEDULER_add_now (&sign_and_return_token, handle); | ||
1117 | } | 1125 | } |
1118 | 1126 | ||
1119 | 1127 | ||
@@ -1324,9 +1332,10 @@ handle_exchange_message (void *cls, | |||
1324 | static void | 1332 | static void |
1325 | find_existing_token_error (void *cls) | 1333 | find_existing_token_error (void *cls) |
1326 | { | 1334 | { |
1327 | // struct IssueHandle *handle = cls; | 1335 | struct IssueHandle *handle = cls; |
1328 | 1336 | cleanup_issue_handle (handle); | |
1329 | GNUNET_assert (0); // FIXME: handle properly | 1337 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Error looking for existing token\n"); |
1338 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | ||
1330 | } | 1339 | } |
1331 | 1340 | ||
1332 | 1341 | ||
@@ -1508,8 +1517,13 @@ handle_issue_message (void *cls, | |||
1508 | issue_handle = GNUNET_malloc (sizeof (struct IssueHandle)); | 1517 | issue_handle = GNUNET_malloc (sizeof (struct IssueHandle)); |
1509 | issue_handle->attr_map = GNUNET_CONTAINER_multihashmap_create (5, | 1518 | issue_handle->attr_map = GNUNET_CONTAINER_multihashmap_create (5, |
1510 | GNUNET_NO); | 1519 | GNUNET_NO); |
1511 | /* FIXME: check that scopes is 0-termianted, Out-of-bounds access | 1520 | if ('\0' != scopes[size - sizeof (struct GNUNET_IDENTITY_PROVIDER_IssueMessage) - 1]) |
1512 | possible here!!! */ | 1521 | { |
1522 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Malformed scopes received!\n"); | ||
1523 | GNUNET_break (0); | ||
1524 | GNUNET_SERVER_receive_done (client, GNUNET_SYSERR); | ||
1525 | return; | ||
1526 | } | ||
1513 | scopes_tmp = GNUNET_strdup (scopes); | 1527 | scopes_tmp = GNUNET_strdup (scopes); |
1514 | scope = strtok(scopes_tmp, ","); | 1528 | scope = strtok(scopes_tmp, ","); |
1515 | for (; NULL != scope; scope = strtok (NULL, ",")) | 1529 | for (; NULL != scope; scope = strtok (NULL, ",")) |