fix
[oweals/gnunet.git] / src / gns / test_gns_simple_delegated_lookup.c
index 9e5226285c39f29a40885ecd256f21172bbc677a..af126a29790fed26ce84642be9cbc88fb997b456 100644 (file)
@@ -109,6 +109,7 @@ on_lookup_result(void *cls, uint32_t rd_count,
   int i;
   char* addr;
   
+  GNUNET_NAMESTORE_disconnect (namestore_handle);
   if (rd_count == 0)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@@ -122,7 +123,7 @@ on_lookup_result(void *cls, uint32_t rd_count,
     for (i=0; i<rd_count; i++)
     {
       GNUNET_log (GNUNET_ERROR_TYPE_INFO, "type: %d\n", rd[i].record_type);
-      if (rd[i].record_type == GNUNET_GNS_RECORD_TYPE_A)
+      if (rd[i].record_type == GNUNET_GNS_RECORD_A)
       {
         memcpy(&a, rd[i].data, sizeof(a));
         addr = inet_ntoa(a);
@@ -153,7 +154,6 @@ on_lookup_result(void *cls, uint32_t rd_count,
 static void
 commence_testing (void *cls, int32_t success, const char *emsg)
 {
-  GNUNET_NAMESTORE_disconnect(namestore_handle, GNUNET_YES);
 
   gns_handle = GNUNET_GNS_connect(cfg);
 
@@ -163,7 +163,7 @@ commence_testing (void *cls, int32_t success, const char *emsg)
                 "Failed to connect to GNS!\n");
   }
 
-  GNUNET_GNS_lookup(gns_handle, TEST_DOMAIN, GNUNET_GNS_RECORD_TYPE_A,
+  GNUNET_GNS_lookup(gns_handle, TEST_DOMAIN, GNUNET_GNS_RECORD_A,
                     GNUNET_NO,
                     NULL,
                     &on_lookup_result, TEST_DOMAIN);
@@ -208,6 +208,7 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
   struct GNUNET_CRYPTO_ShortHashCode bob_hash;
   struct GNUNET_CRYPTO_RsaSignature *sig;
   char* alice_keyfile;
+  struct GNUNET_TIME_Absolute et;
 
   cfg = _cfg;
 
@@ -240,7 +241,7 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
   struct GNUNET_NAMESTORE_RecordData rd;
   char* ip = TEST_IP;
   struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr));
-  rd.expiration = GNUNET_TIME_UNIT_FOREVER_ABS;
+  rd.expiration_time = UINT64_MAX;
   GNUNET_assert(1 == inet_pton (AF_INET, ip, web));
   
   GNUNET_CRYPTO_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash);
@@ -248,6 +249,7 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
   rd.data_size = sizeof(struct GNUNET_CRYPTO_ShortHashCode);
   rd.data = &bob_hash;
   rd.record_type = GNUNET_GNS_RECORD_PKEY;
+  rd.flags = GNUNET_NAMESTORE_RF_AUTHORITY;
 
   GNUNET_NAMESTORE_record_create (namestore_handle,
                                   alice_key,
@@ -263,11 +265,11 @@ do_lookup(void *cls, const struct GNUNET_PeerIdentity *id,
                                           GNUNET_TIME_UNIT_FOREVER_ABS,
                                           TEST_RECORD_NAME,
                                           &rd, 1);
-
+  et.abs_value = rd.expiration_time;
   GNUNET_NAMESTORE_record_put (namestore_handle,
                                &bob_pkey,
                                TEST_RECORD_NAME,
-                               rd.expiration,
+                               et,
                                1,
                                &rd,
                                sig,