aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Schanzenbach <mschanzenbach@posteo.de>2012-03-15 13:54:04 +0000
committerMartin Schanzenbach <mschanzenbach@posteo.de>2012-03-15 13:54:04 +0000
commitf619430fc962cc50f48e980841c76ca7fe1e801e (patch)
tree25718674bc95b2e6241226d9502812545a63b566 /src
parentf815a16a9f505893ed948c775992a86fa8e5cbc0 (diff)
downloadgnunet-f619430fc962cc50f48e980841c76ca7fe1e801e.tar.gz
gnunet-f619430fc962cc50f48e980841c76ca7fe1e801e.zip
-fixes
Diffstat (limited to 'src')
-rw-r--r--src/gns/gns_api.c26
-rw-r--r--src/gns/gnunet-service-gns.c12
-rw-r--r--src/gns/test_gns_dht_delegated_lookup.c2
3 files changed, 27 insertions, 13 deletions
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c
index 1a268f952..26870cdfd 100644
--- a/src/gns/gns_api.c
+++ b/src/gns/gns_api.c
@@ -440,17 +440,25 @@ process_lookup_reply (struct GNUNET_GNS_QueueEntry *qe,
440 440
441 len -= sizeof(struct GNUNET_GNS_ClientLookupResultMessage); 441 len -= sizeof(struct GNUNET_GNS_ClientLookupResultMessage);
442 442
443 GNUNET_NAMESTORE_records_deserialize (len, (char*)&msg[1],
444 rd_count,
445 rd);
446
447 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
448 "Received lookup reply from GNS service (count=%d)\n",
449 ntohl(msg->rd_count));
450
451 GNUNET_CLIENT_receive (h->client, &process_message, h, 443 GNUNET_CLIENT_receive (h->client, &process_message, h,
452 GNUNET_TIME_UNIT_FOREVER_REL); 444 GNUNET_TIME_UNIT_FOREVER_REL);
453 qe->lookup_proc(qe->proc_cls, rd_count, rd); 445 if (GNUNET_SYSERR == GNUNET_NAMESTORE_records_deserialize (len,
446 (char*)&msg[1],
447 rd_count,
448 rd))
449 {
450 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
451 "Failed to serialize lookup reply from GNS service!\n");
452 qe->lookup_proc(qe->proc_cls, 0, NULL);
453 }
454 else
455 {
456
457 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
458 "Received lookup reply from GNS service (count=%d)\n",
459 ntohl(msg->rd_count));
460 qe->lookup_proc(qe->proc_cls, rd_count, rd);
461 }
454} 462}
455 463
456/** 464/**
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c
index bea63e2f7..aa3d3b3e8 100644
--- a/src/gns/gnunet-service-gns.c
+++ b/src/gns/gnunet-service-gns.c
@@ -633,6 +633,8 @@ handle_lookup(void *cls,
633 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "LOOKUP"); 633 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "LOOKUP");
634 634
635 size_t msg_size = 0; 635 size_t msg_size = 0;
636 size_t namelen;
637 char* name;
636 struct ClientLookupHandle *clh; 638 struct ClientLookupHandle *clh;
637 639
638 if (ntohs (message->size) < sizeof (struct GNUNET_GNS_ClientLookupMessage)) 640 if (ntohs (message->size) < sizeof (struct GNUNET_GNS_ClientLookupMessage))
@@ -655,15 +657,17 @@ handle_lookup(void *cls,
655 GNUNET_SERVER_receive_done (client, GNUNET_OK); 657 GNUNET_SERVER_receive_done (client, GNUNET_OK);
656 return; 658 return;
657 } 659 }
658 660
661 name = (char*)&sh_msg[1];
662 namelen = strlen(name)+1;
659 clh = GNUNET_malloc(sizeof(struct ClientLookupHandle)); 663 clh = GNUNET_malloc(sizeof(struct ClientLookupHandle));
660 clh->client = client; 664 clh->client = client;
661 clh->name = GNUNET_malloc(strlen((char*)&sh_msg[1]) + 1); 665 clh->name = GNUNET_malloc(namelen);
662 strcpy(clh->name, (char*)&sh_msg[1]); 666 strcpy(clh->name, name);
663 clh->unique_id = sh_msg->id; 667 clh->unique_id = sh_msg->id;
664 clh->type = ntohl(sh_msg->type); 668 clh->type = ntohl(sh_msg->type);
665 669
666 gns_resolver_lookup_record(zone_hash, clh->type, (char*)&sh_msg[1], 670 gns_resolver_lookup_record(zone_hash, clh->type, name,
667 &send_lookup_response, clh); 671 &send_lookup_response, clh);
668} 672}
669 673
diff --git a/src/gns/test_gns_dht_delegated_lookup.c b/src/gns/test_gns_dht_delegated_lookup.c
index 4f3cd09a2..f81a8d028 100644
--- a/src/gns/test_gns_dht_delegated_lookup.c
+++ b/src/gns/test_gns_dht_delegated_lookup.c
@@ -313,6 +313,8 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
313 313
314 alice_key = GNUNET_CRYPTO_rsa_key_create_from_file (alice_keyfile); 314 alice_key = GNUNET_CRYPTO_rsa_key_create_from_file (alice_keyfile);
315 bob_key = GNUNET_CRYPTO_rsa_key_create (); 315 bob_key = GNUNET_CRYPTO_rsa_key_create ();
316
317 GNUNET_free(alice_keyfile);
316 318
317 GNUNET_CRYPTO_rsa_key_get_public (alice_key, &alice_pkey); 319 GNUNET_CRYPTO_rsa_key_get_public (alice_key, &alice_pkey);
318 GNUNET_CRYPTO_rsa_key_get_public (bob_key, &bob_pkey); 320 GNUNET_CRYPTO_rsa_key_get_public (bob_key, &bob_pkey);