gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r20532 - gnunet/src/gns


From: gnunet
Subject: [GNUnet-SVN] r20532 - gnunet/src/gns
Date: Thu, 15 Mar 2012 14:54:04 +0100

Author: schanzen
Date: 2012-03-15 14:54:04 +0100 (Thu, 15 Mar 2012)
New Revision: 20532

Modified:
   gnunet/src/gns/gns_api.c
   gnunet/src/gns/gnunet-service-gns.c
   gnunet/src/gns/test_gns_dht_delegated_lookup.c
Log:
-fixes


Modified: gnunet/src/gns/gns_api.c
===================================================================
--- gnunet/src/gns/gns_api.c    2012-03-15 13:47:51 UTC (rev 20531)
+++ gnunet/src/gns/gns_api.c    2012-03-15 13:54:04 UTC (rev 20532)
@@ -440,17 +440,25 @@
 
   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);
+  }
 }
 
 /**

Modified: gnunet/src/gns/gnunet-service-gns.c
===================================================================
--- gnunet/src/gns/gnunet-service-gns.c 2012-03-15 13:47:51 UTC (rev 20531)
+++ gnunet/src/gns/gnunet-service-gns.c 2012-03-15 13:54:04 UTC (rev 20532)
@@ -633,6 +633,8 @@
   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))
@@ -655,15 +657,17 @@
     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);
 }
 

Modified: gnunet/src/gns/test_gns_dht_delegated_lookup.c
===================================================================
--- gnunet/src/gns/test_gns_dht_delegated_lookup.c      2012-03-15 13:47:51 UTC 
(rev 20531)
+++ gnunet/src/gns/test_gns_dht_delegated_lookup.c      2012-03-15 13:54:04 UTC 
(rev 20532)
@@ -313,6 +313,8 @@
 
   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);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]