gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] 01/03: fixed uuid issue


From: gnunet
Subject: [taler-anastasis] 01/03: fixed uuid issue
Date: Mon, 20 Apr 2020 23:18:21 +0200

This is an automated email from the git hooks/post-receive script.

dennis-neufeld pushed a commit to branch master
in repository anastasis.

commit 584f35cc8df4bbf7a69608abbf9839b4ce357611
Author: Dennis Neufeld <address@hidden>
AuthorDate: Mon Apr 20 12:38:53 2020 +0000

    fixed uuid issue
---
 src/backend/anastasis-httpd_truth.c       |   3 +
 src/lib/anastasis_api_keyshare_lookup.c   |  26 ++--
 src/lib/anastasis_api_truth_store.c       |   4 +-
 src/lib/testing_api_cmd_keyshare_lookup.c | 213 +++++++++++++++---------------
 src/lib/testing_api_cmd_truth_store.c     |  20 +--
 5 files changed, 127 insertions(+), 139 deletions(-)

diff --git a/src/backend/anastasis-httpd_truth.c 
b/src/backend/anastasis-httpd_truth.c
index 25de255..755cd78 100644
--- a/src/backend/anastasis-httpd_truth.c
+++ b/src/backend/anastasis-httpd_truth.c
@@ -67,6 +67,9 @@ AH_handler_truth_get (struct MHD_Connection *connection,
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Uuid from Url (keyshare lookup): %s\n",
                 uuid_str);
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Uuid from Url (keyshare lookup): %s\n",
+                TALER_B2S (&uuid));
 
     challenge_response_s = MHD_lookup_connection_value (connection,
                                                         MHD_GET_ARGUMENT_KIND,
diff --git a/src/lib/anastasis_api_keyshare_lookup.c 
b/src/lib/anastasis_api_keyshare_lookup.c
index a70596a..c7e47ab 100644
--- a/src/lib/anastasis_api_keyshare_lookup.c
+++ b/src/lib/anastasis_api_keyshare_lookup.c
@@ -250,7 +250,7 @@ ANASTASIS_keyshare_lookup (struct GNUNET_CURL_Context *ctx,
 {
   struct ANASTASIS_KeyShareLookupOperation *kslo;
   CURL *eh;
-  char *uuid_str;
+  char uuid_str[37];
   char *hashed_answer_str;
   char *path;
 
@@ -259,19 +259,16 @@ ANASTASIS_keyshare_lookup (struct GNUNET_CURL_Context 
*ctx,
   kslo->cb = cb;
   kslo->cb_cls = cb_cls;
   kslo->truth_key = truth_key;
-    << << << < HEAD
 
-    GNUNET_assert (NULL != truth_uuid);
-  uuid_str = GNUNET_STRINGS_data_to_string_alloc (truth_uuid,
-                                                  sizeof (*truth_uuid));
+  GNUNET_assert (GNUNET_NO == uuid_is_null (*truth_uuid));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "UUID in keyshare lookup: %s\n",
+              TALER_B2S (truth_uuid));
+  uuid_unparse (*truth_uuid, uuid_str);
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "UUID in keyshare lookup:  %s\n",
               uuid_str);
   GNUNET_assert (NULL != hashed_answer);
-  ====== =
-    uuid_str = GNUNET_STRINGS_data_to_string_alloc (truth_uuid,
-                                                    sizeof (*truth_uuid));
-  >> >> >> > f6a488c ... modified salt request
   hashed_answer_str = GNUNET_STRINGS_data_to_string_alloc (hashed_answer,
                                                            sizeof (struct
                                                                    
GNUNET_HashCode));
@@ -286,13 +283,10 @@ ANASTASIS_keyshare_lookup (struct GNUNET_CURL_Context 
*ctx,
   GNUNET_free (path);
   GNUNET_free (uuid_str);
   GNUNET_free (hashed_answer_str);
-    << << << < HEAD
-    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                "Url get request (keyshare lookup): %s\n",
-                kslo->url);
-  ====== =
-    >> >> >> > f6a488c ... modified salt request
-    eh = curl_easy_init ();
+  GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+              "Url get request (keyshare lookup): %s\n",
+              kslo->url);
+  eh = curl_easy_init ();
   GNUNET_assert (CURLE_OK ==
                  curl_easy_setopt (eh,
                                    CURLOPT_HEADERFUNCTION,
diff --git a/src/lib/anastasis_api_truth_store.c 
b/src/lib/anastasis_api_truth_store.c
index 7552364..f4c744d 100644
--- a/src/lib/anastasis_api_truth_store.c
+++ b/src/lib/anastasis_api_truth_store.c
@@ -316,8 +316,10 @@ ANASTASIS_truth_store (struct GNUNET_CURL_Context *ctx,
                   "No uuid set");
       return NULL;
     }
-
   }
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "URL before curl:  %s\n",
+              tso->url);
   tso->ctx = ctx;
   tso->cb = cb;
   tso->cb_cls = cb_cls;
diff --git a/src/lib/testing_api_cmd_keyshare_lookup.c 
b/src/lib/testing_api_cmd_keyshare_lookup.c
index ec2f491..4807f01 100644
--- a/src/lib/testing_api_cmd_keyshare_lookup.c
+++ b/src/lib/testing_api_cmd_keyshare_lookup.c
@@ -131,56 +131,53 @@ keyshare_lookup_run (void *cls,
       TALER_TESTING_interpreter_fail (ksls->is);
       return;
     }
-      << << << < HEAD
-        {
-        const uuid_t *uuid;
-
-        if (GNUNET_OK !=
-            ANASTASIS_TESTING_get_trait_uuid (upload_cmd,
-                                              0,
-                                              &uuid))
-        {
-          GNUNET_break (0);
-          TALER_TESTING_interpreter_fail (ksls->is);
-          return;
-        }
-        ksls->truth_uuid = uuid;
-        if (NULL == ksls->truth_uuid)
-        {
-          GNUNET_break (0);
-          TALER_TESTING_interpreter_fail (ksls->is);
-          return;
-        }
-        GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                    "Uuid from trait: %s\n",
-                    TALER_B2S (ksls->truth_uuid));
-
-        ====== =
-          if (GNUNET_OK !=
-              ANASTASIS_TESTING_get_trait_uuid (upload_cmd,
-                                                0,
-                                                &ksls->truth_uuid))
-        {
-          GNUNET_break (0);
-          TALER_TESTING_interpreter_fail (ksls->is);
-          return;
-          >> >> >> > f6a488c ... modified salt request
-        }
-      }
-      ksls->kslo = ANASTASIS_keyshare_lookup (is->ctx,
-                                              ksls->anastasis_url,
-                                              ksls->truth_uuid,
-                                              ksls->truth_key,
-                                              &ksls->hashed_answer,
-                                              &keyshare_lookup_cb,
-                                              ksls);
-    if (NULL == ksls->kslo)
     {
-      GNUNET_break (0);
-      TALER_TESTING_interpreter_fail (ksls->is);
-      return;
+      const uuid_t *uuid;
+
+      if (GNUNET_OK !=
+          ANASTASIS_TESTING_get_trait_uuid (upload_cmd,
+                                            0,
+                                            &uuid))
+      {
+        GNUNET_break (0);
+        TALER_TESTING_interpreter_fail (ksls->is);
+        return;
+      }
+      ksls->truth_uuid = uuid;
+      if (NULL == ksls->truth_uuid)
+      {
+        GNUNET_break (0);
+        TALER_TESTING_interpreter_fail (ksls->is);
+        return;
+      }
+      GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+                  "Uuid from trait: %s\n",
+                  TALER_B2S (ksls->truth_uuid));
+      if (GNUNET_OK !=
+          ANASTASIS_TESTING_get_trait_uuid (upload_cmd,
+                                            0,
+                                            &ksls->truth_uuid))
+      {
+        GNUNET_break (0);
+        TALER_TESTING_interpreter_fail (ksls->is);
+        return;
+      }
     }
   }
+  ksls->kslo = ANASTASIS_keyshare_lookup (is->ctx,
+                                          ksls->anastasis_url,
+                                          ksls->truth_uuid,
+                                          ksls->truth_key,
+                                          &ksls->hashed_answer,
+                                          &keyshare_lookup_cb,
+                                          ksls);
+  if (NULL == ksls->kslo)
+  {
+    GNUNET_break (0);
+    TALER_TESTING_interpreter_fail (ksls->is);
+    return;
+  }
+}
 
 
 /**
@@ -190,22 +187,22 @@ keyshare_lookup_run (void *cls,
  * @param cls closure.
  * @param cmd command being freed.
  */
-  static void
-  keyshare_lookup_cleanup (void *cls,
-                           const struct TALER_TESTING_Command *cmd)
-  {
-    struct KeyShareLookupState *ksls = cls;
+static void
+keyshare_lookup_cleanup (void *cls,
+                         const struct TALER_TESTING_Command *cmd)
+{
+  struct KeyShareLookupState *ksls = cls;
 
-    if (NULL != ksls->kslo)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
-                  "Command '%s' did not complete (keyshare lookup)\n",
-                  cmd->label);
-      ANASTASIS_keyshare_lookup_cancel (ksls->kslo);
-      ksls->kslo = NULL;
-    }
-    GNUNET_free (ksls);
+  if (NULL != ksls->kslo)
+  {
+    GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
+                "Command '%s' did not complete (keyshare lookup)\n",
+                cmd->label);
+    ANASTASIS_keyshare_lookup_cancel (ksls->kslo);
+    ksls->kslo = NULL;
   }
+  GNUNET_free (ksls);
+}
 
 
 /**
@@ -215,19 +212,19 @@ keyshare_lookup_run (void *cls,
  * @param size_answer size of the answer
  * @return hash of the answer
  */
-  struct GNUNET_HashCode
-  ANASTASIS_TESTING_make_hashed_answer (const void *answer,
-                                        size_t size_answer)
-  {
-    struct GNUNET_HashCode hashed_answer;
-    GNUNET_CRYPTO_hash (answer,
-                        size_answer,
-                        &hashed_answer);
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Hashed answer: %s\n",
-                TALER_B2S (&hashed_answer));
-    return hashed_answer;
-  }
+struct GNUNET_HashCode
+ANASTASIS_TESTING_make_hashed_answer (const void *answer,
+                                      size_t size_answer)
+{
+  struct GNUNET_HashCode hashed_answer;
+  GNUNET_CRYPTO_hash (answer,
+                      size_answer,
+                      &hashed_answer);
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Hashed answer: %s\n",
+              TALER_B2S (&hashed_answer));
+  return hashed_answer;
+}
 
 
 /**
@@ -242,42 +239,42 @@ keyshare_lookup_run (void *cls,
  * @param upload_ref reference to upload command
  * @return the command
  */
-  struct TALER_TESTING_Command
-  ANASTASIS_TESTING_cmd_keyshare_lookup (const char *label,
-                                         const char *anastasis_url,
-                                         unsigned int http_status,
-                                         const struct GNUNET_HashCode answer,
-                                         const struct
-                                         ANASTASIS_CRYPTO_TruthKey *key,
-                                         const char *upload_ref)
+struct TALER_TESTING_Command
+ANASTASIS_TESTING_cmd_keyshare_lookup (const char *label,
+                                       const char *anastasis_url,
+                                       unsigned int http_status,
+                                       const struct GNUNET_HashCode answer,
+                                       const struct
+                                       ANASTASIS_CRYPTO_TruthKey *key,
+                                       const char *upload_ref)
+{
+  struct KeyShareLookupState *ksls;
+
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "Hashed answer in keyshare lookup cmd: %s\n",
+              TALER_B2S (&answer));
+  GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+              "TruthKey in keyshare lookup cmd: %s\n",
+              TALER_B2S (key));
+
+  GNUNET_assert (NULL != upload_ref);
+  ksls = GNUNET_new (struct KeyShareLookupState);
+  ksls->http_status = http_status;
+  ksls->anastasis_url = anastasis_url;
+  ksls->upload_reference = upload_ref;
+  ksls->hashed_answer = answer;
+  ksls->truth_key = key;
   {
-    struct KeyShareLookupState *ksls;
-
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Hashed answer in keyshare lookup cmd: %s\n",
-                TALER_B2S (&answer));
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "TruthKey in keyshare lookup cmd: %s\n",
-                TALER_B2S (key));
-
-    GNUNET_assert (NULL != upload_ref);
-    ksls = GNUNET_new (struct KeyShareLookupState);
-    ksls->http_status = http_status;
-    ksls->anastasis_url = anastasis_url;
-    ksls->upload_reference = upload_ref;
-    ksls->hashed_answer = answer;
-    ksls->truth_key = key;
-    {
-      struct TALER_TESTING_Command cmd = {
-        .cls = ksls,
-        .label = label,
-        .run = &keyshare_lookup_run,
-        .cleanup = &keyshare_lookup_cleanup
-      };
-
-      return cmd;
-    }
+    struct TALER_TESTING_Command cmd = {
+      .cls = ksls,
+      .label = label,
+      .run = &keyshare_lookup_run,
+      .cleanup = &keyshare_lookup_cleanup
+    };
+
+    return cmd;
   }
+}
 
 
 /* end of testing_api_cmd_keyshare_lookup.c */
\ No newline at end of file
diff --git a/src/lib/testing_api_cmd_truth_store.c 
b/src/lib/testing_api_cmd_truth_store.c
index bb52a4c..3c8ea12 100644
--- a/src/lib/testing_api_cmd_truth_store.c
+++ b/src/lib/testing_api_cmd_truth_store.c
@@ -51,7 +51,7 @@ struct TruthStoreState
   /**
    * Uuid of truth
    */
-  const uuid_t *truth_uuid;
+  uuid_t truth_uuid;
 
   /**
    * Hash of the current upload.
@@ -264,20 +264,16 @@ truth_store_run (void *cls,
   }
   {
     // Create an uuid
-    uuid_t truth_uuid;
-    uuid_generate (truth_uuid);
-    tss->truth_uuid = &truth_uuid;
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                "Uuid created: %s\n",
-                TALER_B2S (&truth_uuid));
+    uuid_generate (tss->truth_uuid);
+    GNUNET_assert (GNUNET_NO == uuid_is_null (tss->truth_uuid));
     GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                 "Uuid stored in tss: %s\n",
-                TALER_B2S (tss->truth_uuid));
+                TALER_B2S (&tss->truth_uuid));
   }
 
   tss->tso = ANASTASIS_truth_store (is->ctx,
                                     tss->anastasis_url,
-                                    tss->truth_uuid,
+                                    &tss->truth_uuid,
                                     tss->truth_data,
                                     (0 !=
                                      (ANASTASIS_TESTING_TSO_REQUEST_PAYMENT
@@ -341,11 +337,7 @@ truth_store_traits (void *cls,
     ANASTASIS_TESTING_make_trait_hash (ANASTASIS_TESTING_TRAIT_HASH_CURRENT,
                                        &tss->curr_hash),
     ANASTASIS_TESTING_make_trait_uuid (0,
-                                       << << << < HEAD
-                                       tss->truth_uuid),
-    ====== =
-      &tss->truth_uuid),
-    >> >> >> > f6a488c ... modified salt request
+                                       &tss->truth_uuid),
     TALER_TESTING_make_trait_order_id (0,
                                        tss->payment_order_id),
     TALER_TESTING_trait_end ()

-- 
To stop receiving notification emails like this one, please contact
address@hidden.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]