gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] [taler-merchant] branch master updated (b237811 -> 1f67c7f)


From: gnunet
Subject: [GNUnet-SVN] [taler-merchant] branch master updated (b237811 -> 1f67c7f)
Date: Fri, 06 Oct 2017 21:11:52 +0200

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

grothoff pushed a change to branch master
in repository merchant.

    from b237811  fix extra start of retry_exchange task
     new e6a8b18  check return value from TALER_JSON_hash
     new 1f67c7f  check return value from TALER_amount_get_zero

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/backend/taler-merchant-httpd.c                   | 13 +++++++------
 src/backend/taler-merchant-httpd_pay.c               |  1 +
 src/backend/taler-merchant-httpd_proposal.c          | 13 ++++++++++---
 src/backend/taler-merchant-httpd_refund.c            |  2 ++
 src/backend/taler-merchant-httpd_track-transaction.c | 15 +++++++++++----
 src/backenddb/plugin_merchantdb_postgres.c           | 13 +++++++++----
 src/backenddb/test_merchantdb.c                      | 10 ++++++----
 src/lib/test_merchant_api.c                          |  5 +++--
 8 files changed, 49 insertions(+), 23 deletions(-)

diff --git a/src/backend/taler-merchant-httpd.c 
b/src/backend/taler-merchant-httpd.c
index 437537d..15086cc 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -234,7 +234,7 @@ url_handler (void *cls,
   for (unsigned int i=0;NULL != handlers[i].url;i++)
   {
     struct TMH_RequestHandler *rh = &handlers[i];
-    
+
     if ( (0 == strcasecmp (url,
                            rh->url)) &&
          ( (NULL == rh->method) ||
@@ -564,20 +564,21 @@ instances_iterator_cb (void *cls,
     iic->ret |= GNUNET_SYSERR;
   }
 
-  if (GNUNET_YES != TALER_JSON_hash (mi->j_wire,
-                                     &mi->h_wire))
+  if (GNUNET_OK !=
+      TALER_JSON_hash (mi->j_wire,
+                       &mi->h_wire))
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Failed to hash wireformat\n");
     iic->ret |= GNUNET_SYSERR;
   }
-  #define EXTRADEBUG
-  #ifdef EXTRADEBUGG
+#define EXTRADEBUG
+#ifdef EXTRADEBUGG
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "Found wireformat instance:\n");
               json_dumpf (mi->j_wire, stdout, 0);
               printf ("\n");
-  #endif
+#endif
 
   GNUNET_CRYPTO_hash (mi->id,
                       strlen (mi->id),
diff --git a/src/backend/taler-merchant-httpd_pay.c 
b/src/backend/taler-merchant-httpd_pay.c
index 600a9ac..3c3d43d 100644
--- a/src/backend/taler-merchant-httpd_pay.c
+++ b/src/backend/taler-merchant-httpd_pay.c
@@ -1246,6 +1246,7 @@ parse_pay (struct MHD_Connection *connection,
       TALER_JSON_hash (pc->contract_terms,
                        &pc->h_contract_terms))
   {
+    GNUNET_break (0);
     GNUNET_JSON_parse_free (spec);
     if (MHD_YES !=
         TMH_RESPONSE_reply_internal_error (connection,
diff --git a/src/backend/taler-merchant-httpd_proposal.c 
b/src/backend/taler-merchant-httpd_proposal.c
index 4cb6dc9..59bd62a 100644
--- a/src/backend/taler-merchant-httpd_proposal.c
+++ b/src/backend/taler-merchant-httpd_proposal.c
@@ -293,9 +293,16 @@ proposal_put (struct MHD_Connection *connection,
   /* create proposal signature */
   pdps.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_CONTRACT);
   pdps.purpose.size = htonl (sizeof (pdps));
-  GNUNET_assert (GNUNET_OK ==
-                 TALER_JSON_hash (order,
-                                  &pdps.hash));
+  if (GNUNET_OK !=
+      TALER_JSON_hash (order,
+                       &pdps.hash))
+  {
+    GNUNET_break (0);
+    GNUNET_JSON_parse_free (spec);
+    return TMH_RESPONSE_reply_internal_error (connection,
+                                              TALER_EC_INTERNAL_LOGIC_ERROR,
+                                              "Could not hash order");
+  }
 
   GNUNET_CRYPTO_eddsa_sign (&mi->privkey.eddsa_priv,
                             &pdps.purpose,
diff --git a/src/backend/taler-merchant-httpd_refund.c 
b/src/backend/taler-merchant-httpd_refund.c
index fc9e7a2..ad4ff32 100644
--- a/src/backend/taler-merchant-httpd_refund.c
+++ b/src/backend/taler-merchant-httpd_refund.c
@@ -210,6 +210,7 @@ MH_handler_refund_increase (struct TMH_RequestHandler *rh,
       TALER_JSON_hash (contract_terms,
                        &h_contract_terms))
   {
+    GNUNET_break (0);
     GNUNET_JSON_parse_free (spec);
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Could not hash contract terms\n");
@@ -456,6 +457,7 @@ MH_handler_refund_lookup (struct TMH_RequestHandler *rh,
       TALER_JSON_hash (contract_terms,
                        &h_contract_terms))
   {
+    GNUNET_break (0);
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Could not hash contract terms\n");
     return TMH_RESPONSE_reply_internal_error (connection,
diff --git a/src/backend/taler-merchant-httpd_track-transaction.c 
b/src/backend/taler-merchant-httpd_track-transaction.c
index 5101f3f..7a4d0c0 100644
--- a/src/backend/taler-merchant-httpd_track-transaction.c
+++ b/src/backend/taler-merchant-httpd_track-transaction.c
@@ -481,7 +481,7 @@ wire_deposits_cb (void *cls,
          break;
       }
       if (0 > qs)
-      { 
+      {
        /* Not good, but not fatal either, log error and continue */
        /* Special report if retries insufficient */
        GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR != qs);
@@ -1040,8 +1040,15 @@ MH_handler_track_transaction (struct TMH_RequestHandler 
*rh,
     return TMH_RESPONSE_reply_not_found (connection,
                                         TALER_EC_PROPOSAL_LOOKUP_NOT_FOUND,
                                         "Given order_id doesn't map to any 
proposal");
-  TALER_JSON_hash (contract_terms,
-                   &h_contract_terms);
+  if (GNUNET_OK !=
+      TALER_JSON_hash (contract_terms,
+                       &h_contract_terms))
+  {
+    json_decref (contract_terms);
+    return TMH_RESPONSE_reply_internal_error (connection,
+                                             TALER_EC_INTERNAL_LOGIC_ERROR,
+                                              "Failed to hash contract terms");
+  }
   json_decref (contract_terms);
 
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
@@ -1059,7 +1066,7 @@ MH_handler_track_transaction (struct TMH_RequestHandler 
*rh,
     return TMH_RESPONSE_reply_internal_error (connection,
                                              
TALER_EC_TRACK_TRANSACTION_DB_FETCH_TRANSACTION_ERROR,
                                               "Database error finding 
transaction");
-  }  
+  }
   if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
diff --git a/src/backenddb/plugin_merchantdb_postgres.c 
b/src/backenddb/plugin_merchantdb_postgres.c
index 249c0fa..d0265d5 100644
--- a/src/backenddb/plugin_merchantdb_postgres.c
+++ b/src/backenddb/plugin_merchantdb_postgres.c
@@ -699,7 +699,10 @@ postgres_insert_contract_terms (void *cls,
   if (GNUNET_OK !=
       TALER_JSON_hash (contract_terms,
                       &h_contract_terms))
+  {
+    GNUNET_break (0);
     return GNUNET_SYSERR;
+  }
   GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
               "inserting contract_terms: order_id: %s, merchant_pub: %s, 
h_contract_terms: %s.\n",
               order_id,
@@ -2129,8 +2132,9 @@ process_deposits_for_refund_cb (void *cls,
   struct TALER_Amount deposit_amount_with_fee[num_results];
   struct TALER_Amount deposit_refund_fee[num_results];
 
-  TALER_amount_get_zero (ctx->refund->currency,
-                         &current_refund);
+  GNUNET_assert (GNUNET_OK ==
+                 TALER_amount_get_zero (ctx->refund->currency,
+                                        &current_refund));
 
   /* Pass 1:  Collect amount of existing refunds into current_refund.
    * Also store existing refunded amount for each deposit in deposit_refund. */
@@ -2167,8 +2171,9 @@ process_deposits_for_refund_cb (void *cls,
       GNUNET_PQ_query_param_end
     };
 
-    TALER_amount_get_zero (ctx->refund->currency,
-                           &ictx.refunded_amount);
+    GNUNET_assert (GNUNET_OK ==
+                   TALER_amount_get_zero (ctx->refund->currency,
+                                          &ictx.refunded_amount));
     ictx.err = GNUNET_OK; /* no error so far */
     ires = GNUNET_PQ_eval_prepared_multi_select (ctx->pg->conn,
                                                  "find_refunds",
diff --git a/src/backenddb/test_merchantdb.c b/src/backenddb/test_merchantdb.c
index 683ebdd..eb4fe14 100644
--- a/src/backenddb/test_merchantdb.c
+++ b/src/backenddb/test_merchantdb.c
@@ -599,8 +599,9 @@ run (void *cls)
                                       "order",
                                       json_string ("2")));
 
-  TALER_JSON_hash (contract_terms,
-                   &h_contract_terms);
+  GNUNET_assert (GNUNET_OK ==
+                 TALER_JSON_hash (contract_terms,
+                                  &h_contract_terms));
 
   FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->insert_contract_terms (plugin->cls,
@@ -655,8 +656,9 @@ run (void *cls)
 
   fake_now = GNUNET_TIME_absolute_subtract (timestamp, delta);
 
-  TALER_JSON_hash (contract_terms_future,
-                   &h_contract_terms_future);
+  GNUNET_assert (GNUNET_OK ==
+                 TALER_JSON_hash (contract_terms_future,
+                                  &h_contract_terms_future));
 
   FAILIF (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT !=
           plugin->mark_proposal_paid (plugin->cls,
diff --git a/src/lib/test_merchant_api.c b/src/lib/test_merchant_api.c
index 10695b9..dbc2d5c 100644
--- a/src/lib/test_merchant_api.c
+++ b/src/lib/test_merchant_api.c
@@ -1328,8 +1328,9 @@ refund_lookup_cb (void *cls,
                          find_command (is,
                                        cmd->details.refund_lookup.pay_ref)));
   icoin_refs = GNUNET_strdup (pay->details.pay.coin_ref);
-  TALER_amount_get_zero ("EUR",
-                        &acc);
+  GNUNET_assert (GNUNET_OK ==
+                 TALER_amount_get_zero ("EUR",
+                                        &acc));
   for (icoin_ref = strtok (icoin_refs, ";");
        NULL != icoin_ref;
        icoin_ref = strtok (NULL, ";"))

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



reply via email to

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