gnunet-svn
[Top][All Lists]
Advanced

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

[taler-exchange] branch master updated: -misc minor fixes


From: gnunet
Subject: [taler-exchange] branch master updated: -misc minor fixes
Date: Fri, 22 Sep 2023 12:59:40 +0200

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

grothoff pushed a commit to branch master
in repository exchange.

The following commit(s) were added to refs/heads/master by this push:
     new 515ae722 -misc minor fixes
515ae722 is described below

commit 515ae722f5a1c48e73a3cfb205719ec7443031b6
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Fri Sep 22 12:59:32 2023 +0200

    -misc minor fixes
---
 src/bank-lib/fakebank_bank.c                       |  2 +-
 src/exchange/taler-exchange-httpd_age-withdraw.c   |  8 ++++--
 src/lib/exchange_api_management_auditor_enable.c   | 15 ++++++++++
 src/lib/exchange_api_management_get_keys.c         | 15 ++++++++++
 src/lib/exchange_api_management_post_extensions.c  | 17 ++++++++++--
 src/lib/exchange_api_management_set_global_fee.c   | 15 ++++++++++
 src/lib/exchange_api_management_set_wire_fee.c     | 15 ++++++++++
 .../exchange_api_management_update_aml_officer.c   | 15 ++++++++++
 src/lib/exchange_api_management_wire_disable.c     | 17 ++++++++++--
 src/lib/exchange_api_management_wire_enable.c      | 15 ++++++++++
 src/lib/exchange_api_reserves_history.c            |  1 +
 src/pq/pq_query_helper.c                           | 32 ++++++++++------------
 src/testing/testing_api_cmd_age_withdraw.c         | 15 ++++++----
 src/testing/testing_api_cmd_oauth.c                |  9 ++++--
 src/testing/testing_api_twister_helpers.c          |  4 ++-
 src/util/crypto_confirmation.c                     |  7 +++--
 16 files changed, 163 insertions(+), 39 deletions(-)

diff --git a/src/bank-lib/fakebank_bank.c b/src/bank-lib/fakebank_bank.c
index c55e9efc..8c3c48d1 100644
--- a/src/bank-lib/fakebank_bank.c
+++ b/src/bank-lib/fakebank_bank.c
@@ -242,7 +242,7 @@ TALER_FAKEBANK_bank_main_ (
         url);
     }
 
-    if ( (NULL == end_acc) &&
+    if ( (NULL != end_acc) &&
          (0 == strcmp ("/auth",
                        end_acc)) &&
          (0 == strcasecmp (method,
diff --git a/src/exchange/taler-exchange-httpd_age-withdraw.c 
b/src/exchange/taler-exchange-httpd_age-withdraw.c
index b6e456c4..69235da2 100644
--- a/src/exchange/taler-exchange-httpd_age-withdraw.c
+++ b/src/exchange/taler-exchange-httpd_age-withdraw.c
@@ -429,8 +429,12 @@ are_denominations_valid (
   *denom_serials =
     serials = GNUNET_new_array (len, uint64_t);
 
-  TALER_amount_set_zero (TEH_currency, &total_amount);
-  TALER_amount_set_zero (TEH_currency, &total_fee);
+  GNUNET_assert (GNUNET_OK ==
+                 TALER_amount_set_zero (TEH_currency,
+                                        &total_amount));
+  GNUNET_assert (GNUNET_OK ==
+                 TALER_amount_set_zero (TEH_currency,
+                                        &total_fee));
 
   for (uint32_t i = 0; i < len; i++)
   {
diff --git a/src/lib/exchange_api_management_auditor_enable.c 
b/src/lib/exchange_api_management_auditor_enable.c
index 65018577..41c5049c 100644
--- a/src/lib/exchange_api_management_auditor_enable.c
+++ b/src/lib/exchange_api_management_auditor_enable.c
@@ -96,6 +96,21 @@ handle_auditor_enable_finished (void *cls,
     aer.hr.ec = TALER_JSON_get_error_code (json);
     aer.hr.hint = TALER_JSON_get_error_hint (json);
     break;
+  case MHD_HTTP_NOT_FOUND:
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Server did not find handler at `%s'. Did you configure the 
correct exchange base URL?\n",
+                ah->url);
+    if (NULL != json)
+    {
+      aer.hr.ec = TALER_JSON_get_error_code (json);
+      aer.hr.hint = TALER_JSON_get_error_hint (json);
+    }
+    else
+    {
+      aer.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+      aer.hr.hint = TALER_ErrorCode_get_hint (aer.hr.ec);
+    }
+    break;
   case MHD_HTTP_CONFLICT:
     aer.hr.ec = TALER_JSON_get_error_code (json);
     aer.hr.hint = TALER_JSON_get_error_hint (json);
diff --git a/src/lib/exchange_api_management_get_keys.c 
b/src/lib/exchange_api_management_get_keys.c
index df14f2e7..03339c66 100644
--- a/src/lib/exchange_api_management_get_keys.c
+++ b/src/lib/exchange_api_management_get_keys.c
@@ -327,6 +327,21 @@ handle_get_keys_finished (void *cls,
       response_code = 0;
     }
     break;
+  case MHD_HTTP_NOT_FOUND:
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Server did not find handler at `%s'. Did you configure the 
correct exchange base URL?\n",
+                gh->url);
+    if (NULL != json)
+    {
+      gkr.hr.ec = TALER_JSON_get_error_code (json);
+      gkr.hr.hint = TALER_JSON_get_error_hint (json);
+    }
+    else
+    {
+      gkr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+      gkr.hr.hint = TALER_ErrorCode_get_hint (gkr.hr.ec);
+    }
+    break;
   default:
     /* unexpected response code */
     if (NULL != json)
diff --git a/src/lib/exchange_api_management_post_extensions.c 
b/src/lib/exchange_api_management_post_extensions.c
index 99d1653d..00d1c5e3 100644
--- a/src/lib/exchange_api_management_post_extensions.c
+++ b/src/lib/exchange_api_management_post_extensions.c
@@ -1,6 +1,6 @@
 /*
    This file is part of TALER
-   Copyright (C) 2015-2021 Taler Systems SA
+   Copyright (C) 2015-2023 Taler Systems SA
 
    TALER is free software; you can redistribute it and/or modify it under the
    terms of the GNU General Public License as published by the Free Software
@@ -98,8 +98,19 @@ handle_post_extensions_finished (void *cls,
     per.hr.hint = TALER_JSON_get_error_hint (json);
     break;
   case MHD_HTTP_NOT_FOUND:
-    per.hr.ec = TALER_JSON_get_error_code (json);
-    per.hr.hint = TALER_JSON_get_error_hint (json);
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Server did not find handler at `%s'. Did you configure the 
correct exchange base URL?\n",
+                ph->url);
+    if (NULL != json)
+    {
+      per.hr.ec = TALER_JSON_get_error_code (json);
+      per.hr.hint = TALER_JSON_get_error_hint (json);
+    }
+    else
+    {
+      per.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+      per.hr.hint = TALER_ErrorCode_get_hint (per.hr.ec);
+    }
     break;
   default:
     /* unexpected response code */
diff --git a/src/lib/exchange_api_management_set_global_fee.c 
b/src/lib/exchange_api_management_set_global_fee.c
index 518e710c..54c37fd6 100644
--- a/src/lib/exchange_api_management_set_global_fee.c
+++ b/src/lib/exchange_api_management_set_global_fee.c
@@ -93,6 +93,21 @@ handle_set_global_fee_finished (void *cls,
     sfr.hr.ec = TALER_JSON_get_error_code (json);
     sfr.hr.hint = TALER_JSON_get_error_hint (json);
     break;
+  case MHD_HTTP_NOT_FOUND:
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Server did not find handler at `%s'. Did you configure the 
correct exchange base URL?\n",
+                sgfh->url);
+    if (NULL != json)
+    {
+      sfr.hr.ec = TALER_JSON_get_error_code (json);
+      sfr.hr.hint = TALER_JSON_get_error_hint (json);
+    }
+    else
+    {
+      sfr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+      sfr.hr.hint = TALER_ErrorCode_get_hint (sfr.hr.ec);
+    }
+    break;
   case MHD_HTTP_CONFLICT:
     sfr.hr.ec = TALER_JSON_get_error_code (json);
     sfr.hr.hint = TALER_JSON_get_error_hint (json);
diff --git a/src/lib/exchange_api_management_set_wire_fee.c 
b/src/lib/exchange_api_management_set_wire_fee.c
index 01ed7742..03cab8c9 100644
--- a/src/lib/exchange_api_management_set_wire_fee.c
+++ b/src/lib/exchange_api_management_set_wire_fee.c
@@ -93,6 +93,21 @@ handle_set_wire_fee_finished (void *cls,
     swr.hr.ec = TALER_JSON_get_error_code (json);
     swr.hr.hint = TALER_JSON_get_error_hint (json);
     break;
+  case MHD_HTTP_NOT_FOUND:
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Server did not find handler at `%s'. Did you configure the 
correct exchange base URL?\n",
+                swfh->url);
+    if (NULL != json)
+    {
+      swr.hr.ec = TALER_JSON_get_error_code (json);
+      swr.hr.hint = TALER_JSON_get_error_hint (json);
+    }
+    else
+    {
+      swr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+      swr.hr.hint = TALER_ErrorCode_get_hint (swr.hr.ec);
+    }
+    break;
   case MHD_HTTP_CONFLICT:
     swr.hr.ec = TALER_JSON_get_error_code (json);
     swr.hr.hint = TALER_JSON_get_error_hint (json);
diff --git a/src/lib/exchange_api_management_update_aml_officer.c 
b/src/lib/exchange_api_management_update_aml_officer.c
index 0033a130..76cbc7e8 100644
--- a/src/lib/exchange_api_management_update_aml_officer.c
+++ b/src/lib/exchange_api_management_update_aml_officer.c
@@ -98,6 +98,21 @@ handle_update_aml_officer_finished (void *cls,
     uar.hr.ec = TALER_JSON_get_error_code (json);
     uar.hr.hint = TALER_JSON_get_error_hint (json);
     break;
+  case MHD_HTTP_NOT_FOUND:
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Server did not find handler at `%s'. Did you configure the 
correct exchange base URL?\n",
+                wh->url);
+    if (NULL != json)
+    {
+      uar.hr.ec = TALER_JSON_get_error_code (json);
+      uar.hr.hint = TALER_JSON_get_error_hint (json);
+    }
+    else
+    {
+      uar.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+      uar.hr.hint = TALER_ErrorCode_get_hint (uar.hr.ec);
+    }
+    break;
   case MHD_HTTP_CONFLICT:
     uar.hr.ec = TALER_JSON_get_error_code (json);
     uar.hr.hint = TALER_JSON_get_error_hint (json);
diff --git a/src/lib/exchange_api_management_wire_disable.c 
b/src/lib/exchange_api_management_wire_disable.c
index 30a01076..30749b0e 100644
--- a/src/lib/exchange_api_management_wire_disable.c
+++ b/src/lib/exchange_api_management_wire_disable.c
@@ -1,6 +1,6 @@
 /*
   This file is part of TALER
-  Copyright (C) 2015-2021 Taler Systems SA
+  Copyright (C) 2015-2023 Taler Systems SA
 
   TALER is free software; you can redistribute it and/or modify it under the
   terms of the GNU General Public License as published by the Free Software
@@ -99,8 +99,19 @@ handle_auditor_disable_finished (void *cls,
     wdr.hr.hint = TALER_JSON_get_error_hint (json);
     break;
   case MHD_HTTP_NOT_FOUND:
-    wdr.hr.ec = TALER_JSON_get_error_code (json);
-    wdr.hr.hint = TALER_JSON_get_error_hint (json);
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Server did not find handler at `%s'. Did you configure the 
correct exchange base URL?\n",
+                wh->url);
+    if (NULL != json)
+    {
+      wdr.hr.ec = TALER_JSON_get_error_code (json);
+      wdr.hr.hint = TALER_JSON_get_error_hint (json);
+    }
+    else
+    {
+      wdr.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+      wdr.hr.hint = TALER_ErrorCode_get_hint (wdr.hr.ec);
+    }
     break;
   case MHD_HTTP_CONFLICT:
     wdr.hr.ec = TALER_JSON_get_error_code (json);
diff --git a/src/lib/exchange_api_management_wire_enable.c 
b/src/lib/exchange_api_management_wire_enable.c
index 23a98b15..5add3e0b 100644
--- a/src/lib/exchange_api_management_wire_enable.c
+++ b/src/lib/exchange_api_management_wire_enable.c
@@ -98,6 +98,21 @@ handle_auditor_enable_finished (void *cls,
     wer.hr.ec = TALER_JSON_get_error_code (json);
     wer.hr.hint = TALER_JSON_get_error_hint (json);
     break;
+  case MHD_HTTP_NOT_FOUND:
+    GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                "Server did not find handler at `%s'. Did you configure the 
correct exchange base URL?\n",
+                wh->url);
+    if (NULL != json)
+    {
+      wer.hr.ec = TALER_JSON_get_error_code (json);
+      wer.hr.hint = TALER_JSON_get_error_hint (json);
+    }
+    else
+    {
+      wer.hr.ec = TALER_EC_GENERIC_INVALID_RESPONSE;
+      wer.hr.hint = TALER_ErrorCode_get_hint (wer.hr.ec);
+    }
+    break;
   case MHD_HTTP_CONFLICT:
     wer.hr.ec = TALER_JSON_get_error_code (json);
     wer.hr.hint = TALER_JSON_get_error_hint (json);
diff --git a/src/lib/exchange_api_reserves_history.c 
b/src/lib/exchange_api_reserves_history.c
index af9ba49d..7b8eb95e 100644
--- a/src/lib/exchange_api_reserves_history.c
+++ b/src/lib/exchange_api_reserves_history.c
@@ -1110,6 +1110,7 @@ TALER_EXCHANGE_reserves_history (
     if (NULL == job_headers)
     {
       GNUNET_break (0);
+      curl_easy_cleanup (eh);
       return NULL;
     }
   }
diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c
index ff09acbd..46719e6c 100644
--- a/src/pq/pq_query_helper.c
+++ b/src/pq/pq_query_helper.c
@@ -874,7 +874,6 @@ qconv_array (
     }
     else  /* sizes are different per element */
     {
-
       switch (meta->typ)
       {
       case TALER_PQ_array_of_blinded_denom_sig:
@@ -936,10 +935,11 @@ qconv_array (
     };
 
     /* Write header */
-    GNUNET_memcpy (out, &h, sizeof(h));
+    GNUNET_memcpy (out,
+                   &h,
+                   sizeof(h));
     out += sizeof(h);
 
-
     /* Write elements */
     for (size_t i = 0; i < num; i++)
     {
@@ -947,13 +947,14 @@ qconv_array (
 
       *(uint32_t *) out = htonl (sz);
       out += sizeof(uint32_t);
-
       switch (meta->typ)
       {
       case TALER_PQ_array_of_amount:
         {
           const struct TALER_Amount *amounts = data;
-          Oid oid_v, oid_f;
+          Oid oid_v;
+          Oid oid_f;
+
           GNUNET_assert (GNUNET_OK ==
                          GNUNET_PQ_get_oid_by_name (meta->db,
                                                     "int8",
@@ -981,8 +982,8 @@ qconv_array (
       case TALER_PQ_array_of_blinded_denom_sig:
         {
           const struct TALER_BlindedDenominationSignature *denom_sigs = data;
-
           uint32_t be[2];
+
           be[0] = htonl ((uint32_t) denom_sigs[i].cipher);
           be[1] = htonl (0x01);     /* magic margker: blinded */
           GNUNET_memcpy (out,
@@ -994,14 +995,12 @@ qconv_array (
           switch (denom_sigs[i].cipher)
           {
           case TALER_DENOMINATION_RSA:
-            {
-              void *buf = buffers[i];
-
-              GNUNET_memcpy (out,
-                             buf,
-                             sz);
-              break;
-            }
+            /* For RSA, 'same_sized' must have been false */
+            GNUNET_assert (NULL != buffers);
+            GNUNET_memcpy (out,
+                           buffers[i],
+                           sz);
+            break;
           case TALER_DENOMINATION_CS:
             GNUNET_memcpy (out,
                            &denom_sigs[i].details.blinded_cs_answer,
@@ -1015,6 +1014,7 @@ qconv_array (
       case TALER_PQ_array_of_blinded_coin_hash:
         {
           const struct TALER_BlindedCoinHashP *coin_hs = data;
+
           GNUNET_memcpy (out,
                          &coin_hs[i],
                          sizeof(struct TALER_BlindedCoinHashP));
@@ -1024,6 +1024,7 @@ qconv_array (
       case TALER_PQ_array_of_denom_hash:
         {
           const struct TALER_DenominationHashP *denom_hs = data;
+
           GNUNET_memcpy (out,
                          &denom_hs[i],
                          sizeof(struct TALER_DenominationHashP));
@@ -1038,7 +1039,6 @@ qconv_array (
       out += sz;
     }
   }
-
   param_values[0] = elements;
   param_lengths[0] = total_size;
   param_formats[0] = 1;
@@ -1052,10 +1052,8 @@ DONE:
     GNUNET_free (buffers);
   }
   GNUNET_free (buffer_lengths);
-
   if (noerror)
     return 1;
-
   return -1;
 }
 
diff --git a/src/testing/testing_api_cmd_age_withdraw.c 
b/src/testing/testing_api_cmd_age_withdraw.c
index 98d0e0f2..30f409f4 100644
--- a/src/testing/testing_api_cmd_age_withdraw.c
+++ b/src/testing/testing_api_cmd_age_withdraw.c
@@ -585,12 +585,14 @@ age_withdraw_reveal_cb (
       awrs->denom_sigs = GNUNET_new_array (awrs->num_coins,
                                            struct TALER_DenominationSignature);
       for (size_t n = 0; n < awrs->num_coins; n++)
-        TALER_denom_sig_unblind (&awrs->denom_sigs[n],
-                                 &response->details.ok.blinded_denom_sigs[n],
-                                 &aws->coin_outputs[n].details.blinding_key,
-                                 &aws->coin_outputs[n].details.h_coin_pub,
-                                 &aws->coin_outputs[n].details.alg_values,
-                                 &aws->coin_inputs[n].denom_pub->key);
+        GNUNET_assert (GNUNET_OK ==
+                       TALER_denom_sig_unblind (
+                         &awrs->denom_sigs[n],
+                         &response->details.ok.blinded_denom_sigs[n],
+                         &aws->coin_outputs[n].details.blinding_key,
+                         &aws->coin_outputs[n].details.h_coin_pub,
+                         &aws->coin_outputs[n].details.alg_values,
+                         &aws->coin_inputs[n].denom_pub->key));
       GNUNET_log (GNUNET_ERROR_TYPE_INFO,
                   "age-withdraw reveal success!\n");
     }
@@ -640,6 +642,7 @@ age_withdraw_reveal_run (
   {
     GNUNET_break (0);
     TALER_TESTING_interpreter_fail (is);
+    return;
   }
   GNUNET_assert (age_withdraw_cmd->run == age_withdraw_run);
   aws = age_withdraw_cmd->cls;
diff --git a/src/testing/testing_api_cmd_oauth.c 
b/src/testing/testing_api_cmd_oauth.c
index fcf7e843..b086d229 100644
--- a/src/testing/testing_api_cmd_oauth.c
+++ b/src/testing/testing_api_cmd_oauth.c
@@ -193,10 +193,13 @@ handler_cb (void *cls,
                                  "Bob"),
         GNUNET_JSON_pack_string ("last_name",
                                  "Builder"));
+
     if (NULL != oas->birthdate)
-      json_object_set_new (data,
-                           "birthdate",
-                           json_string_nocheck (oas->birthdate));
+      GNUNET_assert (0 ==
+                     json_object_set_new (data,
+                                          "birthdate",
+                                          json_string_nocheck (
+                                            oas->birthdate)));
 
     body = GNUNET_JSON_PACK (
       GNUNET_JSON_pack_string (
diff --git a/src/testing/testing_api_twister_helpers.c 
b/src/testing/testing_api_twister_helpers.c
index 935d8bcc..fef631e5 100644
--- a/src/testing/testing_api_twister_helpers.c
+++ b/src/testing/testing_api_twister_helpers.c
@@ -116,7 +116,9 @@ TALER_TWISTER_run_twister (const char *config_filename)
   {
     GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
                 "Could not start the taler-twister client\n");
-    GNUNET_OS_process_kill (proc, SIGTERM);
+    GNUNET_break (0 ==
+                  GNUNET_OS_process_kill (proc,
+                                          SIGTERM));
     GNUNET_OS_process_wait (proc);
     GNUNET_OS_process_destroy (proc);
     TWISTER_FAIL ();
diff --git a/src/util/crypto_confirmation.c b/src/util/crypto_confirmation.c
index a238d537..f19fc4a3 100644
--- a/src/util/crypto_confirmation.c
+++ b/src/util/crypto_confirmation.c
@@ -81,9 +81,10 @@ compute_totp (struct GNUNET_TIME_Timestamp ts,
                    gcry_md_open (&md,
                                  GCRY_MD_SHA1,
                                  GCRY_MD_FLAG_HMAC));
-    gcry_md_setkey (md,
-                    key,
-                    key_size);
+    GNUNET_assert (GPG_ERR_NO_ERROR ==
+                   gcry_md_setkey (md,
+                                   key,
+                                   key_size));
     gcry_md_write (md,
                    &ctr,
                    sizeof (ctr));

-- 
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]