diff options
author | Christian Grothoff <christian@grothoff.org> | 2016-04-09 23:14:03 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2016-04-09 23:14:03 +0000 |
commit | 29e6158507a0758192075ac6ece7ba8e75ddc49a (patch) | |
tree | b91ded48da322f8ba4c9bb0f5504228aa036c2d1 /src/identity-provider | |
parent | 5dfcb058ab5db9ae0c4b147d8a99c64ca0980028 (diff) | |
download | gnunet-29e6158507a0758192075ac6ece7ba8e75ddc49a.tar.gz gnunet-29e6158507a0758192075ac6ece7ba8e75ddc49a.zip |
small API change: do no longer pass rarely needed GNUNET_SCHEDULER_TaskContext to all scheduler tasks; instead, allow the relatively few tasks that need it to obtain the context via GNUNET_SCHEDULER_get_task_context()
Diffstat (limited to 'src/identity-provider')
-rw-r--r-- | src/identity-provider/gnunet-service-identity-provider.c | 67 | ||||
-rw-r--r-- | src/identity-provider/identity_provider_api.c | 11 | ||||
-rw-r--r-- | src/identity-provider/plugin_rest_identity_provider.c | 38 |
3 files changed, 51 insertions, 65 deletions
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c index 3328035e6..59e678b24 100644 --- a/src/identity-provider/gnunet-service-identity-provider.c +++ b/src/identity-provider/gnunet-service-identity-provider.c | |||
@@ -182,7 +182,7 @@ struct ExchangeHandle | |||
182 | * LookupRequest | 182 | * LookupRequest |
183 | */ | 183 | */ |
184 | struct GNUNET_GNS_LookupRequest *lookup_request; | 184 | struct GNUNET_GNS_LookupRequest *lookup_request; |
185 | 185 | ||
186 | /** | 186 | /** |
187 | * Audience Key | 187 | * Audience Key |
188 | */ | 188 | */ |
@@ -324,11 +324,9 @@ store_token_cont (void *cls, | |||
324 | * removes deleted attributes and expiration times. | 324 | * removes deleted attributes and expiration times. |
325 | * | 325 | * |
326 | * @param cls the ego entry | 326 | * @param cls the ego entry |
327 | * @param tc task context | ||
328 | */ | 327 | */ |
329 | static void | 328 | static void |
330 | handle_token_update (void *cls, | 329 | handle_token_update (void *cls) |
331 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
332 | { | 330 | { |
333 | char *token_metadata; | 331 | char *token_metadata; |
334 | char *write_ptr; | 332 | char *write_ptr; |
@@ -428,13 +426,13 @@ handle_token_update (void *cls, | |||
428 | attr->name, | 426 | attr->name, |
429 | attr->val_head->value); | 427 | attr->val_head->value); |
430 | } | 428 | } |
431 | else | 429 | else |
432 | { | 430 | { |
433 | GNUNET_CRYPTO_hash (attr->name, | 431 | GNUNET_CRYPTO_hash (attr->name, |
434 | strlen (attr->name), | 432 | strlen (attr->name), |
435 | &key_hash); | 433 | &key_hash); |
436 | //Check if attr still exists. omit of not | 434 | //Check if attr still exists. omit of not |
437 | if (GNUNET_NO != | 435 | if (GNUNET_NO != |
438 | GNUNET_CONTAINER_multihashmap_contains (ego_entry->attr_map, | 436 | GNUNET_CONTAINER_multihashmap_contains (ego_entry->attr_map, |
439 | &key_hash)) | 437 | &key_hash)) |
440 | { | 438 | { |
@@ -497,8 +495,7 @@ handle_token_update (void *cls, | |||
497 | } | 495 | } |
498 | 496 | ||
499 | static void | 497 | static void |
500 | update_identities(void *cls, | 498 | update_identities(void *cls); |
501 | const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
502 | 499 | ||
503 | /** | 500 | /** |
504 | * | 501 | * |
@@ -568,7 +565,7 @@ token_collect (void *cls, | |||
568 | GNUNET_CONTAINER_multihashmap_clear (ego_entry->attr_map); | 565 | GNUNET_CONTAINER_multihashmap_clear (ego_entry->attr_map); |
569 | update_task = GNUNET_SCHEDULER_add_now (&update_identities, | 566 | update_task = GNUNET_SCHEDULER_add_now (&update_identities, |
570 | ego_entry->next); | 567 | ego_entry->next); |
571 | return; | 568 | return; |
572 | } | 569 | } |
573 | 570 | ||
574 | //There should be only a single record for a token under a label | 571 | //There should be only a single record for a token under a label |
@@ -607,7 +604,7 @@ token_collect (void *cls, | |||
607 | aud_key, | 604 | aud_key, |
608 | &token); | 605 | &token); |
609 | 606 | ||
610 | label = GNUNET_strdup (lbl); | 607 | label = GNUNET_strdup (lbl); |
611 | rd_exp = token_record->expiration_time; | 608 | rd_exp = token_record->expiration_time; |
612 | 609 | ||
613 | GNUNET_SCHEDULER_add_now (&handle_token_update, ego_entry); | 610 | GNUNET_SCHEDULER_add_now (&handle_token_update, ego_entry); |
@@ -711,12 +708,9 @@ attribute_collect (void *cls, | |||
711 | * dirty, first update the attributes. | 708 | * dirty, first update the attributes. |
712 | * | 709 | * |
713 | * @param cls the ego to update | 710 | * @param cls the ego to update |
714 | * param tc task context | ||
715 | * | ||
716 | */ | 711 | */ |
717 | static void | 712 | static void |
718 | update_identities(void *cls, | 713 | update_identities(void *cls) |
719 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
720 | { | 714 | { |
721 | struct EgoEntry *next_ego = cls; | 715 | struct EgoEntry *next_ego = cls; |
722 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; | 716 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; |
@@ -866,8 +860,7 @@ cleanup() | |||
866 | * @param tc task context | 860 | * @param tc task context |
867 | */ | 861 | */ |
868 | static void | 862 | static void |
869 | do_shutdown (void *cls, | 863 | do_shutdown (void *cls) |
870 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
871 | { | 864 | { |
872 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 865 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
873 | "Shutting down...\n"); | 866 | "Shutting down...\n"); |
@@ -882,10 +875,10 @@ create_exchange_result_message (const char* token, | |||
882 | { | 875 | { |
883 | struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage *erm; | 876 | struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage *erm; |
884 | uint16_t token_len = strlen (token) + 1; | 877 | uint16_t token_len = strlen (token) + 1; |
885 | erm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage) | 878 | erm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage) |
886 | + token_len); | 879 | + token_len); |
887 | erm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_EXCHANGE_RESULT); | 880 | erm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_EXCHANGE_RESULT); |
888 | erm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage) | 881 | erm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_ExchangeResultMessage) |
889 | + token_len); | 882 | + token_len); |
890 | erm->ticket_nonce = htonl (ticket_nonce); | 883 | erm->ticket_nonce = htonl (ticket_nonce); |
891 | memcpy (&erm[1], token, token_len); | 884 | memcpy (&erm[1], token, token_len); |
@@ -901,12 +894,12 @@ create_issue_result_message (const char* label, | |||
901 | struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage *irm; | 894 | struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage *irm; |
902 | char *tmp_str; | 895 | char *tmp_str; |
903 | 896 | ||
904 | irm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage) | 897 | irm = GNUNET_malloc (sizeof (struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage) |
905 | + strlen (label) + 1 | 898 | + strlen (label) + 1 |
906 | + strlen (ticket) + 1 | 899 | + strlen (ticket) + 1 |
907 | + strlen (token) + 1); | 900 | + strlen (token) + 1); |
908 | irm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ISSUE_RESULT); | 901 | irm->header.type = htons (GNUNET_MESSAGE_TYPE_IDENTITY_PROVIDER_ISSUE_RESULT); |
909 | irm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage) | 902 | irm->header.size = htons (sizeof (struct GNUNET_IDENTITY_PROVIDER_IssueResultMessage) |
910 | + strlen (label) + 1 | 903 | + strlen (label) + 1 |
911 | + strlen (ticket) + 1 | 904 | + strlen (ticket) + 1 |
912 | + strlen (token) + 1); | 905 | + strlen (token) + 1); |
@@ -957,7 +950,7 @@ store_token_issue_cont (void *cls, | |||
957 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", | 950 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "%s\n", |
958 | "Error serializing ticket\n"); | 951 | "Error serializing ticket\n"); |
959 | cleanup_issue_handle (handle); | 952 | cleanup_issue_handle (handle); |
960 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 953 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
961 | return; | 954 | return; |
962 | } | 955 | } |
963 | if (GNUNET_OK != token_to_string (handle->token, | 956 | if (GNUNET_OK != token_to_string (handle->token, |
@@ -968,7 +961,7 @@ store_token_issue_cont (void *cls, | |||
968 | "Error serializing token\n"); | 961 | "Error serializing token\n"); |
969 | GNUNET_free (ticket_str); | 962 | GNUNET_free (ticket_str); |
970 | cleanup_issue_handle (handle); | 963 | cleanup_issue_handle (handle); |
971 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); | 964 | GNUNET_SCHEDULER_add_now (&do_shutdown, NULL); |
972 | return; | 965 | return; |
973 | } | 966 | } |
974 | irm = create_issue_result_message (handle->label, ticket_str, token_str); | 967 | irm = create_issue_result_message (handle->label, ticket_str, token_str); |
@@ -983,8 +976,12 @@ store_token_issue_cont (void *cls, | |||
983 | GNUNET_free (token_str); | 976 | GNUNET_free (token_str); |
984 | } | 977 | } |
985 | 978 | ||
979 | |||
986 | /** | 980 | /** |
987 | * Build a GNUid token for identity | 981 | * Build a GNUid token for identity |
982 | * | ||
983 | * FIXME: doxygen is very wrong here! | ||
984 | * | ||
988 | * @param handle the handle | 985 | * @param handle the handle |
989 | * @param ego_entry the ego to build the token for | 986 | * @param ego_entry the ego to build the token for |
990 | * @param name name of the ego | 987 | * @param name name of the ego |
@@ -993,8 +990,7 @@ store_token_issue_cont (void *cls, | |||
993 | * @return identifier string of token (label) | 990 | * @return identifier string of token (label) |
994 | */ | 991 | */ |
995 | static void | 992 | static void |
996 | sign_and_return_token (void *cls, | 993 | sign_and_return_token (void *cls) |
997 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
998 | { | 994 | { |
999 | struct GNUNET_CRYPTO_EcdsaPublicKey pub_key; | 995 | struct GNUNET_CRYPTO_EcdsaPublicKey pub_key; |
1000 | struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey; | 996 | struct GNUNET_CRYPTO_EcdhePrivateKey *ecdhe_privkey; |
@@ -1008,7 +1004,7 @@ sign_and_return_token (void *cls, | |||
1008 | uint64_t exp_time; | 1004 | uint64_t exp_time; |
1009 | size_t token_metadata_len; | 1005 | size_t token_metadata_len; |
1010 | 1006 | ||
1011 | //Remote nonce | 1007 | //Remote nonce |
1012 | nonce_str = NULL; | 1008 | nonce_str = NULL; |
1013 | GNUNET_asprintf (&nonce_str, "%lu", handle->nonce); | 1009 | GNUNET_asprintf (&nonce_str, "%lu", handle->nonce); |
1014 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Request nonce: %s\n", nonce_str); | 1010 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Request nonce: %s\n", nonce_str); |
@@ -1028,7 +1024,7 @@ sign_and_return_token (void *cls, | |||
1028 | token_add_attr_int (handle->token, "exp", exp_time); | 1024 | token_add_attr_int (handle->token, "exp", exp_time); |
1029 | token_add_attr (handle->token, "nonce", nonce_str); | 1025 | token_add_attr (handle->token, "nonce", nonce_str); |
1030 | 1026 | ||
1031 | //Token in a serialized encrypted format | 1027 | //Token in a serialized encrypted format |
1032 | GNUNET_assert (token_serialize (handle->token, | 1028 | GNUNET_assert (token_serialize (handle->token, |
1033 | &handle->iss_key, | 1029 | &handle->iss_key, |
1034 | &ecdhe_privkey, | 1030 | &ecdhe_privkey, |
@@ -1150,7 +1146,7 @@ attr_collect (void *cls, | |||
1150 | static void | 1146 | static void |
1151 | cleanup_exchange_handle (struct ExchangeHandle *handle) | 1147 | cleanup_exchange_handle (struct ExchangeHandle *handle) |
1152 | { | 1148 | { |
1153 | if (NULL != handle->ticket) | 1149 | if (NULL != handle->ticket) |
1154 | ticket_destroy (handle->ticket); | 1150 | ticket_destroy (handle->ticket); |
1155 | if (NULL != handle->token) | 1151 | if (NULL != handle->token) |
1156 | token_destroy (handle->token); | 1152 | token_destroy (handle->token); |
@@ -1177,7 +1173,7 @@ process_lookup_result (void *cls, uint32_t rd_count, | |||
1177 | return; | 1173 | return; |
1178 | } | 1174 | } |
1179 | 1175 | ||
1180 | record_str = | 1176 | record_str = |
1181 | GNUNET_GNSRECORD_value_to_string (GNUNET_GNSRECORD_TYPE_ID_TOKEN, | 1177 | GNUNET_GNSRECORD_value_to_string (GNUNET_GNSRECORD_TYPE_ID_TOKEN, |
1182 | rd->data, | 1178 | rd->data, |
1183 | rd->data_size); | 1179 | rd->data_size); |
@@ -1307,7 +1303,7 @@ find_existing_token (void *cls, | |||
1307 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1303 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1308 | ">>> No existing token found\n"); | 1304 | ">>> No existing token found\n"); |
1309 | //Label | 1305 | //Label |
1310 | rnd_key = | 1306 | rnd_key = |
1311 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, | 1307 | GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_STRONG, |
1312 | UINT64_MAX); | 1308 | UINT64_MAX); |
1313 | GNUNET_STRINGS_base64_encode ((char*)&rnd_key, | 1309 | GNUNET_STRINGS_base64_encode ((char*)&rnd_key, |
@@ -1318,7 +1314,7 @@ find_existing_token (void *cls, | |||
1318 | &handle->iss_key, | 1314 | &handle->iss_key, |
1319 | &attr_collect, | 1315 | &attr_collect, |
1320 | handle); | 1316 | handle); |
1321 | return; | 1317 | return; |
1322 | } | 1318 | } |
1323 | 1319 | ||
1324 | //There should be only a single record for a token under a label | 1320 | //There should be only a single record for a token under a label |
@@ -1340,7 +1336,7 @@ find_existing_token (void *cls, | |||
1340 | return; | 1336 | return; |
1341 | } | 1337 | } |
1342 | ecdhe_privkey = *((struct GNUNET_CRYPTO_EcdhePrivateKey *)token_metadata_record->data); | 1338 | ecdhe_privkey = *((struct GNUNET_CRYPTO_EcdhePrivateKey *)token_metadata_record->data); |
1343 | aud_key = | 1339 | aud_key = |
1344 | (struct GNUNET_CRYPTO_EcdsaPublicKey *)(token_metadata_record->data+sizeof(struct GNUNET_CRYPTO_EcdhePrivateKey)); | 1340 | (struct GNUNET_CRYPTO_EcdsaPublicKey *)(token_metadata_record->data+sizeof(struct GNUNET_CRYPTO_EcdhePrivateKey)); |
1345 | tmp_scopes = GNUNET_strdup ((char*) aud_key+sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | 1341 | tmp_scopes = GNUNET_strdup ((char*) aud_key+sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); |
1346 | 1342 | ||
@@ -1435,12 +1431,11 @@ handle_issue_message (void *cls, | |||
1435 | } | 1431 | } |
1436 | im = (const struct GNUNET_IDENTITY_PROVIDER_IssueMessage *) message; | 1432 | im = (const struct GNUNET_IDENTITY_PROVIDER_IssueMessage *) message; |
1437 | scopes = (const char *) &im[1]; | 1433 | scopes = (const char *) &im[1]; |
1438 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
1439 | "Received ISSUE of `%s' from client\n", | ||
1440 | scope); | ||
1441 | issue_handle = GNUNET_malloc (sizeof (struct IssueHandle)); | 1434 | issue_handle = GNUNET_malloc (sizeof (struct IssueHandle)); |
1442 | issue_handle->attr_map = GNUNET_CONTAINER_multihashmap_create (5, | 1435 | issue_handle->attr_map = GNUNET_CONTAINER_multihashmap_create (5, |
1443 | GNUNET_NO); | 1436 | GNUNET_NO); |
1437 | /* FIXME: check that scopes is 0-termianted, Out-of-bounds access | ||
1438 | possible here!!! */ | ||
1444 | scopes_tmp = GNUNET_strdup (scopes); | 1439 | scopes_tmp = GNUNET_strdup (scopes); |
1445 | scope = strtok(scopes_tmp, ","); | 1440 | scope = strtok(scopes_tmp, ","); |
1446 | for (; NULL != scope; scope = strtok (NULL, ",")) | 1441 | for (; NULL != scope; scope = strtok (NULL, ",")) |
@@ -1484,7 +1479,7 @@ handle_issue_message (void *cls, | |||
1484 | * @param c configuration | 1479 | * @param c configuration |
1485 | */ | 1480 | */ |
1486 | static void | 1481 | static void |
1487 | run (void *cls, | 1482 | run (void *cls, |
1488 | struct GNUNET_SERVER_Handle *server, | 1483 | struct GNUNET_SERVER_Handle *server, |
1489 | const struct GNUNET_CONFIGURATION_Handle *c) | 1484 | const struct GNUNET_CONFIGURATION_Handle *c) |
1490 | { | 1485 | { |
@@ -1519,7 +1514,7 @@ run (void *cls, | |||
1519 | &list_ego, | 1514 | &list_ego, |
1520 | NULL); | 1515 | NULL); |
1521 | 1516 | ||
1522 | if (GNUNET_OK == | 1517 | if (GNUNET_OK == |
1523 | GNUNET_CONFIGURATION_get_value_time (cfg, | 1518 | GNUNET_CONFIGURATION_get_value_time (cfg, |
1524 | "identity-provider", | 1519 | "identity-provider", |
1525 | "TOKEN_EXPIRATION_INTERVAL", | 1520 | "TOKEN_EXPIRATION_INTERVAL", |
diff --git a/src/identity-provider/identity_provider_api.c b/src/identity-provider/identity_provider_api.c index f702ba890..f3280cb18 100644 --- a/src/identity-provider/identity_provider_api.c +++ b/src/identity-provider/identity_provider_api.c | |||
@@ -138,11 +138,9 @@ struct GNUNET_IDENTITY_PROVIDER_Handle | |||
138 | * Try again to connect to the service. | 138 | * Try again to connect to the service. |
139 | * | 139 | * |
140 | * @param cls handle to the service. | 140 | * @param cls handle to the service. |
141 | * @param tc scheduler context | ||
142 | */ | 141 | */ |
143 | static void | 142 | static void |
144 | reconnect (void *cls, | 143 | reconnect (void *cls); |
145 | const struct GNUNET_SCHEDULER_TaskContext *tc); | ||
146 | 144 | ||
147 | 145 | ||
148 | /** | 146 | /** |
@@ -233,7 +231,7 @@ message_handler (void *cls, | |||
233 | str = NULL; | 231 | str = NULL; |
234 | } | 232 | } |
235 | label_str = strtok (str, ","); | 233 | label_str = strtok (str, ","); |
236 | 234 | ||
237 | if (NULL == label_str) | 235 | if (NULL == label_str) |
238 | { | 236 | { |
239 | GNUNET_free (str); | 237 | GNUNET_free (str); |
@@ -301,7 +299,7 @@ message_handler (void *cls, | |||
301 | op->ex_cb (op->cls, &token, ticket_nonce); | 299 | op->ex_cb (op->cls, &token, ticket_nonce); |
302 | GNUNET_free (op); | 300 | GNUNET_free (op); |
303 | break; | 301 | break; |
304 | 302 | ||
305 | default: | 303 | default: |
306 | GNUNET_break (0); | 304 | GNUNET_break (0); |
307 | reschedule_connect (h); | 305 | reschedule_connect (h); |
@@ -397,10 +395,9 @@ transmit_next (struct GNUNET_IDENTITY_PROVIDER_Handle *h) | |||
397 | * Try again to connect to the service. | 395 | * Try again to connect to the service. |
398 | * | 396 | * |
399 | * @param cls handle to the identity provider service. | 397 | * @param cls handle to the identity provider service. |
400 | * @param tc scheduler context | ||
401 | */ | 398 | */ |
402 | static void | 399 | static void |
403 | reconnect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | 400 | reconnect (void *cls) |
404 | { | 401 | { |
405 | struct GNUNET_IDENTITY_PROVIDER_Handle *h = cls; | 402 | struct GNUNET_IDENTITY_PROVIDER_Handle *h = cls; |
406 | 403 | ||
diff --git a/src/identity-provider/plugin_rest_identity_provider.c b/src/identity-provider/plugin_rest_identity_provider.c index 3a6151682..b104950ba 100644 --- a/src/identity-provider/plugin_rest_identity_provider.c +++ b/src/identity-provider/plugin_rest_identity_provider.c | |||
@@ -150,12 +150,12 @@ struct EgoEntry | |||
150 | * DLL | 150 | * DLL |
151 | */ | 151 | */ |
152 | struct EgoEntry *next; | 152 | struct EgoEntry *next; |
153 | 153 | ||
154 | /** | 154 | /** |
155 | * DLL | 155 | * DLL |
156 | */ | 156 | */ |
157 | struct EgoEntry *prev; | 157 | struct EgoEntry *prev; |
158 | 158 | ||
159 | /** | 159 | /** |
160 | * Ego Identifier | 160 | * Ego Identifier |
161 | */ | 161 | */ |
@@ -165,7 +165,7 @@ struct EgoEntry | |||
165 | * Public key string | 165 | * Public key string |
166 | */ | 166 | */ |
167 | char *keystring; | 167 | char *keystring; |
168 | 168 | ||
169 | /** | 169 | /** |
170 | * The Ego | 170 | * The Ego |
171 | */ | 171 | */ |
@@ -189,7 +189,7 @@ struct RequestHandle | |||
189 | * Selected ego | 189 | * Selected ego |
190 | */ | 190 | */ |
191 | struct EgoEntry *ego_entry; | 191 | struct EgoEntry *ego_entry; |
192 | 192 | ||
193 | /** | 193 | /** |
194 | * Ptr to current ego private key | 194 | * Ptr to current ego private key |
195 | */ | 195 | */ |
@@ -199,7 +199,7 @@ struct RequestHandle | |||
199 | * Handle to the rest connection | 199 | * Handle to the rest connection |
200 | */ | 200 | */ |
201 | struct RestConnectionDataHandle *conndata_handle; | 201 | struct RestConnectionDataHandle *conndata_handle; |
202 | 202 | ||
203 | /** | 203 | /** |
204 | * The processing state | 204 | * The processing state |
205 | */ | 205 | */ |
@@ -248,8 +248,8 @@ struct RequestHandle | |||
248 | /** | 248 | /** |
249 | * ID of a task associated with the resolution process. | 249 | * ID of a task associated with the resolution process. |
250 | */ | 250 | */ |
251 | struct GNUNET_SCHEDULER_Task * timeout_task; | 251 | struct GNUNET_SCHEDULER_Task * timeout_task; |
252 | 252 | ||
253 | /** | 253 | /** |
254 | * The plugin result processor | 254 | * The plugin result processor |
255 | */ | 255 | */ |
@@ -289,7 +289,7 @@ cleanup_handle (struct RequestHandle *handle) | |||
289 | struct EgoEntry *ego_tmp; | 289 | struct EgoEntry *ego_tmp; |
290 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 290 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
291 | "Cleaning up\n"); | 291 | "Cleaning up\n"); |
292 | if (NULL != handle->resp_object) | 292 | if (NULL != handle->resp_object) |
293 | GNUNET_REST_jsonapi_object_delete (handle->resp_object); | 293 | GNUNET_REST_jsonapi_object_delete (handle->resp_object); |
294 | if (NULL != handle->timeout_task) | 294 | if (NULL != handle->timeout_task) |
295 | GNUNET_SCHEDULER_cancel (handle->timeout_task); | 295 | GNUNET_SCHEDULER_cancel (handle->timeout_task); |
@@ -324,11 +324,9 @@ cleanup_handle (struct RequestHandle *handle) | |||
324 | * Task run on shutdown. Cleans up everything. | 324 | * Task run on shutdown. Cleans up everything. |
325 | * | 325 | * |
326 | * @param cls unused | 326 | * @param cls unused |
327 | * @param tc scheduler context | ||
328 | */ | 327 | */ |
329 | static void | 328 | static void |
330 | do_error (void *cls, | 329 | do_error (void *cls) |
331 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
332 | { | 330 | { |
333 | struct RequestHandle *handle = cls; | 331 | struct RequestHandle *handle = cls; |
334 | struct MHD_Response *resp; | 332 | struct MHD_Response *resp; |
@@ -347,11 +345,9 @@ do_error (void *cls, | |||
347 | * Task run on shutdown. Cleans up everything. | 345 | * Task run on shutdown. Cleans up everything. |
348 | * | 346 | * |
349 | * @param cls unused | 347 | * @param cls unused |
350 | * @param tc scheduler context | ||
351 | */ | 348 | */ |
352 | static void | 349 | static void |
353 | do_cleanup_handle_delayed (void *cls, | 350 | do_cleanup_handle_delayed (void *cls) |
354 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
355 | { | 351 | { |
356 | struct RequestHandle *handle = cls; | 352 | struct RequestHandle *handle = cls; |
357 | cleanup_handle(handle); | 353 | cleanup_handle(handle); |
@@ -377,7 +373,7 @@ token_creat_cont (void *cls, | |||
377 | char *ticket_str; | 373 | char *ticket_str; |
378 | char *token_str; | 374 | char *token_str; |
379 | char *result_str; | 375 | char *result_str; |
380 | 376 | ||
381 | if (NULL == ticket) | 377 | if (NULL == ticket) |
382 | { | 378 | { |
383 | handle->emsg = GNUNET_strdup ("Error in token issue"); | 379 | handle->emsg = GNUNET_strdup ("Error in token issue"); |
@@ -536,7 +532,7 @@ issue_token_cont (struct RestConnectionDataHandle *con, | |||
536 | &aud_key, | 532 | &aud_key, |
537 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | 533 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); |
538 | 534 | ||
539 | //Remote nonce | 535 | //Remote nonce |
540 | nonce_str = NULL; | 536 | nonce_str = NULL; |
541 | GNUNET_CRYPTO_hash (GNUNET_IDENTITY_TOKEN_REQUEST_NONCE, | 537 | GNUNET_CRYPTO_hash (GNUNET_IDENTITY_TOKEN_REQUEST_NONCE, |
542 | strlen (GNUNET_IDENTITY_TOKEN_REQUEST_NONCE), | 538 | strlen (GNUNET_IDENTITY_TOKEN_REQUEST_NONCE), |
@@ -600,11 +596,9 @@ issue_token_cont (struct RestConnectionDataHandle *con, | |||
600 | * Build a GNUid token for identity | 596 | * Build a GNUid token for identity |
601 | * | 597 | * |
602 | * @param cls the request handle | 598 | * @param cls the request handle |
603 | * @param tc task context | ||
604 | */ | 599 | */ |
605 | static void | 600 | static void |
606 | return_token_list (void *cls, | 601 | return_token_list (void *cls) |
607 | const struct GNUNET_SCHEDULER_TaskContext *tc) | ||
608 | { | 602 | { |
609 | char* result_str; | 603 | char* result_str; |
610 | struct RequestHandle *handle = cls; | 604 | struct RequestHandle *handle = cls; |
@@ -784,7 +778,7 @@ exchange_cont (void *cls, | |||
784 | char* token_str; | 778 | char* token_str; |
785 | char* nonce_str; | 779 | char* nonce_str; |
786 | uint64_t expected_nonce; | 780 | uint64_t expected_nonce; |
787 | 781 | ||
788 | //Get nonce | 782 | //Get nonce |
789 | GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_IDENTITY_PROVIDER_EXPECTED_NONCE, | 783 | GNUNET_CRYPTO_hash (GNUNET_REST_JSONAPI_IDENTITY_PROVIDER_EXPECTED_NONCE, |
790 | strlen (GNUNET_REST_JSONAPI_IDENTITY_PROVIDER_EXPECTED_NONCE), | 784 | strlen (GNUNET_REST_JSONAPI_IDENTITY_PROVIDER_EXPECTED_NONCE), |
@@ -823,7 +817,7 @@ exchange_cont (void *cls, | |||
823 | GNUNET_free (result); | 817 | GNUNET_free (result); |
824 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 818 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
825 | cleanup_handle (handle); | 819 | cleanup_handle (handle); |
826 | json_decref (root); | 820 | json_decref (root); |
827 | } | 821 | } |
828 | 822 | ||
829 | 823 | ||
@@ -1010,7 +1004,7 @@ list_ego (void *cls, | |||
1010 | if (ID_REST_STATE_INIT == handle->state) { | 1004 | if (ID_REST_STATE_INIT == handle->state) { |
1011 | ego_entry = GNUNET_new (struct EgoEntry); | 1005 | ego_entry = GNUNET_new (struct EgoEntry); |
1012 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); | 1006 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); |
1013 | ego_entry->keystring = | 1007 | ego_entry->keystring = |
1014 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); | 1008 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); |
1015 | ego_entry->ego = ego; | 1009 | ego_entry->ego = ego; |
1016 | GNUNET_asprintf (&ego_entry->identifier, "%s", identifier); | 1010 | GNUNET_asprintf (&ego_entry->identifier, "%s", identifier); |