- file extension
[oweals/gnunet.git] / src / namestore / test_namestore_api_lookup_specific_type.c
index 8ffa9ca2c5f4ac399a0b2060fd813f8a82012353..1a1dca2ff6bd1a361af77c5f4e6e0c21a68c350a 100644 (file)
@@ -195,14 +195,15 @@ void name_lookup_non_existing_record_type (void *cls,
                             const struct GNUNET_CRYPTO_RsaSignature *signature)
 {
   int failed = GNUNET_NO;
-
-  if ((NULL == zone_key) || (0 != memcmp(zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded))))
+  /* We expect zone key != NULL, name != NULL, rd_count 0, rd NULL, signature NULL */
+  if (NULL == zone_key)
   {
     GNUNET_break(0);
     failed = GNUNET_YES;
   }
-  if ((NULL == n) || (0 != strcmp(n, s_name)))
+  if (NULL == n)
   {
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name %s!\n", n);
     GNUNET_break(0);
     failed = GNUNET_YES;
   }
@@ -258,7 +259,7 @@ put_cont (void *cls, int32_t success, const char *emsg)
   if (success == GNUNET_OK)
   {
     res = 0;
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Looking up non-existing record type %u for name `%s'\n", TEST_RECORD_LOOKUP_TYPE_NOT_EXISTING, name);
+    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up non-existing record type %u for name `%s'\n", TEST_RECORD_LOOKUP_TYPE_NOT_EXISTING, name);
     GNUNET_NAMESTORE_lookup_record (nsh, &s_zone, name, TEST_RECORD_LOOKUP_TYPE_NOT_EXISTING, &name_lookup_non_existing_record_type, NULL);
   }
   else
@@ -278,7 +279,7 @@ create_record (int count)
 
   for (c = 0; c < RECORDS-1; c++)
   {
-  rd[c].expiration = GNUNET_TIME_absolute_get();
+  rd[c].expiration = GNUNET_TIME_absolute_get_zero();
   rd[c].record_type = 1;
   rd[c].data_size = TEST_RECORD_DATALEN;
   rd[c].data = GNUNET_malloc(TEST_RECORD_DATALEN);
@@ -323,7 +324,11 @@ run (void *cls, char *const *args, const char *cfgfile,
   size_t rd_ser_len;
 
   /* load privat key */
-  privkey = GNUNET_CRYPTO_rsa_key_create_from_file("hostkey");
+  char *hostkey_file;
+  GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "4UCICULTINKC87UO4326KEEDQ9MTEP2AJT88MJFVGTGNK12QNGMQI2S41VI07UUU6EO19BTB06PDL0HE6VP1OM50HOJEI75RHP4JP80.zkey");
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
+  privkey = GNUNET_CRYPTO_rsa_key_create_from_file(hostkey_file);
+  GNUNET_free (hostkey_file);
   GNUNET_assert (privkey != NULL);
   /* get public key */
   GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
@@ -337,7 +342,7 @@ run (void *cls, char *const *args, const char *cfgfile,
   GNUNET_NAMESTORE_records_serialize(RECORDS, s_rd, rd_ser_len, rd_ser);
 
   /* sign */
-  s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_name, s_rd, RECORDS);
+  s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_rd[RECORDS -1].expiration, s_name, s_rd, RECORDS);
 
   /* create random zone hash */
   GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);