diff options
Diffstat (limited to 'src/namestore/plugin_rest_namestore.c')
-rw-r--r-- | src/namestore/plugin_rest_namestore.c | 58 |
1 files changed, 28 insertions, 30 deletions
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c index 95b9b428f..f1cbfb38b 100644 --- a/src/namestore/plugin_rest_namestore.c +++ b/src/namestore/plugin_rest_namestore.c | |||
@@ -491,7 +491,7 @@ namestore_list_finished (void *cls) | |||
491 | resp = GNUNET_REST_create_response (result_str); | 491 | resp = GNUNET_REST_create_response (result_str); |
492 | MHD_add_response_header (resp, "Content-Type", "application/json"); | 492 | MHD_add_response_header (resp, "Content-Type", "application/json"); |
493 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); | 493 | handle->proc (handle->proc_cls, resp, MHD_HTTP_OK); |
494 | GNUNET_free_non_null (result_str); | 494 | GNUNET_free (result_str); |
495 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); | 495 | GNUNET_SCHEDULER_add_now (&cleanup_handle, handle); |
496 | } | 496 | } |
497 | 497 | ||
@@ -536,6 +536,7 @@ namestore_list_iteration (void *cls, | |||
536 | GNUNET_NAMESTORE_zone_iterator_next (handle->list_it, 1); | 536 | GNUNET_NAMESTORE_zone_iterator_next (handle->list_it, 1); |
537 | } | 537 | } |
538 | 538 | ||
539 | |||
539 | /** | 540 | /** |
540 | * Handle lookup error | 541 | * Handle lookup error |
541 | * | 542 | * |
@@ -553,10 +554,10 @@ ns_lookup_error_cb (void *cls) | |||
553 | 554 | ||
554 | static void | 555 | static void |
555 | ns_get_lookup_cb (void *cls, | 556 | ns_get_lookup_cb (void *cls, |
556 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 557 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, |
557 | const char *label, | 558 | const char *label, |
558 | unsigned int rd_len, | 559 | unsigned int rd_len, |
559 | const struct GNUNET_GNSRECORD_Data *rd) | 560 | const struct GNUNET_GNSRECORD_Data *rd) |
560 | { | 561 | { |
561 | struct RequestHandle *handle = cls; | 562 | struct RequestHandle *handle = cls; |
562 | struct GNUNET_GNSRECORD_Data rd_filtered[rd_len]; | 563 | struct GNUNET_GNSRECORD_Data rd_filtered[rd_len]; |
@@ -588,8 +589,6 @@ ns_get_lookup_cb (void *cls, | |||
588 | } | 589 | } |
589 | 590 | ||
590 | 591 | ||
591 | |||
592 | |||
593 | /** | 592 | /** |
594 | * Handle namestore GET request | 593 | * Handle namestore GET request |
595 | * | 594 | * |
@@ -666,12 +665,12 @@ namestore_get (struct GNUNET_REST_RequestHandle *con_handle, | |||
666 | } | 665 | } |
667 | handle->record_name = GNUNET_strdup (labelname + 1); | 666 | handle->record_name = GNUNET_strdup (labelname + 1); |
668 | handle->ns_qe = GNUNET_NAMESTORE_records_lookup (handle->ns_handle, | 667 | handle->ns_qe = GNUNET_NAMESTORE_records_lookup (handle->ns_handle, |
669 | handle->zone_pkey, | 668 | handle->zone_pkey, |
670 | handle->record_name, | 669 | handle->record_name, |
671 | &ns_lookup_error_cb, | 670 | &ns_lookup_error_cb, |
672 | handle, | 671 | handle, |
673 | &ns_get_lookup_cb, | 672 | &ns_get_lookup_cb, |
674 | handle); | 673 | handle); |
675 | if (NULL == handle->ns_qe) | 674 | if (NULL == handle->ns_qe) |
676 | { | 675 | { |
677 | handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); | 676 | handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); |
@@ -681,7 +680,6 @@ namestore_get (struct GNUNET_REST_RequestHandle *con_handle, | |||
681 | } | 680 | } |
682 | 681 | ||
683 | 682 | ||
684 | |||
685 | static void | 683 | static void |
686 | ns_lookup_cb (void *cls, | 684 | ns_lookup_cb (void *cls, |
687 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 685 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, |
@@ -702,12 +700,12 @@ ns_lookup_cb (void *cls, | |||
702 | for (j = 0; j < handle->rd_count; j++) | 700 | for (j = 0; j < handle->rd_count; j++) |
703 | rd_new[i + j] = handle->rd[j]; | 701 | rd_new[i + j] = handle->rd[j]; |
704 | handle->ns_qe = GNUNET_NAMESTORE_records_store (handle->ns_handle, | 702 | handle->ns_qe = GNUNET_NAMESTORE_records_store (handle->ns_handle, |
705 | handle->zone_pkey, | 703 | handle->zone_pkey, |
706 | handle->record_name, | 704 | handle->record_name, |
707 | i + j, | 705 | i + j, |
708 | rd_new, | 706 | rd_new, |
709 | &create_finished, | 707 | &create_finished, |
710 | handle); | 708 | handle); |
711 | if (NULL == handle->ns_qe) | 709 | if (NULL == handle->ns_qe) |
712 | { | 710 | { |
713 | handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); | 711 | handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); |
@@ -794,12 +792,12 @@ namestore_add_or_update (struct GNUNET_REST_RequestHandle *con_handle, | |||
794 | } | 792 | } |
795 | handle->zone_pkey = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); | 793 | handle->zone_pkey = GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego); |
796 | handle->ns_qe = GNUNET_NAMESTORE_records_lookup (handle->ns_handle, | 794 | handle->ns_qe = GNUNET_NAMESTORE_records_lookup (handle->ns_handle, |
797 | handle->zone_pkey, | 795 | handle->zone_pkey, |
798 | handle->record_name, | 796 | handle->record_name, |
799 | &ns_lookup_error_cb, | 797 | &ns_lookup_error_cb, |
800 | handle, | 798 | handle, |
801 | &ns_lookup_cb, | 799 | &ns_lookup_cb, |
802 | handle); | 800 | handle); |
803 | if (NULL == handle->ns_qe) | 801 | if (NULL == handle->ns_qe) |
804 | { | 802 | { |
805 | handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); | 803 | handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); |
@@ -898,9 +896,9 @@ namestore_delete (struct GNUNET_REST_RequestHandle *con_handle, | |||
898 | handle->zone_pkey, | 896 | handle->zone_pkey, |
899 | handle->record_name, | 897 | handle->record_name, |
900 | 0, | 898 | 0, |
901 | NULL, | 899 | NULL, |
902 | &del_finished, | 900 | &del_finished, |
903 | handle); | 901 | handle); |
904 | if (NULL == handle->ns_qe) | 902 | if (NULL == handle->ns_qe) |
905 | { | 903 | { |
906 | handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); | 904 | handle->emsg = GNUNET_strdup (GNUNET_REST_NAMESTORE_FAILED); |
@@ -1109,7 +1107,7 @@ libgnunet_plugin_rest_namestore_done (void *cls) | |||
1109 | 1107 | ||
1110 | plugin->cfg = NULL; | 1108 | plugin->cfg = NULL; |
1111 | 1109 | ||
1112 | GNUNET_free_non_null (allow_methods); | 1110 | GNUNET_free (allow_methods); |
1113 | GNUNET_free (api); | 1111 | GNUNET_free (api); |
1114 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Namestore REST plugin is finished\n"); | 1112 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Namestore REST plugin is finished\n"); |
1115 | return NULL; | 1113 | return NULL; |