gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r20325 - gnunet/src/namestore


From: gnunet
Subject: [GNUnet-SVN] r20325 - gnunet/src/namestore
Date: Wed, 7 Mar 2012 09:55:06 +0100

Author: wachs
Date: 2012-03-07 09:55:06 +0100 (Wed, 07 Mar 2012)
New Revision: 20325

Modified:
   gnunet/src/namestore/namestore_api.c
   gnunet/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
Log:
- fix in api
- added second zone to test


Modified: gnunet/src/namestore/namestore_api.c
===================================================================
--- gnunet/src/namestore/namestore_api.c        2012-03-07 08:49:30 UTC (rev 
20324)
+++ gnunet/src/namestore/namestore_api.c        2012-03-07 08:55:06 UTC (rev 
20325)
@@ -93,6 +93,7 @@
   GNUNET_HashCode zone;
   uint32_t no_flags;
   uint32_t flags;
+  int has_zone;
 };
 
 
@@ -1485,7 +1486,17 @@
   it->proc = proc;
   it->proc_cls = proc;
   it->op_id = rid;
-  it->zone = *zone;
+
+  if (NULL != zone)
+  {
+    it->zone = *zone;
+    it->has_zone = GNUNET_YES;
+  }
+  else
+  {
+    memset (&it->zone, '\0', sizeof (it->zone));
+    it->has_zone = GNUNET_NO;
+  }
   GNUNET_CONTAINER_DLL_insert_tail(h->z_head, h->z_tail, it);
 
   /* set msg_size*/
@@ -1500,7 +1511,7 @@
   msg->gns_header.header.type = htons 
(GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_START);
   msg->gns_header.header.size = htons (msg_size);
   msg->gns_header.r_id = htonl (rid);
-  if (NULL == zone)
+  if (NULL != zone)
     msg->zone = *zone;
   else
     memset (&msg->zone, '\0', sizeof (msg->zone));

Modified: gnunet/src/namestore/test_namestore_api_zone_iteration_specific_zone.c
===================================================================
--- gnunet/src/namestore/test_namestore_api_zone_iteration_specific_zone.c      
2012-03-07 08:49:30 UTC (rev 20324)
+++ gnunet/src/namestore/test_namestore_api_zone_iteration_specific_zone.c      
2012-03-07 08:55:06 UTC (rev 20325)
@@ -40,6 +40,10 @@
 static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
 static GNUNET_HashCode zone;
 
+static struct GNUNET_CRYPTO_RsaPrivateKey * privkey2;
+static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey2;
+static GNUNET_HashCode zone2;
+
 static struct GNUNET_NAMESTORE_ZoneIterator *zi;
 static int res;
 
@@ -51,6 +55,10 @@
 char * s_name_2;
 struct GNUNET_NAMESTORE_RecordData *s_rd_2;
 
+struct GNUNET_CRYPTO_RsaSignature *sig_3;
+char * s_name_3;
+struct GNUNET_NAMESTORE_RecordData *s_rd_3;
+
 static void
 start_arm (const char *cfgname)
 {
@@ -334,6 +342,12 @@
   GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
   GNUNET_CRYPTO_hash(&pubkey, sizeof (pubkey), &zone);
 
+  privkey2 = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey2");
+  GNUNET_assert (privkey2 != NULL);
+  GNUNET_CRYPTO_rsa_key_get_public(privkey2, &pubkey2);
+  GNUNET_CRYPTO_hash(&pubkey2, sizeof (pubkey), &zone2);
+
+
   start_arm (cfgfile);
   GNUNET_assert (arm != NULL);
 
@@ -354,6 +368,13 @@
 
   sig_2 = GNUNET_NAMESTORE_create_signature(privkey, s_name_2, s_rd_2, 1);
   GNUNET_NAMESTORE_record_create(nsh, privkey, s_name_2, s_rd_2, &put_cont, 
NULL);
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 3\n");
+  /* name in different zone */
+  GNUNET_asprintf(&s_name_3, "dummy3");
+  s_rd_3 = create_record(1);
+  sig_3 = GNUNET_NAMESTORE_create_signature(privkey, s_name_3, s_rd_3, 1);
+  GNUNET_NAMESTORE_record_put (nsh, &pubkey2, s_name_3, 
GNUNET_TIME_absolute_get_forever(), 1, s_rd_3, sig_3, &put_cont, NULL);
 }
 
 static int




reply via email to

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