aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/gnunet-namestore-fcfsd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/namestore/gnunet-namestore-fcfsd.c')
-rw-r--r--src/namestore/gnunet-namestore-fcfsd.c49
1 files changed, 30 insertions, 19 deletions
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c
index 34641d22e..22d108067 100644
--- a/src/namestore/gnunet-namestore-fcfsd.c
+++ b/src/namestore/gnunet-namestore-fcfsd.c
@@ -164,7 +164,7 @@ struct Request
164 */ 164 */
165 char public_key[128]; 165 char public_key[128];
166 166
167 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 167 struct GNUNET_IDENTITY_PublicKey pub;
168}; 168};
169 169
170/** 170/**
@@ -211,7 +211,7 @@ static struct GNUNET_NAMESTORE_Handle *ns;
211/** 211/**
212 * Private key for the fcfsd zone. 212 * Private key for the fcfsd zone.
213 */ 213 */
214static struct GNUNET_CRYPTO_EcdsaPrivateKey fcfs_zone_pkey; 214static struct GNUNET_IDENTITY_PrivateKey fcfs_zone_pkey;
215 215
216/** 216/**
217 * Connection to identity service. 217 * Connection to identity service.
@@ -306,7 +306,6 @@ zone_iteration_end (void *cls)
306 /* return static form */ 306 /* return static form */
307 GNUNET_asprintf (&full_page, 307 GNUNET_asprintf (&full_page,
308 ZONEINFO_PAGE, 308 ZONEINFO_PAGE,
309 zr->zoneinfo,
310 zr->zoneinfo); 309 zr->zoneinfo);
311 response = MHD_create_response_from_buffer (strlen (full_page), 310 response = MHD_create_response_from_buffer (strlen (full_page),
312 (void *) full_page, 311 (void *) full_page,
@@ -332,7 +331,7 @@ zone_iteration_end (void *cls)
332 */ 331 */
333static void 332static void
334iterate_cb (void *cls, 333iterate_cb (void *cls,
335 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 334 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
336 const char *name, 335 const char *name,
337 unsigned int rd_len, 336 unsigned int rd_len,
338 const struct GNUNET_GNSRECORD_Data *rd) 337 const struct GNUNET_GNSRECORD_Data *rd)
@@ -350,7 +349,8 @@ iterate_cb (void *cls,
350 return; 349 return;
351 } 350 }
352 351
353 if (GNUNET_GNSRECORD_TYPE_PKEY != rd->record_type) 352 if ((GNUNET_GNSRECORD_TYPE_PKEY != rd->record_type) &&
353 (GNUNET_GNSRECORD_TYPE_EDKEY != rd->record_type))
354 { 354 {
355 GNUNET_NAMESTORE_zone_iterator_next (zr->list_it, 355 GNUNET_NAMESTORE_zone_iterator_next (zr->list_it,
356 1); 356 1);
@@ -615,13 +615,14 @@ zone_to_name_error (void *cls)
615 */ 615 */
616static void 616static void
617zone_to_name_cb (void *cls, 617zone_to_name_cb (void *cls,
618 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, 618 const struct GNUNET_IDENTITY_PrivateKey *zone_key,
619 const char *name, 619 const char *name,
620 unsigned int rd_count, 620 unsigned int rd_count,
621 const struct GNUNET_GNSRECORD_Data *rd) 621 const struct GNUNET_GNSRECORD_Data *rd)
622{ 622{
623 struct Request *request = cls; 623 struct Request *request = cls;
624 struct GNUNET_GNSRECORD_Data r; 624 struct GNUNET_GNSRECORD_Data r;
625 char *rdata;
625 626
626 (void) rd; 627 (void) rd;
627 (void) zone_key; 628 (void) zone_key;
@@ -636,10 +637,21 @@ zone_to_name_cb (void *cls,
636 run_httpd_now (); 637 run_httpd_now ();
637 return; 638 return;
638 } 639 }
639 r.data = &request->pub; 640 if (GNUNET_OK != GNUNET_GNSRECORD_data_from_identity (&request->pub,
640 r.data_size = sizeof(request->pub); 641 &rdata,
642 &r.data_size,
643 &r.record_type))
644 {
645 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
646 _ ("Error creating record data.\n"));
647 request->phase = RP_FAIL;
648 MHD_resume_connection (request->con);
649 run_httpd_now ();
650 return;
651 }
652
653 r.data = rdata;
641 r.expiration_time = UINT64_MAX; 654 r.expiration_time = UINT64_MAX;
642 r.record_type = GNUNET_GNSRECORD_TYPE_PKEY;
643 r.flags = GNUNET_GNSRECORD_RF_NONE; 655 r.flags = GNUNET_GNSRECORD_RF_NONE;
644 request->qe = GNUNET_NAMESTORE_records_store (ns, 656 request->qe = GNUNET_NAMESTORE_records_store (ns,
645 &fcfs_zone_pkey, 657 &fcfs_zone_pkey,
@@ -647,6 +659,7 @@ zone_to_name_cb (void *cls,
647 1, &r, 659 1, &r,
648 &put_continuation, 660 &put_continuation,
649 request); 661 request);
662 GNUNET_free (rdata);
650} 663}
651 664
652 665
@@ -677,7 +690,7 @@ lookup_it_error (void *cls)
677 */ 690 */
678static void 691static void
679lookup_it_processor (void *cls, 692lookup_it_processor (void *cls,
680 const struct GNUNET_CRYPTO_EcdsaPrivateKey *zonekey, 693 const struct GNUNET_IDENTITY_PrivateKey *zonekey,
681 const char *label, 694 const char *label,
682 unsigned int rd_count, 695 unsigned int rd_count,
683 const struct GNUNET_GNSRECORD_Data *rd) 696 const struct GNUNET_GNSRECORD_Data *rd)
@@ -712,9 +725,8 @@ lookup_it_finished (void *cls)
712 return; 725 return;
713 } 726 }
714 if (GNUNET_OK != 727 if (GNUNET_OK !=
715 GNUNET_CRYPTO_ecdsa_public_key_from_string (request->public_key, 728 GNUNET_IDENTITY_public_key_from_string (request->public_key,
716 strlen (request->public_key), 729 &request->pub))
717 &request->pub))
718 { 730 {
719 GNUNET_break (0); 731 GNUNET_break (0);
720 request->phase = RP_FAIL; 732 request->phase = RP_FAIL;
@@ -767,7 +779,7 @@ create_response (void *cls,
767{ 779{
768 struct MHD_Response *response; 780 struct MHD_Response *response;
769 struct Request *request; 781 struct Request *request;
770 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 782 struct GNUNET_IDENTITY_PublicKey pub;
771 MHD_RESULT ret; 783 MHD_RESULT ret;
772 784
773 (void) cls; 785 (void) cls;
@@ -822,10 +834,8 @@ create_response (void *cls,
822 request->pp = NULL; 834 request->pp = NULL;
823 } 835 }
824 if (GNUNET_OK != 836 if (GNUNET_OK !=
825 GNUNET_CRYPTO_ecdsa_public_key_from_string (request->public_key, 837 GNUNET_IDENTITY_public_key_from_string (request->public_key,
826 strlen ( 838 &pub))
827 request->public_key),
828 &pub))
829 { 839 {
830 /* parse error */ 840 /* parse error */
831 return fill_s_reply ("Failed to parse given public key", 841 return fill_s_reply ("Failed to parse given public key",
@@ -1211,7 +1221,8 @@ main (int argc,
1211 options, 1221 options,
1212 &run, NULL)) ? 0 : 1; 1222 &run, NULL)) ? 0 : 1;
1213 GNUNET_free_nz ((void *) argv); 1223 GNUNET_free_nz ((void *) argv);
1214 GNUNET_CRYPTO_ecdsa_key_clear (&fcfs_zone_pkey); 1224 // FIXME
1225 // GNUNET_CRYPTO_ecdsa_key_clear (&fcfs_zone_pkey);
1215 return ret; 1226 return ret;
1216} 1227}
1217 1228