doxygen fix
[oweals/gnunet.git] / src / namestore / test_namestore_api_lookup_specific_type.c
index 3f209885837757d4d629dcb851af3f4934d66fc7..3cc2ad7ba25852a6d74f993e05b3fe10f3277c43 100644 (file)
@@ -47,7 +47,7 @@ static struct GNUNET_OS_Process *arm;
 static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
 static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
 struct GNUNET_CRYPTO_RsaSignature *s_signature;
-static GNUNET_HashCode s_zone;
+static struct GNUNET_CRYPTO_ShortHashCode s_zone;
 struct GNUNET_NAMESTORE_RecordData *s_rd;
 static char *s_name;
 
@@ -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;
   }
@@ -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,12 @@ 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,
+      "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.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,10 +343,10 @@ 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);
+  GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
 
   start_arm (cfgfile);
   GNUNET_assert (arm != NULL);