gnunet-svn
[Top][All Lists]
Advanced

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

[taler-anastasis] branch master updated: fix ftbfs


From: gnunet
Subject: [taler-anastasis] branch master updated: fix ftbfs
Date: Tue, 20 Oct 2020 14:43:43 +0200

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

grothoff pushed a commit to branch master
in repository anastasis.

The following commit(s) were added to refs/heads/master by this push:
     new ac46433  fix ftbfs
ac46433 is described below

commit ac464339f7a2f8e646111a2255786e9b2be57dfc
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Tue Oct 20 14:43:41 2020 +0200

    fix ftbfs
---
 src/cli/anastasis-cli-splitter.c   | 47 ++++++++++++--------------------------
 src/include/anastasis.h            |  6 ++---
 src/include/anastasis_service.h    |  2 +-
 src/lib/anastasis.c                | 25 ++++----------------
 src/lib/testing_cmd_secret_share.c | 18 ++++++---------
 5 files changed, 30 insertions(+), 68 deletions(-)

diff --git a/src/cli/anastasis-cli-splitter.c b/src/cli/anastasis-cli-splitter.c
index 9a1b80e..32c615d 100644
--- a/src/cli/anastasis-cli-splitter.c
+++ b/src/cli/anastasis-cli-splitter.c
@@ -280,15 +280,6 @@ struct SecretShareState
    */
   const char *payment_order_id;
 
-  /**
-   * Details of a past payment
-   */
-  const struct ANASTASIS_PaymentDetails **pds;
-
-  /**
-   * Length of pds.
-   */
-  unsigned int pds_len;
 };
 
 
@@ -350,7 +341,7 @@ static unsigned int pc_states_length = 0;
 /**
  * PaymentDetails.
  */
-static struct ANASTASIS_PaymentDetails **pds;
+static struct ANASTASIS_PaymentDetails *pds;
 
 /**
  * Amount of pds.
@@ -432,9 +423,9 @@ secret_share_payment_cb (void *cls,
               "At %s:%d Order ID from Anastasis service is %s\n",
               __FILE__, __LINE__,
               sss->payment_order_id);
-  for (unsigned int i = 0; i < sss->pds_len; i++)
+  for (unsigned int i = 0; i < pds_length; i++)
   {
-    if (0 == strcmp (sss->pds[i]->provider_url,
+    if (0 == strcmp (pds[i].provider_url,
                      server_url))
     {
       printf ("Server#%u failure: 402 payment required: %s %s\n",
@@ -568,8 +559,7 @@ config_cb (void *cls,
            const struct TALER_Amount *annual_fee)
 {
   struct ConfigState *cs = cls;
-  struct ANASTASIS_PaymentDetails *pd = GNUNET_new (struct
-                                                    ANASTASIS_PaymentDetails);
+  struct ANASTASIS_PaymentDetails pd;
 
   cs->co = NULL;
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -596,7 +586,10 @@ config_cb (void *cls,
 
   cs->server->backend_methods = cs->methods;
   cs->server->backend_cost = &cs->cost;
-  pd->provider_url = cs->server->backend_url;
+  memset (&pd,
+          0,
+          sizeof (pd));
+  pd.provider_url = cs->server->backend_url;
   GNUNET_array_append (pds,
                        pds_length,
                        pd);
@@ -1348,13 +1341,7 @@ read_keyboard_command (void *cls)
         if (characters > 1)
         {
           add_history (buffer);
-          pds[i]->payment_order_id = GNUNET_malloc (characters + 1);
-          GNUNET_strlcpy (pds[i]->payment_order_id,
-                          buffer,
-                          characters + 1);
-          GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
-                      "At %s:%d payment secret is %s\n", __FILE__, __LINE__,
-                      pds[i]->payment_order_id);
+          pds[i].payment_order_id = GNUNET_strdup (buffer); // FIXME: leaks!
           free (buffer);
           buffer = (char *) NULL;
         }
@@ -1364,23 +1351,19 @@ read_keyboard_command (void *cls)
         */
         else
         {
-          if (pds[i]->payment_order_id)
-          {
-            GNUNET_free (pds[i]->payment_order_id);
-            pds[i]->payment_order_id = NULL;
-          }
+          GNUNET_free (pds[i].payment_order_id);
         }
         printf ("\n");
       }
-      sss->pds = (const struct ANASTASIS_PaymentDetails **) pds;
-      sss->pds_len = pds_length;
+      // FIXME: pds not as global
+      // FIXME: pds content???
       sss->sso = ANASTASIS_secret_share (ctx,
                                          sss->id_data,
                                          NULL,
                                          policies,
                                          pc_states_length,
-                                         sss->pds,
-                                         sss->pds_len,
+                                         pds,
+                                         pds_length,
                                          &secret_share_payment_cb,
                                          sss,
                                          &secret_share_result_cb,
@@ -1568,4 +1551,4 @@ main (int argc,
 }
 
 
-/* end of anastasis-cli-spliter.c */
\ No newline at end of file
+/* end of anastasis-cli-spliter.c */
diff --git a/src/include/anastasis.h b/src/include/anastasis.h
index 845ef5c..587222b 100644
--- a/src/include/anastasis.h
+++ b/src/include/anastasis.h
@@ -40,7 +40,7 @@ struct ANASTASIS_PaymentDetails
   /**
    * Payment order ID of a past payment
    */
-  char *payment_order_id;
+  const char *payment_order_id;
 };
 
 
@@ -407,7 +407,7 @@ struct ANASTASIS_SecretShare;
 * @param policies list of policies which are included in this recovery document
 * @param policies_length amount of policies in the document
 * @param pds contains details of past payments
-* @param pds_len length of pds array
+* @param pds_len length of @a pds array
 * @param spc payment callback is opened to pay the upload
 * @param spc_cls closure for the payment callback
 * @param src callback for the upload process
@@ -421,7 +421,7 @@ ANASTASIS_secret_share (struct GNUNET_CURL_Context *ctx,
                         const struct GNUNET_HashCode *last_etag,
                         const struct ANASTASIS_Policy *policies[],
                         unsigned int policies_len,
-                        const struct ANASTASIS_PaymentDetails *pds[],
+                        const struct ANASTASIS_PaymentDetails *pds,
                         unsigned int pds_len,
                         ANASTASIS_SharePaymentCallback spc,
                         void *spc_cls,
diff --git a/src/include/anastasis_service.h b/src/include/anastasis_service.h
index 9bcb028..afe93a8 100644
--- a/src/include/anastasis_service.h
+++ b/src/include/anastasis_service.h
@@ -420,7 +420,7 @@ typedef void
  * @param recovery_data policy data to be stored
  * @param recovery_data_size number of bytes in @a recovery_data
  * @param payment_requested #GNUNET_YES if the client wants to pay more for 
the account now
- * @param paymentSecretP payment identifier of last payment
+ * @param payment_order_id payment identifier of last payment
  * @param cb callback processing the response from /policy
  * @param cb_cls closure for cb
  * @return handle for the operation
diff --git a/src/lib/anastasis.c b/src/lib/anastasis.c
index 73b1224..d2844f9 100644
--- a/src/lib/anastasis.c
+++ b/src/lib/anastasis.c
@@ -1579,30 +1579,13 @@ ANASTASIS_get_num_urls (const struct ANASTASIS_Policy 
*policies[],
 }
 
 
-/**
-* Creates a recovery document with the created policies.
-*
-* @param ctx the CURL context used to connect to the backend
-* @param id_data used to create a account identifier on the escrow provider
-* @param last_etag NULL on 'first' use, otherwise 'current_etag' from previous 
ShareResultCallback
-* @param policies list of policies which are included in this recovery document
-* @param policies_length amount of policies in the document
-* @param pds contains details of past payments
-* @param pds_len length of pds array
-* @param spc payment callback is opened to pay the upload
-* @param spc_cls closure for the payment callback
-* @param src callback for the upload process
-* @param src_cls closure for the upload callback
-* @param core_secret input of the user which is secured by anastasis e.g. 
(wallet private key)
-* @param core_secret_size size of the core secret
-*/
 struct ANASTASIS_SecretShare *
 ANASTASIS_secret_share (struct GNUNET_CURL_Context *ctx,
                         const json_t *id_data,
                         const struct GNUNET_HashCode *last_etag,
                         const struct ANASTASIS_Policy *policies[],
                         unsigned int policies_len,
-                        const struct ANASTASIS_PaymentDetails *pds[],
+                        const struct ANASTASIS_PaymentDetails *pds,
                         unsigned int pds_len,
                         ANASTASIS_SharePaymentCallback spc,
                         void *spc_cls,
@@ -1613,7 +1596,6 @@ ANASTASIS_secret_share (struct GNUNET_CURL_Context *ctx,
 {
 
   struct ANASTASIS_SecretShare *ss;
-
   unsigned int pss_length = ANASTASIS_get_num_urls (policies,
                                                     policies_len);
   struct PolicyStoreState *pss[pss_length];
@@ -1830,10 +1812,11 @@ ANASTASIS_secret_share (struct GNUNET_CURL_Context *ctx,
         {
           for (unsigned int m = 0; 0 < pds_len; m++)
           {
-            if (0 == strcmp (pds[m]->provider_url,
+            if (0 == strcmp (pds[m].provider_url,
                              policies[k]->truths[l]->url))
             {
-              ss->pss[index_pss]->payment_order_id = pds[m]->payment_order_id;
+              ss->pss[index_pss]->payment_order_id
+                = GNUNET_strdup (pds[m].payment_order_id);
               break;
             }
           }
diff --git a/src/lib/testing_cmd_secret_share.c 
b/src/lib/testing_cmd_secret_share.c
index 94c9ad8..4c777f7 100644
--- a/src/lib/testing_cmd_secret_share.c
+++ b/src/lib/testing_cmd_secret_share.c
@@ -112,10 +112,6 @@ struct SecretShareState
    */
   const char *payment_order_id;
 
-  /**
-   * Details of a past payment
-   */
-  struct ANASTASIS_PaymentDetails *pd;
 };
 
 
@@ -257,7 +253,7 @@ secret_share_run (void *cls,
   struct SecretShareState *sss = cls;
   const struct ANASTASIS_Policy *policies[sss->cmd_label_array_length];
   unsigned int pds_len = 1;
-  const struct ANASTASIS_PaymentDetails *pds[pds_len];
+  struct ANASTASIS_PaymentDetails pds[pds_len];
 
   GNUNET_assert (sss->cmd_label_array_length > 0);
   GNUNET_assert (NULL != sss->cmd_label_array);
@@ -334,11 +330,11 @@ secret_share_run (void *cls,
     }
   }
 
-  sss->pd = GNUNET_new (struct ANASTASIS_PaymentDetails);
-  sss->pd->payment_order_id = sss->payment_order_id;
-  sss->pd->provider_url = sss->anastasis_url;
-  pds[0] = sss->pd;
-
+  memset (pds,
+          0,
+          sizeof (pds));
+  pds[0].payment_order_id = sss->payment_order_id;
+  pds[0].provider_url = sss->anastasis_url;
   sss->sso = ANASTASIS_secret_share (is->ctx,
                                      sss->id_data,
                                      NULL,
@@ -481,4 +477,4 @@ ANASTASIS_TESTING_cmd_secret_share (const char *label,
 }
 
 
-/* end of testing_cmd_secret_share.c */
\ No newline at end of file
+/* end of testing_cmd_secret_share.c */

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

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