-fixes
authorSchanzenbach, Martin <mschanzenbach@posteo.de>
Sun, 9 Jul 2017 20:37:00 +0000 (22:37 +0200)
committerSchanzenbach, Martin <mschanzenbach@posteo.de>
Sun, 9 Jul 2017 20:37:00 +0000 (22:37 +0200)
src/identity-provider/gnunet-idp.c
src/identity-provider/gnunet-service-identity-provider.c

index 2d7a1777fabbc6bb10c27e3d159ec8e702b843c4..6b2bdcc968b8500ac5c9b881248b59f92dbcf904 100644 (file)
@@ -207,8 +207,8 @@ abe_lookup_cb (void *cls,
                                                      (void**)&new_record.data);
     new_record.data_size = size;
     new_record.record_type = GNUNET_GNSRECORD_TYPE_ABE_MASTER;
-    new_record.expiration_time = GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us;
-    new_record.flags = GNUNET_GNSRECORD_RF_PRIVATE;
+    new_record.expiration_time = GNUNET_TIME_UNIT_DAYS.rel_value_us;
+    new_record.flags = GNUNET_GNSRECORD_RF_PRIVATE | GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
     ns_qe = GNUNET_NAMESTORE_records_store (namestore_handle,
                                             zone,
                                             "+",
@@ -243,7 +243,7 @@ abe_lookup_cb (void *cls,
   new_record.data_size = size;
   new_record.record_type = GNUNET_GNSRECORD_TYPE_ID_ATTR;
   new_record.expiration_time = GNUNET_TIME_UNIT_HOURS.rel_value_us;
-  new_record.flags = GNUNET_GNSRECORD_RF_NONE;
+  new_record.flags = GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION;
 
   ns_qe = GNUNET_NAMESTORE_records_store (namestore_handle,
                                           zone,
index 1a6619227382c3180ec25c50287e5da6ebb21459..8746e39f76d13e7cd0cfe2d122b7623051be8a31 100644 (file)
@@ -206,6 +206,8 @@ struct ParallelLookup
   struct GNUNET_GNS_LookupRequest *lookup_request;
 
   struct ExchangeHandle *handle;
+
+  char *label;
 };
 
 struct IssueHandle
@@ -567,7 +569,7 @@ serialize_abe_keyinfo (const struct IssueHandle *handle,
                  enc_keyinfo,
                  enc_size);
   GNUNET_free (enc_keyinfo);
-  return GNUNET_OK;
+  return sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)+enc_size;
 }
 
 static void
@@ -901,8 +903,8 @@ static void
 process_parallel_lookup (void *cls, uint32_t rd_count,
                          const struct GNUNET_GNSRECORD_Data *rd)
 {
-  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-              "Parallel lookup finished\n");
+  GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+              "Parallel lookup finished (count=%u)\n", rd_count);
   struct ParallelLookup *parallel_lookup = cls;
   struct ExchangeHandle *handle = parallel_lookup->handle;
   char *data;
@@ -920,9 +922,9 @@ process_parallel_lookup (void *cls, uint32_t rd_count,
                                    rd->data_size,
                                    handle->key,
                                    (void**)&data);
-      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding value: %s\n", data);
+      GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "Adding value: %s\n", data);
       token_add_attr (handle->token,
-                      label,
+                      parallel_lookup->label,
                       data);
       GNUNET_free (data);
     }
@@ -930,13 +932,13 @@ process_parallel_lookup (void *cls, uint32_t rd_count,
     i = 0;
     for (; i < rd_count; i++)
     {
-      if (rd->record_type == GNUNET_GNSRECORD_TYPE_ID_ATTR)
+      if (rd[i].record_type == GNUNET_GNSRECORD_TYPE_ID_ATTR)
       {
         data = GNUNET_GNSRECORD_value_to_string (rd[i].record_type,
                                                  rd[i].data,
                                                  rd[i].data_size);
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Adding value: %s\n", data);
-        token_add_attr (handle->token, label, data);
+        GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "Adding value: %s\n", data);
+        token_add_attr (handle->token, parallel_lookup->label, data);
         GNUNET_free (data);
       }
     }
@@ -958,6 +960,7 @@ abort_parallel_lookups (void *cls)
   for (lu = handle->parallel_lookups_head;
        NULL != lu;) {
     GNUNET_GNS_lookup_cancel (lu->lookup_request);
+    GNUNET_free (lu->label);
     tmp = lu->next;
     GNUNET_CONTAINER_DLL_remove (handle->parallel_lookups_head,
                                  handle->parallel_lookups_tail,
@@ -1019,7 +1022,8 @@ process_lookup_result (void *cls, uint32_t rd_count,
               size, rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey));
 
   scopes = GNUNET_strdup (buf);
-
+  GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+              "Scopes %s\n", scopes);
   handle->key = GNUNET_CRYPTO_cpabe_deserialize_key ((void*)(buf + strlen (scopes) + 1),
                                          rd->data_size - sizeof (struct GNUNET_CRYPTO_EcdhePublicKey)
                                          - strlen (scopes) - 1);
@@ -1027,15 +1031,17 @@ process_lookup_result (void *cls, uint32_t rd_count,
   for (scope = strtok (scopes, ","); NULL != scope; scope = strtok (NULL, ","))
   {
     GNUNET_asprintf (&lookup_query,
-                     "%s.%s.gnu",
-                     scope,
-                     GNUNET_CRYPTO_ecdsa_public_key_to_string (&handle->ticket->payload->identity_key));
+                     "%s.gnu",
+                     scope);
+    GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE,
+                "Looking up %s\n", lookup_query);
     parallel_lookup = GNUNET_new (struct ParallelLookup);
     parallel_lookup->handle = handle;
+    parallel_lookup->label = GNUNET_strdup (scope);
     parallel_lookup->lookup_request
       = GNUNET_GNS_lookup (gns_handle,
                            lookup_query,
-                           &handle->ticket->aud_key,
+                           &handle->ticket->payload->identity_key,
                            GNUNET_GNSRECORD_TYPE_ID_ATTR,
                            GNUNET_GNS_LO_LOCAL_MASTER,
                            &process_parallel_lookup,