diff options
author | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-02-14 10:59:11 +0100 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2020-02-14 10:59:11 +0100 |
commit | f3f57872da3a1edee2ece7d38e1747b4efdecbd9 (patch) | |
tree | 0b87f4ffec2259981bb32911d5c93195f6e05665 /src/reclaim/plugin_rest_reclaim.c | |
parent | 007bba133ffc04bb091f35c5a1aa8745be1d5139 (diff) | |
download | gnunet-f3f57872da3a1edee2ece7d38e1747b4efdecbd9.tar.gz gnunet-f3f57872da3a1edee2ece7d38e1747b4efdecbd9.zip |
remove unused
Diffstat (limited to 'src/reclaim/plugin_rest_reclaim.c')
-rw-r--r-- | src/reclaim/plugin_rest_reclaim.c | 79 |
1 files changed, 0 insertions, 79 deletions
diff --git a/src/reclaim/plugin_rest_reclaim.c b/src/reclaim/plugin_rest_reclaim.c index 780a184d2..f25241906 100644 --- a/src/reclaim/plugin_rest_reclaim.c +++ b/src/reclaim/plugin_rest_reclaim.c | |||
@@ -454,90 +454,11 @@ ticket_collect (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket) | |||
454 | 454 | ||
455 | 455 | ||
456 | static void | 456 | static void |
457 | parse_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | ||
458 | const char *url, | ||
459 | void *cls) | ||
460 | { | ||
461 | struct RequestHandle *handle = cls; | ||
462 | |||
463 | char term_data[handle->rest_handle->data_size + 1]; | ||
464 | json_t *data_json; | ||
465 | json_error_t err; | ||
466 | int unpack_state; | ||
467 | struct MHD_Response *resp; | ||
468 | char *val_str = NULL; | ||
469 | const char *type_str = NULL; | ||
470 | term_data[handle->rest_handle->data_size] = '\0'; | ||
471 | GNUNET_memcpy (term_data, | ||
472 | handle->rest_handle->data, | ||
473 | handle->rest_handle->data_size); | ||
474 | data_json = json_loads (term_data, JSON_DECODE_ANY, &err); | ||
475 | GNUNET_assert (NULL != data_json); | ||
476 | if (! json_is_object (data_json)) | ||
477 | { | ||
478 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
479 | "Error json is not array nor object!\n"); | ||
480 | GNUNET_SCHEDULER_add_now (&do_error, handle); | ||
481 | return; | ||
482 | } | ||
483 | unpack_state = json_unpack (data_json, | ||
484 | "{s:s, s:s!}", | ||
485 | "value", | ||
486 | &val_str, | ||
487 | "type", | ||
488 | &type_str); | ||
489 | if ((0 != unpack_state) || (NULL == val_str) || (NULL == type_str)) | ||
490 | { | ||
491 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
492 | "Error json object has a wrong format!\n"); | ||
493 | GNUNET_SCHEDULER_add_now (&do_error, handle); | ||
494 | return; | ||
495 | } | ||
496 | if (0 == strcmp (type_str, "JWT")) | ||
497 | { | ||
498 | // The value is a JWT | ||
499 | char *decoded_jwt; | ||
500 | char delim[] = "."; | ||
501 | char *jwt_body = strtok (val_str, delim); | ||
502 | jwt_body = strtok (NULL, delim); | ||
503 | GNUNET_STRINGS_base64_decode (jwt_body, strlen (jwt_body), | ||
504 | (void **) &decoded_jwt); | ||
505 | resp = GNUNET_REST_create_response (decoded_jwt); | ||
506 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | ||
507 | GNUNET_free (decoded_jwt); | ||
508 | } | ||
509 | else | ||
510 | { | ||
511 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
512 | "Error requested parsing type not supported!\n"); | ||
513 | GNUNET_SCHEDULER_add_now (&do_error, handle); | ||
514 | return; | ||
515 | } | ||
516 | cleanup_handle (handle); | ||
517 | json_decref (data_json); | ||
518 | } | ||
519 | |||
520 | |||
521 | static void | ||
522 | add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, | 457 | add_attestation_cont (struct GNUNET_REST_RequestHandle *con_handle, |
523 | const char *url, | 458 | const char *url, |
524 | void *cls) | 459 | void *cls) |
525 | { | 460 | { |
526 | struct RequestHandle *handle = cls; | 461 | struct RequestHandle *handle = cls; |
527 | /* Check for substring "parse" | ||
528 | * FIXME UGLY! */ | ||
529 | if (strlen (GNUNET_REST_API_NS_RECLAIM_ATTESTATION) < strlen ( | ||
530 | handle->url)) | ||
531 | { | ||
532 | if (strncmp ("parse", (handle->url + strlen ( | ||
533 | GNUNET_REST_API_NS_RECLAIM_ATTESTATION) | ||
534 | + 1), strlen ( | ||
535 | "parse")) == 0) | ||
536 | { | ||
537 | parse_attestation_cont (con_handle,url,cls); | ||
538 | return; | ||
539 | } | ||
540 | } | ||
541 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv; | 462 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity_priv; |
542 | const char *identity; | 463 | const char *identity; |
543 | struct EgoEntry *ego_entry; | 464 | struct EgoEntry *ego_entry; |