diff options
author | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2018-06-24 13:03:41 +0200 |
---|---|---|
committer | Schanzenbach, Martin <martin.schanzenbach@aisec.fraunhofer.de> | 2018-06-24 13:03:41 +0200 |
commit | 730a1a1fa6a02e48e37b19451703fe8ec5121135 (patch) | |
tree | c0cd6746aa94a6a8dbff893937a686fe3f24f708 /src | |
parent | e6a2ce56b18b17f4fc8de08e81704c215643807d (diff) | |
download | gnunet-730a1a1fa6a02e48e37b19451703fe8ec5121135.tar.gz gnunet-730a1a1fa6a02e48e37b19451703fe8ec5121135.zip |
attempt fix fcfs
Diffstat (limited to 'src')
-rw-r--r-- | src/namestore/gnunet-namestore-fcfsd.c | 420 |
1 files changed, 216 insertions, 204 deletions
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c index f4cdf26b4..ddd719e73 100644 --- a/src/namestore/gnunet-namestore-fcfsd.c +++ b/src/namestore/gnunet-namestore-fcfsd.c | |||
@@ -130,6 +130,11 @@ struct Request | |||
130 | struct GNUNET_NAMESTORE_QueueEntry *qe; | 130 | struct GNUNET_NAMESTORE_QueueEntry *qe; |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * Active lookup iterator | ||
134 | * TODO: deprecate or fix lookup by label and use above member | ||
135 | */ | ||
136 | struct GNUNET_NAMESTORE_ZoneIterator *lookup_it; | ||
137 | /** | ||
133 | * Active iteration with the namestore. | 138 | * Active iteration with the namestore. |
134 | */ | 139 | */ |
135 | struct GNUNET_NAMESTORE_ZoneIterator *zi; | 140 | struct GNUNET_NAMESTORE_ZoneIterator *zi; |
@@ -637,7 +642,7 @@ zone_to_name_cb (void *cls, | |||
637 | * We encountered an error in the name lookup. | 642 | * We encountered an error in the name lookup. |
638 | */ | 643 | */ |
639 | static void | 644 | static void |
640 | lookup_block_error (void *cls) | 645 | lookup_it_error (void *cls) |
641 | { | 646 | { |
642 | struct Request *request = cls; | 647 | struct Request *request = cls; |
643 | 648 | ||
@@ -658,7 +663,7 @@ lookup_block_error (void *cls) | |||
658 | * @param rd array of records with data to store | 663 | * @param rd array of records with data to store |
659 | */ | 664 | */ |
660 | static void | 665 | static void |
661 | lookup_block_processor (void *cls, | 666 | lookup_it_processor (void *cls, |
662 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zonekey, | 667 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zonekey, |
663 | const char *label, | 668 | const char *label, |
664 | unsigned int rd_count, | 669 | unsigned int rd_count, |
@@ -670,38 +675,44 @@ lookup_block_processor (void *cls, | |||
670 | (void) rd; | 675 | (void) rd; |
671 | (void) zonekey; | 676 | (void) zonekey; |
672 | request->qe = NULL; | 677 | request->qe = NULL; |
673 | if (0 == rd_count) | 678 | if (0 == strcmp (label, request->domain_name)) { |
679 | GNUNET_break (0 != rd_count); | ||
680 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
681 | _("Found %u existing records for domain `%s'\n"), | ||
682 | rd_count, | ||
683 | request->domain_name); | ||
684 | request->phase = RP_FAIL; | ||
685 | } | ||
686 | } | ||
687 | |||
688 | static void | ||
689 | lookup_it_finished (void *cls) | ||
690 | { | ||
691 | struct Request *request = cls; | ||
692 | |||
693 | if (RP_FAIL == request->phase) { | ||
694 | run_httpd_now (); | ||
695 | return; | ||
696 | } | ||
697 | if (GNUNET_OK != | ||
698 | GNUNET_CRYPTO_ecdsa_public_key_from_string (request->public_key, | ||
699 | strlen (request->public_key), | ||
700 | &request->pub)) | ||
674 | { | 701 | { |
675 | if (GNUNET_OK != | 702 | GNUNET_break (0); |
676 | GNUNET_CRYPTO_ecdsa_public_key_from_string (request->public_key, | 703 | request->phase = RP_FAIL; |
677 | strlen (request->public_key), | 704 | run_httpd_now (); |
678 | &request->pub)) | ||
679 | { | ||
680 | GNUNET_break (0); | ||
681 | request->phase = RP_FAIL; | ||
682 | run_httpd_now (); | ||
683 | return; | ||
684 | } | ||
685 | request->qe = GNUNET_NAMESTORE_zone_to_name (ns, | ||
686 | &fcfs_zone_pkey, | ||
687 | &request->pub, | ||
688 | &zone_to_name_error, | ||
689 | request, | ||
690 | &zone_to_name_cb, | ||
691 | request); | ||
692 | return; | 705 | return; |
693 | } | 706 | } |
694 | GNUNET_break (0 != rd_count); | 707 | request->qe = GNUNET_NAMESTORE_zone_to_name (ns, |
695 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 708 | &fcfs_zone_pkey, |
696 | _("Found %u existing records for domain `%s'\n"), | 709 | &request->pub, |
697 | rd_count, | 710 | &zone_to_name_error, |
698 | request->domain_name); | 711 | request, |
699 | request->phase = RP_FAIL; | 712 | &zone_to_name_cb, |
700 | run_httpd_now (); | 713 | request); |
701 | return; | ||
702 | } | 714 | } |
703 | 715 | ||
704 | |||
705 | /** | 716 | /** |
706 | * Main MHD callback for handling requests. | 717 | * Main MHD callback for handling requests. |
707 | * | 718 | * |
@@ -727,13 +738,13 @@ lookup_block_processor (void *cls, | |||
727 | */ | 738 | */ |
728 | static int | 739 | static int |
729 | create_response (void *cls, | 740 | create_response (void *cls, |
730 | struct MHD_Connection *connection, | 741 | struct MHD_Connection *connection, |
731 | const char *url, | 742 | const char *url, |
732 | const char *method, | 743 | const char *method, |
733 | const char *version, | 744 | const char *version, |
734 | const char *upload_data, | 745 | const char *upload_data, |
735 | size_t *upload_data_size, | 746 | size_t *upload_data_size, |
736 | void **ptr) | 747 | void **ptr) |
737 | { | 748 | { |
738 | struct MHD_Response *response; | 749 | struct MHD_Response *response; |
739 | struct Request *request; | 750 | struct Request *request; |
@@ -744,114 +755,115 @@ create_response (void *cls, | |||
744 | (void) version; | 755 | (void) version; |
745 | if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) || | 756 | if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) || |
746 | (0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) ) | 757 | (0 == strcmp (method, MHD_HTTP_METHOD_HEAD)) ) |
747 | { | 758 | { |
748 | if (0 == strcmp (url, FCFS_ZONEINFO_URL)) | 759 | if (0 == strcmp (url, FCFS_ZONEINFO_URL)) |
749 | ret = serve_zoneinfo_page (connection); | 760 | ret = serve_zoneinfo_page (connection); |
750 | else | 761 | else |
751 | ret = serve_main_page (connection); | 762 | ret = serve_main_page (connection); |
752 | if (ret != MHD_YES) | 763 | if (ret != MHD_YES) |
753 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 764 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
754 | _("Failed to create page for `%s'\n"), | 765 | _("Failed to create page for `%s'\n"), |
755 | url); | 766 | url); |
756 | return ret; | 767 | return ret; |
757 | } | 768 | } |
758 | if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) | 769 | if (0 == strcmp (method, MHD_HTTP_METHOD_POST)) |
770 | { | ||
771 | request = *ptr; | ||
772 | if (NULL == request) | ||
759 | { | 773 | { |
760 | request = *ptr; | 774 | request = GNUNET_new (struct Request); |
761 | if (NULL == request) | 775 | *ptr = request; |
762 | { | 776 | request->pp = MHD_create_post_processor (connection, |
763 | request = GNUNET_new (struct Request); | 777 | 1024, |
764 | *ptr = request; | 778 | &post_iterator, |
765 | request->pp = MHD_create_post_processor (connection, | 779 | request); |
766 | 1024, | 780 | if (NULL == request->pp) |
767 | &post_iterator, | ||
768 | request); | ||
769 | if (NULL == request->pp) | ||
770 | { | ||
771 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | ||
772 | _("Failed to setup post processor for `%s'\n"), | ||
773 | url); | ||
774 | return MHD_NO; /* internal error */ | ||
775 | } | ||
776 | return MHD_YES; | ||
777 | } | ||
778 | if (NULL != request->pp) | ||
779 | { | 781 | { |
780 | /* evaluate POST data */ | 782 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
781 | MHD_post_process (request->pp, | 783 | _("Failed to setup post processor for `%s'\n"), |
782 | upload_data, | 784 | url); |
783 | *upload_data_size); | 785 | return MHD_NO; /* internal error */ |
784 | if (0 != *upload_data_size) | ||
785 | { | ||
786 | *upload_data_size = 0; | ||
787 | return MHD_YES; | ||
788 | } | ||
789 | /* done with POST data, serve response */ | ||
790 | MHD_destroy_post_processor (request->pp); | ||
791 | request->pp = NULL; | ||
792 | } | 786 | } |
793 | if (GNUNET_OK != | 787 | return MHD_YES; |
794 | GNUNET_CRYPTO_ecdsa_public_key_from_string (request->public_key, | 788 | } |
795 | strlen (request->public_key), | 789 | if (NULL != request->pp) |
796 | &pub)) | 790 | { |
791 | /* evaluate POST data */ | ||
792 | MHD_post_process (request->pp, | ||
793 | upload_data, | ||
794 | *upload_data_size); | ||
795 | if (0 != *upload_data_size) | ||
797 | { | 796 | { |
798 | /* parse error */ | 797 | *upload_data_size = 0; |
799 | return fill_s_reply ("Failed to parse given public key", | 798 | return MHD_YES; |
800 | request, connection); | ||
801 | } | 799 | } |
802 | switch (request->phase) | 800 | /* done with POST data, serve response */ |
803 | { | 801 | MHD_destroy_post_processor (request->pp); |
804 | case RP_START: | 802 | request->pp = NULL; |
805 | if (NULL != strchr (request->domain_name, (int) '.')) | ||
806 | { | ||
807 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
808 | _("Domain name must not contain `.'\n")); | ||
809 | request->phase = RP_FAIL; | ||
810 | return fill_s_reply ("Domain name must not contain `.', sorry.", | ||
811 | request, | ||
812 | connection); | ||
813 | } | ||
814 | if (NULL != strchr (request->domain_name, (int) '+')) | ||
815 | { | ||
816 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
817 | _("Domain name must not contain `+'\n")); | ||
818 | request->phase = RP_FAIL; | ||
819 | return fill_s_reply ("Domain name must not contain `+', sorry.", | ||
820 | request, connection); | ||
821 | } | ||
822 | request->phase = RP_LOOKUP; | ||
823 | request->qe | ||
824 | = GNUNET_NAMESTORE_records_lookup (ns, | ||
825 | &fcfs_zone_pkey, | ||
826 | request->domain_name, | ||
827 | &lookup_block_error, | ||
828 | request, | ||
829 | &lookup_block_processor, | ||
830 | request); | ||
831 | break; | ||
832 | case RP_LOOKUP: | ||
833 | break; | ||
834 | case RP_PUT: | ||
835 | break; | ||
836 | case RP_FAIL: | ||
837 | return fill_s_reply ("Request failed, sorry.", | ||
838 | request, connection); | ||
839 | case RP_SUCCESS: | ||
840 | return fill_s_reply ("Success.", | ||
841 | request, connection); | ||
842 | default: | ||
843 | GNUNET_break (0); | ||
844 | return MHD_NO; | ||
845 | } | ||
846 | return MHD_YES; /* will have a reply later... */ | ||
847 | } | 803 | } |
804 | if (GNUNET_OK != | ||
805 | GNUNET_CRYPTO_ecdsa_public_key_from_string (request->public_key, | ||
806 | strlen (request->public_key), | ||
807 | &pub)) | ||
808 | { | ||
809 | /* parse error */ | ||
810 | return fill_s_reply ("Failed to parse given public key", | ||
811 | request, connection); | ||
812 | } | ||
813 | switch (request->phase) | ||
814 | { | ||
815 | case RP_START: | ||
816 | if (NULL != strchr (request->domain_name, (int) '.')) | ||
817 | { | ||
818 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
819 | _("Domain name must not contain `.'\n")); | ||
820 | request->phase = RP_FAIL; | ||
821 | return fill_s_reply ("Domain name must not contain `.', sorry.", | ||
822 | request, | ||
823 | connection); | ||
824 | } | ||
825 | if (NULL != strchr (request->domain_name, (int) '+')) | ||
826 | { | ||
827 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
828 | _("Domain name must not contain `+'\n")); | ||
829 | request->phase = RP_FAIL; | ||
830 | return fill_s_reply ("Domain name must not contain `+', sorry.", | ||
831 | request, connection); | ||
832 | } | ||
833 | request->phase = RP_LOOKUP; | ||
834 | request->lookup_it | ||
835 | = GNUNET_NAMESTORE_zone_iteration_start (ns, | ||
836 | &fcfs_zone_pkey, | ||
837 | &lookup_it_error, | ||
838 | request, | ||
839 | &lookup_it_processor, | ||
840 | request, | ||
841 | &lookup_it_finished, | ||
842 | request); | ||
843 | break; | ||
844 | case RP_LOOKUP: | ||
845 | break; | ||
846 | case RP_PUT: | ||
847 | break; | ||
848 | case RP_FAIL: | ||
849 | return fill_s_reply ("Request failed, sorry.", | ||
850 | request, connection); | ||
851 | case RP_SUCCESS: | ||
852 | return fill_s_reply ("Success.", | ||
853 | request, connection); | ||
854 | default: | ||
855 | GNUNET_break (0); | ||
856 | return MHD_NO; | ||
857 | } | ||
858 | return MHD_YES; /* will have a reply later... */ | ||
859 | } | ||
848 | /* unsupported HTTP method */ | 860 | /* unsupported HTTP method */ |
849 | response = MHD_create_response_from_buffer (strlen (METHOD_ERROR), | 861 | response = MHD_create_response_from_buffer (strlen (METHOD_ERROR), |
850 | (void *) METHOD_ERROR, | 862 | (void *) METHOD_ERROR, |
851 | MHD_RESPMEM_PERSISTENT); | 863 | MHD_RESPMEM_PERSISTENT); |
852 | ret = MHD_queue_response (connection, | 864 | ret = MHD_queue_response (connection, |
853 | MHD_HTTP_NOT_ACCEPTABLE, | 865 | MHD_HTTP_NOT_ACCEPTABLE, |
854 | response); | 866 | response); |
855 | MHD_destroy_response (response); | 867 | MHD_destroy_response (response); |
856 | return ret; | 868 | return ret; |
857 | } | 869 | } |
@@ -868,9 +880,9 @@ create_response (void *cls, | |||
868 | */ | 880 | */ |
869 | static void | 881 | static void |
870 | request_completed_callback (void *cls, | 882 | request_completed_callback (void *cls, |
871 | struct MHD_Connection *connection, | 883 | struct MHD_Connection *connection, |
872 | void **con_cls, | 884 | void **con_cls, |
873 | enum MHD_RequestTerminationCode toe) | 885 | enum MHD_RequestTerminationCode toe) |
874 | { | 886 | { |
875 | struct Request *request = *con_cls; | 887 | struct Request *request = *con_cls; |
876 | 888 | ||
@@ -915,33 +927,33 @@ run_httpd () | |||
915 | wws = GNUNET_NETWORK_fdset_create (); | 927 | wws = GNUNET_NETWORK_fdset_create (); |
916 | max = -1; | 928 | max = -1; |
917 | GNUNET_assert (MHD_YES == | 929 | GNUNET_assert (MHD_YES == |
918 | MHD_get_fdset (httpd, | 930 | MHD_get_fdset (httpd, |
919 | &rs, | 931 | &rs, |
920 | &ws, | 932 | &ws, |
921 | &es, | 933 | &es, |
922 | &max)); | 934 | &max)); |
923 | haveto = MHD_get_timeout (httpd, | 935 | haveto = MHD_get_timeout (httpd, |
924 | &timeout); | 936 | &timeout); |
925 | if (haveto == MHD_YES) | 937 | if (haveto == MHD_YES) |
926 | tv.rel_value_us = (uint64_t) timeout * 1000LL; | 938 | tv.rel_value_us = (uint64_t) timeout * 1000LL; |
927 | else | 939 | else |
928 | tv = GNUNET_TIME_UNIT_FOREVER_REL; | 940 | tv = GNUNET_TIME_UNIT_FOREVER_REL; |
929 | GNUNET_NETWORK_fdset_copy_native (wrs, | 941 | GNUNET_NETWORK_fdset_copy_native (wrs, |
930 | &rs, | 942 | &rs, |
931 | max + 1); | 943 | max + 1); |
932 | GNUNET_NETWORK_fdset_copy_native (wws, | 944 | GNUNET_NETWORK_fdset_copy_native (wws, |
933 | &ws, | 945 | &ws, |
934 | max + 1); | 946 | max + 1); |
935 | GNUNET_NETWORK_fdset_copy_native (wes, | 947 | GNUNET_NETWORK_fdset_copy_native (wes, |
936 | &es, | 948 | &es, |
937 | max + 1); | 949 | max + 1); |
938 | httpd_task = | 950 | httpd_task = |
939 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH, | 951 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH, |
940 | tv, | 952 | tv, |
941 | wrs, | 953 | wrs, |
942 | wws, | 954 | wws, |
943 | &do_httpd, | 955 | &do_httpd, |
944 | NULL); | 956 | NULL); |
945 | GNUNET_NETWORK_fdset_destroy (wrs); | 957 | GNUNET_NETWORK_fdset_destroy (wrs); |
946 | GNUNET_NETWORK_fdset_destroy (wws); | 958 | GNUNET_NETWORK_fdset_destroy (wws); |
947 | GNUNET_NETWORK_fdset_destroy (wes); | 959 | GNUNET_NETWORK_fdset_destroy (wes); |
@@ -1026,9 +1038,9 @@ do_shutdown (void *cls) | |||
1026 | */ | 1038 | */ |
1027 | static void | 1039 | static void |
1028 | identity_cb (void *cls, | 1040 | identity_cb (void *cls, |
1029 | struct GNUNET_IDENTITY_Ego *ego, | 1041 | struct GNUNET_IDENTITY_Ego *ego, |
1030 | void **ctx, | 1042 | void **ctx, |
1031 | const char *name) | 1043 | const char *name) |
1032 | { | 1044 | { |
1033 | int options; | 1045 | int options; |
1034 | 1046 | ||
@@ -1037,12 +1049,12 @@ identity_cb (void *cls, | |||
1037 | if (NULL == name) | 1049 | if (NULL == name) |
1038 | return; | 1050 | return; |
1039 | if (0 != strcmp (name, | 1051 | if (0 != strcmp (name, |
1040 | zone)) | 1052 | zone)) |
1041 | return; | 1053 | return; |
1042 | if (NULL == ego) | 1054 | if (NULL == ego) |
1043 | { | 1055 | { |
1044 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1056 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1045 | _("No ego configured for `fcfsd` subsystem\n")); | 1057 | _("No ego configured for `fcfsd` subsystem\n")); |
1046 | GNUNET_SCHEDULER_shutdown (); | 1058 | GNUNET_SCHEDULER_shutdown (); |
1047 | return; | 1059 | return; |
1048 | } | 1060 | } |
@@ -1050,27 +1062,27 @@ identity_cb (void *cls, | |||
1050 | 1062 | ||
1051 | options = MHD_USE_DUAL_STACK | MHD_USE_DEBUG; | 1063 | options = MHD_USE_DUAL_STACK | MHD_USE_DEBUG; |
1052 | do | 1064 | do |
1053 | { | 1065 | { |
1054 | httpd = MHD_start_daemon (options, | 1066 | httpd = MHD_start_daemon (options, |
1055 | (uint16_t) port, | 1067 | (uint16_t) port, |
1056 | NULL, NULL, | 1068 | NULL, NULL, |
1057 | &create_response, NULL, | 1069 | &create_response, NULL, |
1058 | MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 128, | 1070 | MHD_OPTION_CONNECTION_LIMIT, (unsigned int) 128, |
1059 | MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 1, | 1071 | MHD_OPTION_PER_IP_CONNECTION_LIMIT, (unsigned int) 1, |
1060 | MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 16, | 1072 | MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int) 16, |
1061 | MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (4 * 1024), | 1073 | MHD_OPTION_CONNECTION_MEMORY_LIMIT, (size_t) (4 * 1024), |
1062 | MHD_OPTION_NOTIFY_COMPLETED, &request_completed_callback, NULL, | 1074 | MHD_OPTION_NOTIFY_COMPLETED, &request_completed_callback, NULL, |
1063 | MHD_OPTION_END); | 1075 | MHD_OPTION_END); |
1064 | if (MHD_USE_DEBUG == options) | 1076 | if (MHD_USE_DEBUG == options) |
1065 | break; | 1077 | break; |
1066 | options = MHD_USE_DEBUG; | 1078 | options = MHD_USE_DEBUG; |
1067 | } | 1079 | } |
1068 | while (NULL == httpd); | 1080 | while (NULL == httpd); |
1069 | if (NULL == httpd) | 1081 | if (NULL == httpd) |
1070 | { | 1082 | { |
1071 | 1083 | ||
1072 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1084 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1073 | _("Failed to start HTTP server\n")); | 1085 | _("Failed to start HTTP server\n")); |
1074 | GNUNET_SCHEDULER_shutdown (); | 1086 | GNUNET_SCHEDULER_shutdown (); |
1075 | return; | 1087 | return; |
1076 | } | 1088 | } |
@@ -1097,24 +1109,24 @@ run (void *cls, | |||
1097 | (void) cfgfile; | 1109 | (void) cfgfile; |
1098 | if (GNUNET_OK != | 1110 | if (GNUNET_OK != |
1099 | GNUNET_CONFIGURATION_get_value_number (cfg, | 1111 | GNUNET_CONFIGURATION_get_value_number (cfg, |
1100 | "fcfsd", | 1112 | "fcfsd", |
1101 | "HTTPPORT", | 1113 | "HTTPPORT", |
1102 | &port)) | 1114 | &port)) |
1103 | { | 1115 | { |
1104 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, | 1116 | GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR, |
1105 | "fcfsd", "HTTPPORT"); | 1117 | "fcfsd", "HTTPPORT"); |
1106 | return; | 1118 | return; |
1107 | } | 1119 | } |
1108 | ns = GNUNET_NAMESTORE_connect (cfg); | 1120 | ns = GNUNET_NAMESTORE_connect (cfg); |
1109 | if (NULL == ns) | 1121 | if (NULL == ns) |
1110 | { | 1122 | { |
1111 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1123 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
1112 | _("Failed to connect to namestore\n")); | 1124 | _("Failed to connect to namestore\n")); |
1113 | return; | 1125 | return; |
1114 | } | 1126 | } |
1115 | identity = GNUNET_IDENTITY_connect (cfg, | 1127 | identity = GNUNET_IDENTITY_connect (cfg, |
1116 | &identity_cb, | 1128 | &identity_cb, |
1117 | NULL); | 1129 | NULL); |
1118 | if (NULL == identity) | 1130 | if (NULL == identity) |
1119 | { | 1131 | { |
1120 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 1132 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
@@ -1122,9 +1134,9 @@ run (void *cls, | |||
1122 | return; | 1134 | return; |
1123 | } | 1135 | } |
1124 | uzp_task = GNUNET_SCHEDULER_add_now (&update_zoneinfo_page, | 1136 | uzp_task = GNUNET_SCHEDULER_add_now (&update_zoneinfo_page, |
1125 | NULL); | 1137 | NULL); |
1126 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, | 1138 | GNUNET_SCHEDULER_add_shutdown (&do_shutdown, |
1127 | NULL); | 1139 | NULL); |
1128 | } | 1140 | } |
1129 | 1141 | ||
1130 | 1142 | ||
@@ -1141,31 +1153,31 @@ main (int argc, | |||
1141 | { | 1153 | { |
1142 | struct GNUNET_GETOPT_CommandLineOption options[] = { | 1154 | struct GNUNET_GETOPT_CommandLineOption options[] = { |
1143 | GNUNET_GETOPT_option_mandatory | 1155 | GNUNET_GETOPT_option_mandatory |
1144 | (GNUNET_GETOPT_option_string ('z', | 1156 | (GNUNET_GETOPT_option_string ('z', |
1145 | "zone", | 1157 | "zone", |
1146 | "EGO", | 1158 | "EGO", |
1147 | gettext_noop ("name of the zone that is to be managed by FCFSD"), | 1159 | gettext_noop ("name of the zone that is to be managed by FCFSD"), |
1148 | &zone)), | 1160 | &zone)), |
1149 | GNUNET_GETOPT_OPTION_END | 1161 | GNUNET_GETOPT_OPTION_END |
1150 | }; | 1162 | }; |
1151 | int ret; | 1163 | int ret; |
1152 | 1164 | ||
1153 | if (GNUNET_OK != | 1165 | if (GNUNET_OK != |
1154 | GNUNET_STRINGS_get_utf8_args (argc, argv, | 1166 | GNUNET_STRINGS_get_utf8_args (argc, argv, |
1155 | &argc, &argv)) | 1167 | &argc, &argv)) |
1156 | return 2; | 1168 | return 2; |
1157 | 1169 | ||
1158 | GNUNET_log_setup ("fcfsd", | 1170 | GNUNET_log_setup ("fcfsd", |
1159 | "WARNING", | 1171 | "WARNING", |
1160 | NULL); | 1172 | NULL); |
1161 | ret = | 1173 | ret = |
1162 | (GNUNET_OK == | 1174 | (GNUNET_OK == |
1163 | GNUNET_PROGRAM_run (argc, | 1175 | GNUNET_PROGRAM_run (argc, |
1164 | argv, | 1176 | argv, |
1165 | "gnunet-namestore-fcfsd", | 1177 | "gnunet-namestore-fcfsd", |
1166 | _("GNU Name System First Come First Serve name registration service"), | 1178 | _("GNU Name System First Come First Serve name registration service"), |
1167 | options, | 1179 | options, |
1168 | &run, NULL)) ? 0 : 1; | 1180 | &run, NULL)) ? 0 : 1; |
1169 | GNUNET_free ((void*) argv); | 1181 | GNUNET_free ((void*) argv); |
1170 | GNUNET_CRYPTO_ecdsa_key_clear (&fcfs_zone_pkey); | 1182 | GNUNET_CRYPTO_ecdsa_key_clear (&fcfs_zone_pkey); |
1171 | return ret; | 1183 | return ret; |