aboutsummaryrefslogtreecommitdiff
path: root/src/identity-provider
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2016-05-04 17:18:02 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2016-05-04 17:18:02 +0000
commita44744499d8f3df64cc1d15cd6b40b4b0e4a3683 (patch)
tree27621a6ee20cbe8e344ffdc18c05754e67d67bf3 /src/identity-provider
parentca11046195a840932edb04900669a38cd60ae682 (diff)
downloadgnunet-a44744499d8f3df64cc1d15cd6b40b4b0e4a3683.tar.gz
gnunet-a44744499d8f3df64cc1d15cd6b40b4b0e4a3683.zip
Update jsonapi to current specs, refactor
Diffstat (limited to 'src/identity-provider')
-rw-r--r--src/identity-provider/gnunet-service-identity-provider.c3
-rw-r--r--src/identity-provider/plugin_rest_identity_provider.c20
2 files changed, 11 insertions, 12 deletions
diff --git a/src/identity-provider/gnunet-service-identity-provider.c b/src/identity-provider/gnunet-service-identity-provider.c
index 0bb400e07..0a690e2d3 100644
--- a/src/identity-provider/gnunet-service-identity-provider.c
+++ b/src/identity-provider/gnunet-service-identity-provider.c
@@ -481,7 +481,6 @@ handle_token_update (void *cls)
481 token_record, 481 token_record,
482 &store_token_cont, 482 &store_token_cont,
483 ego_entry); 483 ego_entry);
484 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, ">>> Updating Token w/ %s\n", new_token);
485 token_destroy (new_token); 484 token_destroy (new_token);
486 token_destroy (token); 485 token_destroy (token);
487 GNUNET_free (new_ecdhe_privkey); 486 GNUNET_free (new_ecdhe_privkey);
@@ -725,7 +724,7 @@ update_identities(void *cls)
725 if (min_rel_exp.rel_value_us < MIN_WAIT_TIME.rel_value_us) 724 if (min_rel_exp.rel_value_us < MIN_WAIT_TIME.rel_value_us)
726 min_rel_exp = MIN_WAIT_TIME; 725 min_rel_exp = MIN_WAIT_TIME;
727 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 726 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
728 ">>> Finished. Rescheduling in %d\n", 727 ">>> Finished. Rescheduling in %lu\n",
729 min_rel_exp.rel_value_us); 728 min_rel_exp.rel_value_us);
730 ns_it = NULL; 729 ns_it = NULL;
731 //finished -> reschedule 730 //finished -> reschedule
diff --git a/src/identity-provider/plugin_rest_identity_provider.c b/src/identity-provider/plugin_rest_identity_provider.c
index 1e1878cad..b039255b5 100644
--- a/src/identity-provider/plugin_rest_identity_provider.c
+++ b/src/identity-provider/plugin_rest_identity_provider.c
@@ -279,7 +279,7 @@ struct RequestHandle
279 /** 279 /**
280 * Response object 280 * Response object
281 */ 281 */
282 struct GNUNET_JSONAPI_Object *resp_object; 282 struct GNUNET_JSONAPI_Document *resp_object;
283 283
284}; 284};
285 285
@@ -296,7 +296,7 @@ cleanup_handle (struct RequestHandle *handle)
296 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 296 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
297 "Cleaning up\n"); 297 "Cleaning up\n");
298 if (NULL != handle->resp_object) 298 if (NULL != handle->resp_object)
299 GNUNET_JSONAPI_object_delete (handle->resp_object); 299 GNUNET_JSONAPI_document_delete (handle->resp_object);
300 if (NULL != handle->timeout_task) 300 if (NULL != handle->timeout_task)
301 GNUNET_SCHEDULER_cancel (handle->timeout_task); 301 GNUNET_SCHEDULER_cancel (handle->timeout_task);
302 if (NULL != handle->identity_handle) 302 if (NULL != handle->identity_handle)
@@ -403,7 +403,7 @@ token_creat_cont (void *cls,
403 return; 403 return;
404 } 404 }
405 405
406 handle->resp_object = GNUNET_JSONAPI_object_new (); 406 handle->resp_object = GNUNET_JSONAPI_document_new ();
407 json_resource = GNUNET_JSONAPI_resource_new (GNUNET_REST_JSONAPI_IDENTITY_PROVIDER_TICKET, 407 json_resource = GNUNET_JSONAPI_resource_new (GNUNET_REST_JSONAPI_IDENTITY_PROVIDER_TICKET,
408 label); 408 label);
409 ticket_str = GNUNET_IDENTITY_PROVIDER_ticket_to_string (ticket); 409 ticket_str = GNUNET_IDENTITY_PROVIDER_ticket_to_string (ticket);
@@ -420,9 +420,9 @@ token_creat_cont (void *cls,
420 GNUNET_free (token_str); 420 GNUNET_free (token_str);
421 json_decref (ticket_json); 421 json_decref (ticket_json);
422 json_decref (token_json); 422 json_decref (token_json);
423 GNUNET_JSONAPI_object_resource_add (handle->resp_object, json_resource); 423 GNUNET_JSONAPI_document_resource_add (handle->resp_object, json_resource);
424 424
425 GNUNET_JSONAPI_data_serialize (handle->resp_object, &result_str); 425 GNUNET_JSONAPI_document_serialize (handle->resp_object, &result_str);
426 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); 426 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
427 resp = GNUNET_REST_create_json_response (result_str); 427 resp = GNUNET_REST_create_json_response (result_str);
428 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 428 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
@@ -638,7 +638,7 @@ return_token_list (void *cls)
638 struct RequestHandle *handle = cls; 638 struct RequestHandle *handle = cls;
639 struct MHD_Response *resp; 639 struct MHD_Response *resp;
640 640
641 GNUNET_JSONAPI_data_serialize (handle->resp_object, &result_str); 641 GNUNET_JSONAPI_document_serialize (handle->resp_object, &result_str);
642 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str); 642 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Result %s\n", result_str);
643 resp = GNUNET_REST_create_json_response (result_str); 643 resp = GNUNET_REST_create_json_response (result_str);
644 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); 644 handle->proc (handle->proc_cls, resp, MHD_HTTP_OK);
@@ -717,7 +717,7 @@ token_collect (void *cls,
717 token); 717 token);
718 json_decref (token); 718 json_decref (token);
719 719
720 GNUNET_JSONAPI_object_resource_add (handle->resp_object, json_resource); 720 GNUNET_JSONAPI_document_resource_add (handle->resp_object, json_resource);
721 GNUNET_free (data); 721 GNUNET_free (data);
722 } 722 }
723 } 723 }
@@ -776,7 +776,7 @@ list_token_cont (struct GNUNET_REST_RequestHandle *con_handle,
776 GNUNET_free (ego_tmp); 776 GNUNET_free (ego_tmp);
777 } 777 }
778 } 778 }
779 handle->resp_object = GNUNET_JSONAPI_object_new (); 779 handle->resp_object = GNUNET_JSONAPI_document_new ();
780 if (NULL == handle->ego_head) 780 if (NULL == handle->ego_head)
781 { 781 {
782 //Done 782 //Done
@@ -1045,7 +1045,7 @@ list_ego (void *cls,
1045 ego_entry->keystring = 1045 ego_entry->keystring =
1046 GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 1046 GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk);
1047 ego_entry->ego = ego; 1047 ego_entry->ego = ego;
1048 GNUNET_asprintf (&ego_entry->identifier, "%s", identifier); 1048 ego_entry->identifier = GNUNET_strdup (identifier);
1049 GNUNET_CONTAINER_DLL_insert_tail(handle->ego_head,handle->ego_tail, ego_entry); 1049 GNUNET_CONTAINER_DLL_insert_tail(handle->ego_head,handle->ego_tail, ego_entry);
1050 } 1050 }
1051 1051
@@ -1076,7 +1076,7 @@ rest_identity_process_request(struct GNUNET_REST_RequestHandle *conndata_handle,
1076 handle->conndata_handle = conndata_handle; 1076 handle->conndata_handle = conndata_handle;
1077 1077
1078 1078
1079 GNUNET_asprintf (&handle->url, "%s", conndata_handle->url); 1079 handle->url = GNUNET_strdup (conndata_handle->url);
1080 if (handle->url[strlen (handle->url)-1] == '/') 1080 if (handle->url[strlen (handle->url)-1] == '/')
1081 handle->url[strlen (handle->url)-1] = '\0'; 1081 handle->url[strlen (handle->url)-1] = '\0';
1082 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1082 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,