- fixes
authorMatthias Wachs <wachs@net.in.tum.de>
Tue, 6 Mar 2012 13:01:31 +0000 (13:01 +0000)
committerMatthias Wachs <wachs@net.in.tum.de>
Tue, 6 Mar 2012 13:01:31 +0000 (13:01 +0000)
src/namestore/gnunet-service-namestore.c
src/namestore/namestore_api.c
src/namestore/test_namestore_api.conf

index 8153cf20b9377f718c27bf76f6b6b9c5937e4329..b72dcd0738e97dc51dcd0b632a0e90acc85c22ac 100644 (file)
@@ -311,7 +311,11 @@ handle_lookup_name_it (void *cls,
   lnr_msg->rd_len = htons (rd_ser_len);
   lnr_msg->name_len = htons (name_len);
   lnr_msg->expire = GNUNET_TIME_absolute_hton(expire);
-  lnr_msg->public_key = (*zone_key);
+  if (zone_key != NULL)
+    lnr_msg->public_key = (*zone_key);
+  else
+    memset(&lnr_msg->public_key, '\0', sizeof (lnr_msg->public_key));
+
   lnr_msg->contains_sig = htons (contains_signature);
   if (GNUNET_YES == contains_signature)
     lnr_msg->signature = *signature;
index 195c8a9bd5a5bc9b8cb8ee2313086dde8335bfb4..49ab4b4425c39d9ae0b1314957ddb4dfd0763aad 100644 (file)
@@ -259,6 +259,7 @@ handle_lookup_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
 
   struct GNUNET_CRYPTO_RsaSignature *signature = NULL;
   struct GNUNET_TIME_Absolute expire;
+  struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *public_key_tmp;
   size_t exp_msg_len;
   size_t msg_len = 0;
   size_t name_len = 0;
@@ -284,11 +285,6 @@ handle_lookup_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
     GNUNET_break_op (0);
     return;
   }
-  if (name_len == 0)
-  {
-    GNUNET_break_op (0);
-    return;
-  }
 
   name = (char *) &msg[1];
   rd_tmp = &name[name_len];
@@ -302,10 +298,16 @@ handle_lookup_name_response (struct GNUNET_NAMESTORE_QueueEntry *qe,
     signature = NULL;
   else
     signature = &msg->signature;
+  if (name_len == 0)
+    name = NULL;
+  if ((name != NULL) && (signature != NULL) && (rd_count > 0))
+      public_key_tmp =  &msg->public_key;
+  else
+      public_key_tmp = NULL;
 
   if (qe->proc != NULL)
   {
-    qe->proc (qe->proc_cls, &msg->public_key, expire, name, rd_count, (rd_count > 0) ? rd : NULL, signature);
+    qe->proc (qe->proc_cls, public_key_tmp, expire, name, rd_count, (rd_count > 0) ? rd : NULL, signature);
   }
 
   /* Operation done, remove */
index f4cd32dbdc0292d498f10b6b4c78aeaac11a5c7c..c437b414a1ecb9a1328f885a9054d32ec3f5f8aa 100644 (file)
@@ -4,7 +4,7 @@ DEFAULTSERVICES = namestore
 UNIXPATH = /tmp/gnunet-p1-service-arm.sock
 
 [namestore]
-#PREFIX = valgrind --leak-check=full
+PREFIX = valgrind --leak-check=full
 AUTOSTART = YES
 UNIXPATH = /tmp/gnunet-service-namestore.sock
 UNIX_MATCH_UID = YES