len -= sizeof(struct GNUNET_GNS_ClientLookupResultMessage);
- GNUNET_NAMESTORE_records_deserialize (len, (char*)&msg[1],
- rd_count,
- rd);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Received lookup reply from GNS service (count=%d)\n",
- ntohl(msg->rd_count));
-
GNUNET_CLIENT_receive (h->client, &process_message, h,
GNUNET_TIME_UNIT_FOREVER_REL);
- qe->lookup_proc(qe->proc_cls, rd_count, rd);
+ if (GNUNET_SYSERR == GNUNET_NAMESTORE_records_deserialize (len,
+ (char*)&msg[1],
+ rd_count,
+ rd))
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Failed to serialize lookup reply from GNS service!\n");
+ qe->lookup_proc(qe->proc_cls, 0, NULL);
+ }
+ else
+ {
+
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Received lookup reply from GNS service (count=%d)\n",
+ ntohl(msg->rd_count));
+ qe->lookup_proc(qe->proc_cls, rd_count, rd);
+ }
}
/**
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received `%s' message\n", "LOOKUP");
size_t msg_size = 0;
+ size_t namelen;
+ char* name;
struct ClientLookupHandle *clh;
if (ntohs (message->size) < sizeof (struct GNUNET_GNS_ClientLookupMessage))
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
-
+
+ name = (char*)&sh_msg[1];
+ namelen = strlen(name)+1;
clh = GNUNET_malloc(sizeof(struct ClientLookupHandle));
clh->client = client;
- clh->name = GNUNET_malloc(strlen((char*)&sh_msg[1]) + 1);
- strcpy(clh->name, (char*)&sh_msg[1]);
+ clh->name = GNUNET_malloc(namelen);
+ strcpy(clh->name, name);
clh->unique_id = sh_msg->id;
clh->type = ntohl(sh_msg->type);
- gns_resolver_lookup_record(zone_hash, clh->type, (char*)&sh_msg[1],
+ gns_resolver_lookup_record(zone_hash, clh->type, name,
&send_lookup_response, clh);
}
alice_key = GNUNET_CRYPTO_rsa_key_create_from_file (alice_keyfile);
bob_key = GNUNET_CRYPTO_rsa_key_create ();
+
+ GNUNET_free(alice_keyfile);
GNUNET_CRYPTO_rsa_key_get_public (alice_key, &alice_pkey);
GNUNET_CRYPTO_rsa_key_get_public (bob_key, &bob_pkey);