-fixing some namestore tests
authorChristian Grothoff <christian@grothoff.org>
Sun, 30 Jun 2013 19:40:14 +0000 (19:40 +0000)
committerChristian Grothoff <christian@grothoff.org>
Sun, 30 Jun 2013 19:40:14 +0000 (19:40 +0000)
src/namestore/test_hostkey [deleted file]
src/namestore/test_namestore_api_create.c
src/namestore/test_namestore_api_lookup.c
src/namestore/test_namestore_api_remove_not_existing_record.c
src/namestore/test_namestore_api_zone_iteration.c
src/namestore/test_namestore_api_zone_iteration_specific_zone.c

diff --git a/src/namestore/test_hostkey b/src/namestore/test_hostkey
deleted file mode 100644 (file)
index 2ffb55f..0000000
Binary files a/src/namestore/test_hostkey and /dev/null differ
index 0510a6c4bc5391c4e14a4559545125eb357482a1..aba18c192231108cab8a43407a50ec1e27a3d77e 100644 (file)
@@ -54,10 +54,6 @@ static struct GNUNET_CRYPTO_EccPrivateKey * privkey;
 
 static struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded pubkey;
 
-static struct GNUNET_CRYPTO_EccSignature *s_signature;
-
-static struct GNUNET_CRYPTO_EccSignature *s_signature_updated;
-
 static struct GNUNET_CRYPTO_ShortHashCode s_zone;
 
 static struct GNUNET_NAMESTORE_RecordData *s_first_record;
@@ -166,18 +162,6 @@ name_lookup_second_proc (void *cls,
       failed = GNUNET_YES;
     }
 
-    struct GNUNET_NAMESTORE_RecordData rd_new[2];
-    rd_new[0] = *s_first_record;
-    rd_new[1] = *s_second_record;
-    rd_new[1].flags = 0; /* unset GNUNET_NAMESTORE_RF_AUTHORITY */
-    s_signature_updated = GNUNET_NAMESTORE_create_signature (privkey, expire, s_name, rd_new, 2);
-
-    if (0 != memcmp (s_signature_updated, signature, sizeof (struct GNUNET_CRYPTO_EccSignature)))
-    {
-      GNUNET_break (0);
-      failed = GNUNET_YES;
-    }
-
     found = GNUNET_YES;
     if (failed == GNUNET_NO)
       res = 0;
@@ -226,6 +210,7 @@ name_lookup_initial_proc (void *cls,
                          const struct GNUNET_NAMESTORE_RecordData *rd,
                          const struct GNUNET_CRYPTO_EccSignature *signature)
 {
+  struct GNUNET_NAMESTORE_RecordData both_records[2];
   char * name = cls;
   static int found = GNUNET_NO;
   int failed = GNUNET_NO;
@@ -267,12 +252,6 @@ name_lookup_initial_proc (void *cls,
       failed = GNUNET_YES;
     }
 
-    if (0 != memcmp (s_signature, signature, sizeof (struct GNUNET_CRYPTO_EccSignature)))
-    {
-      GNUNET_break (0);
-      failed = GNUNET_YES;
-    }
-
     found = GNUNET_YES;
     if (failed == GNUNET_NO)
       res = 0;
@@ -288,8 +267,10 @@ name_lookup_initial_proc (void *cls,
     s_second_record->data_size = TEST_CREATE_RECORD_DATALEN;
     memset ((char *) s_second_record->data, TEST_CREATE_RECORD_DATA, TEST_CREATE_RECORD_DATALEN);
 
+    both_records[0] = *s_first_record;
+    both_records[1] = *s_second_record;
     GNUNET_NAMESTORE_record_put_by_authority (nsh, privkey, name, 
-                                             1, s_second_record,
+                                             2, both_records,
                                              &create_second_cont, name);
 
   }
@@ -352,7 +333,6 @@ run (void *cls,
 {
   size_t rd_ser_len;
   char *hostkey_file;
-  struct GNUNET_TIME_Absolute et;
 
   endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT,endbadly, NULL);
   /* load privat key */
@@ -371,8 +351,6 @@ run (void *cls,
   rd_ser_len = GNUNET_NAMESTORE_records_get_size(1, s_first_record);
   char rd_ser[rd_ser_len];
   GNUNET_NAMESTORE_records_serialize(1, s_first_record, rd_ser_len, rd_ser);
-  et.abs_value = s_first_record->expiration_time;
-  s_signature = GNUNET_NAMESTORE_create_signature(privkey, et, s_name, s_first_record, 1);
 
   /* create random zone hash */
   GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded), &s_zone);
@@ -402,7 +380,6 @@ main (int argc, char *argv[])
                                  &run,
                                  NULL))
     return 1;
-  GNUNET_free (s_signature);
   return res;
 }
 
index fdd229b2332cc02acfe31e60be27021bb6677cc6..7673e0fa773b43b46e2eaac3d21754296cdad2ab 100644 (file)
@@ -222,7 +222,7 @@ run (void *cls,
                                                &endbadly, NULL);
 
   /* load privat key from file not included in zonekey dir */
-  privkey = GNUNET_CRYPTO_ecc_key_create_from_file("test_hostkey");
+  privkey = GNUNET_CRYPTO_ecc_key_create_from_file ("test_hostkey");
   GNUNET_assert (NULL != privkey);
   /* get public key */
   GNUNET_CRYPTO_ecc_key_get_public(privkey, &pubkey);
index c31ea8d0bb187974d3b6f81f166d3f7fd81563c3..4e207257e3bfe41beae7bddd0be3862f4b00c49e 100644 (file)
@@ -114,7 +114,7 @@ remove_cont (void *cls, int32_t success, const char *emsg)
   char *name = cls;
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Remove record for `%s': %s `%s'\n", name, (success == GNUNET_YES) ? "SUCCESS" : "FAIL", emsg);
-  if (GNUNET_NO == success)
+  if (GNUNET_OK == success)
   {
     res = 0;
   }
index 71afc359c66a4631f81daedb5157a3e175cd9eab..01e73a4a9500601c879a5e5fbbb91d09dfef0a18 100644 (file)
@@ -274,12 +274,6 @@ zone_proc (void *cls,
         failed = GNUNET_YES;
         GNUNET_break (0);
       }
-
-      if (0 != memcmp (signature, sig_3, sizeof (struct GNUNET_CRYPTO_EccSignature)))
-      {
-        failed = GNUNET_YES;
-        GNUNET_break (0);
-      }
     }
     else
     {
index 86871120c575781d9f9b34a682d78700466d83bd..c6ba99230e7182e519db8851045cbeb02707ae97 100644 (file)
@@ -233,11 +233,6 @@ zone_proc (void *cls,
         failed = GNUNET_YES;
         GNUNET_break (0);
       }
-      if (0 != memcmp (signature, sig_2, sizeof (struct GNUNET_CRYPTO_EccSignature)))
-      {
-        failed = GNUNET_YES;
-        GNUNET_break (0);
-      }
     }
     else
     {