aboutsummaryrefslogtreecommitdiff
path: root/src/namestore
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-11-29 09:49:30 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-11-29 09:49:30 +0000
commit31ad700d358b04f4bc89fb12d8932ce9cd8cf40a (patch)
tree948f6400d71367ed257985fcd0889c09d0fcdab9 /src/namestore
parent4e4fa571bf018c7ae77e9c6b352860b8b2c9f46d (diff)
downloadgnunet-31ad700d358b04f4bc89fb12d8932ce9cd8cf40a.tar.gz
gnunet-31ad700d358b04f4bc89fb12d8932ce9cd8cf40a.zip
fixing multiple segfaults
fixing functionality: misunderstanding of monitor callback, stored pkey under zonekey of returned existing mapping
Diffstat (limited to 'src/namestore')
-rw-r--r--src/namestore/gnunet-namestore-fcfsd.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c
index 008e9ce1e..14b9f2e8f 100644
--- a/src/namestore/gnunet-namestore-fcfsd.c
+++ b/src/namestore/gnunet-namestore-fcfsd.c
@@ -151,6 +151,8 @@ struct Request
151 */ 151 */
152 char public_key[128]; 152 char public_key[128];
153 153
154 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
155
154}; 156};
155 157
156/** 158/**
@@ -515,10 +517,9 @@ zone_to_name_cb (void *cls,
515{ 517{
516 struct Request *request = cls; 518 struct Request *request = cls;
517 struct GNUNET_GNSRECORD_Data r; 519 struct GNUNET_GNSRECORD_Data r;
518 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
519
520 request->qe = NULL; 520 request->qe = NULL;
521 if (NULL != name) 521
522 if (0 != rd_count)
522 { 523 {
523 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 524 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
524 _("Found existing name `%s' for the given key\n"), 525 _("Found existing name `%s' for the given key\n"),
@@ -527,10 +528,18 @@ zone_to_name_cb (void *cls,
527 run_httpd_now (); 528 run_httpd_now ();
528 return; 529 return;
529 } 530 }
530 GNUNET_CRYPTO_ecdsa_key_get_public (zone_key, 531 if (NULL == zone_key)
531 &pub); 532 {
532 r.data = &pub; 533 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
533 r.data_size = sizeof (pub); 534 _("Error when mapping zone to name\n"));
535 request->phase = RP_FAIL;
536 run_httpd_now ();
537 return;
538 }
539
540 fprintf (stderr, "PUB %s\n", GNUNET_CRYPTO_ecdsa_public_key_to_string(&request->pub));
541 r.data = &request->pub;
542 r.data_size = sizeof (request->pub);
534 r.expiration_time = UINT64_MAX; 543 r.expiration_time = UINT64_MAX;
535 r.record_type = GNUNET_GNSRECORD_TYPE_PKEY; 544 r.record_type = GNUNET_GNSRECORD_TYPE_PKEY;
536 r.flags = GNUNET_GNSRECORD_RF_NONE; 545 r.flags = GNUNET_GNSRECORD_RF_NONE;
@@ -561,30 +570,29 @@ lookup_block_processor (void *cls,
561 const struct GNUNET_GNSRECORD_Data *rd) 570 const struct GNUNET_GNSRECORD_Data *rd)
562{ 571{
563 struct Request *request = cls; 572 struct Request *request = cls;
564 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
565 573
566 request->qe = NULL; 574 request->qe = NULL;
567 if (NULL == label) 575 if (0 == rd_count)
568 { 576 {
569 577
570 if (GNUNET_OK != 578 if (GNUNET_OK !=
571 GNUNET_CRYPTO_ecdsa_public_key_from_string (request->public_key, 579 GNUNET_CRYPTO_ecdsa_public_key_from_string (request->public_key,
572 strlen (request->public_key), 580 strlen (request->public_key),
573 &pub)) 581 &request->pub))
574 { 582 {
575 GNUNET_break (0); 583 GNUNET_break (0);
576 request->phase = RP_FAIL; 584 request->phase = RP_FAIL;
577 run_httpd_now (); 585 run_httpd_now ();
578 return; 586 return;
579 } 587 }
588 fprintf (stderr, "PUB1 %s\n", GNUNET_CRYPTO_ecdsa_public_key_to_string(&request->pub));
580 request->qe = GNUNET_NAMESTORE_zone_to_name (ns, 589 request->qe = GNUNET_NAMESTORE_zone_to_name (ns,
581 &fcfs_zone_pkey, 590 &fcfs_zone_pkey,
582 &pub, 591 &request->pub,
583 &zone_to_name_cb, 592 &zone_to_name_cb,
584 request); 593 request);
585 return; 594 return;
586 } 595 }
587 GNUNET_break (0 != strcmp (label, request->domain_name));
588 GNUNET_break (0 != rd_count); 596 GNUNET_break (0 != rd_count);
589 GNUNET_log (GNUNET_ERROR_TYPE_INFO, 597 GNUNET_log (GNUNET_ERROR_TYPE_INFO,
590 _("Found %u existing records for domain `%s'\n"), 598 _("Found %u existing records for domain `%s'\n"),
@@ -966,6 +974,12 @@ run (void *cls, char *const *args, const char *cfgfile,
966 } 974 }
967 identity = GNUNET_IDENTITY_connect (cfg, 975 identity = GNUNET_IDENTITY_connect (cfg,
968 NULL, NULL); 976 NULL, NULL);
977 if (NULL == identity)
978 {
979 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
980 _("Failed to connect to identity\n"));
981 return;
982 }
969 id_op = GNUNET_IDENTITY_get (identity, "fcfsd", 983 id_op = GNUNET_IDENTITY_get (identity, "fcfsd",
970 &identity_cb, NULL); 984 &identity_cb, NULL);
971 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, 985 GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL,