aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2023-02-21 14:44:31 +0100
committerChristian Grothoff <christian@grothoff.org>2023-02-21 14:44:31 +0100
commit7da69142b4d39681a74b9654c5dec1cbc8b9b24b (patch)
treec63faf3e8c90ee33441dd993f35feb01e378fb21
parent95bd24916ed7baa7a6059c2a788e904bb5166606 (diff)
-misc minor bugfixes
-rw-r--r--src/auditor/taler-helper-auditor-purses.c10
-rw-r--r--src/auditor/taler-helper-auditor-reserves.c9
-rw-r--r--src/exchange/taler-exchange-httpd_extensions.c9
-rw-r--r--src/exchange/taler-exchange-httpd_management_partners.c2
-rw-r--r--src/exchangedb/pg_reserves_in_insert.c7
-rw-r--r--src/lib/exchange_api_purse_delete.c8
-rw-r--r--src/sq/test_sq.c6
-rw-r--r--src/util/taler-exchange-secmod-cs.c9
-rw-r--r--src/util/taler-exchange-secmod-rsa.c10
-rw-r--r--src/util/test_helper_rsa.c1
10 files changed, 49 insertions, 22 deletions
diff --git a/src/auditor/taler-helper-auditor-purses.c b/src/auditor/taler-helper-auditor-purses.c
index 13327ccba..f35020734 100644
--- a/src/auditor/taler-helper-auditor-purses.c
+++ b/src/auditor/taler-helper-auditor-purses.c
@@ -885,8 +885,9 @@ handle_purse_decision (
report_row_inconsistency ("purse-request",
rowid,
"purse fee higher than balance");
- TALER_amount_set_zero (TALER_ARL_currency,
- &balance_without_purse_fee);
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (TALER_ARL_currency,
+ &balance_without_purse_fee));
}
if (refunded)
@@ -1021,8 +1022,9 @@ verify_purse_balance (void *cls,
report_row_inconsistency ("purse",
0,
"purse fee higher than balance");
- TALER_amount_set_zero (TALER_ARL_currency,
- &balance_without_purse_fee);
+ GNUNET_assert (GNUNET_OK ==
+ TALER_amount_set_zero (TALER_ARL_currency,
+ &balance_without_purse_fee));
}
if (0 != TALER_amount_cmp (&ps->exchange_balance,
diff --git a/src/auditor/taler-helper-auditor-reserves.c b/src/auditor/taler-helper-auditor-reserves.c
index 06c727056..9f8c75c2b 100644
--- a/src/auditor/taler-helper-auditor-reserves.c
+++ b/src/auditor/taler-helper-auditor-reserves.c
@@ -1081,8 +1081,9 @@ handle_reserve_closed (
}
if (NULL == payto_uri)
{
- if (0 != strcmp (rs->sender_account,
- receiver_account))
+ if ( (NULL == rs->sender_account) ||
+ (0 != strcmp (rs->sender_account,
+ receiver_account)) )
{
report_row_inconsistency ("reserves_close",
rowid,
@@ -1110,8 +1111,8 @@ handle_reserve_closed (
rowid,
"target account not verified, auditor does not know reserve");
}
- if (0 != strcmp (rs->sender_account,
- receiver_account))
+ else if (0 != strcmp (rs->sender_account,
+ receiver_account))
{
report_row_inconsistency ("reserves_close",
rowid,
diff --git a/src/exchange/taler-exchange-httpd_extensions.c b/src/exchange/taler-exchange-httpd_extensions.c
index ecced1fd6..48c3f4a94 100644
--- a/src/exchange/taler-exchange-httpd_extensions.c
+++ b/src/exchange/taler-exchange-httpd_extensions.c
@@ -150,12 +150,11 @@ extension_update_event_cb (void *cls,
{
TEH_age_restriction_enabled = true;
TEH_age_restriction_config = *conf;
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "[age restriction] DB event has changed the config to %s with mask: %s\n",
+ TEH_age_restriction_enabled ? "enabled": "DISABLED",
+ TALER_age_mask_to_string (&conf->mask));
}
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "[age restriction] DB event has changed the config to %s with mask: %s\n",
- TEH_age_restriction_enabled ? "enabled": "DISABLED",
- TALER_age_mask_to_string (&conf->mask));
-
}
// Finally, call TEH_keys_update_states in order to refresh the cached
diff --git a/src/exchange/taler-exchange-httpd_management_partners.c b/src/exchange/taler-exchange-httpd_management_partners.c
index 1c0d4a9a1..c63192c60 100644
--- a/src/exchange/taler-exchange-httpd_management_partners.c
+++ b/src/exchange/taler-exchange-httpd_management_partners.c
@@ -56,7 +56,7 @@ TEH_handler_management_partners (
GNUNET_JSON_spec_timestamp ("start_date",
&start_date),
GNUNET_JSON_spec_timestamp ("end_date",
- &start_date),
+ &end_date),
GNUNET_JSON_spec_relative_time ("wad_frequency",
&wad_frequency),
GNUNET_JSON_spec_end ()
diff --git a/src/exchangedb/pg_reserves_in_insert.c b/src/exchangedb/pg_reserves_in_insert.c
index da21a9063..1c578478b 100644
--- a/src/exchangedb/pg_reserves_in_insert.c
+++ b/src/exchangedb/pg_reserves_in_insert.c
@@ -1,6 +1,6 @@
/*
This file is part of TALER
- Copyright (C) 2022 Taler Systems SA
+ Copyright (C) 2022-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
@@ -17,6 +17,7 @@
* @file exchangedb/pg_reserves_in_insert.c
* @brief Implementation of the reserves_in_insert function for Postgres
* @author Christian Grothoff
+ * @author Joseph Xu
*/
#include "platform.h"
#include "taler_error_codes.h"
@@ -689,7 +690,6 @@ TEH_PG_reserves_in_insert (void *cls,
{
unsigned int bs = GNUNET_MIN (batch_size,
reserves_length - i);
- bs = 1; // FIXME-JOSEPH: for now, until pg_notify is gone!
if (bs >= 8)
{
qs1 = insert8 (pg,
@@ -763,7 +763,6 @@ TEH_PG_reserves_in_insert (void *cls,
t_duplicate |= transaction_duplicate[i + 1];
t_duplicate |= transaction_duplicate[i + 2];
t_duplicate |= transaction_duplicate[i + 3];
- // fprintf(stdout, "reserve_uuid : %ld %ld %ld %ld\n", reserve_uuid[i], reserve_uuid[i+1], reserve_uuid[i+2], reserve_uuid[i+3]);
i += 4;
break;
case 3:
@@ -793,7 +792,6 @@ TEH_PG_reserves_in_insert (void *cls,
results[i] = (t_duplicate)
? GNUNET_DB_STATUS_SUCCESS_NO_RESULTS
: GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
- // fprintf(stdout, "reserve_uuid : %ld %ld\n", reserve_uuid[i], reserve_uuid[i+1]);
i += 2;
break;
case 1:
@@ -817,7 +815,6 @@ TEH_PG_reserves_in_insert (void *cls,
}
need_update |= conflicts[i];
t_duplicate |= transaction_duplicate[i];
- // fprintf(stdout, "reserve uuid : %ld c :%d t:%d\n", reserve_uuid[i], conflicts[i], transaction_duplicate[i]);
i += 1;
break;
case 0:
diff --git a/src/lib/exchange_api_purse_delete.c b/src/lib/exchange_api_purse_delete.c
index 27a9082b2..624838105 100644
--- a/src/lib/exchange_api_purse_delete.c
+++ b/src/lib/exchange_api_purse_delete.c
@@ -208,6 +208,14 @@ TALER_EXCHANGE_purse_delete (
GNUNET_free (xhdr);
}
eh = TALER_EXCHANGE_curl_easy_get_ (pdh->url);
+ if (NULL == eh)
+ {
+ GNUNET_break (0);
+ curl_slist_free_all (pdh->xhdr);
+ GNUNET_free (pdh->url);
+ GNUNET_free (pdh);
+ return NULL;
+ }
GNUNET_assert (CURLE_OK ==
curl_easy_setopt (eh,
CURLOPT_CUSTOMREQUEST,
diff --git a/src/sq/test_sq.c b/src/sq/test_sq.c
index f8292b4d3..8f464faf3 100644
--- a/src/sq/test_sq.c
+++ b/src/sq/test_sq.c
@@ -63,7 +63,11 @@ run_queries (sqlite3 *db)
TALER_amount_hton (&namount,
&hamount);
json = json_object ();
- json_object_set_new (json, "foo", json_integer (42));
+ GNUNET_assert (NULL != json);
+ GNUNET_assert (0 ==
+ json_object_set_new (json,
+ "foo",
+ json_integer (42)));
GNUNET_assert (NULL != json);
GNUNET_assert (GNUNET_OK ==
GNUNET_SQ_prepare (db,
diff --git a/src/util/taler-exchange-secmod-cs.c b/src/util/taler-exchange-secmod-cs.c
index 231a8cd87..2cdf09adf 100644
--- a/src/util/taler-exchange-secmod-cs.c
+++ b/src/util/taler-exchange-secmod-cs.c
@@ -2198,7 +2198,14 @@ run (void *cls,
GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
NULL);
if (0 == max_workers)
- max_workers = sysconf (_SC_NPROCESSORS_CONF);
+ {
+ long lret;
+
+ lret = sysconf (_SC_NPROCESSORS_CONF);
+ if (lret <= 0)
+ lret = 1;
+ max_workers = (unsigned int) lret;
+ }
for (unsigned int i = 0; i<max_workers; i++)
if (GNUNET_OK !=
start_worker ())
diff --git a/src/util/taler-exchange-secmod-rsa.c b/src/util/taler-exchange-secmod-rsa.c
index d5106c8a9..c651d78a8 100644
--- a/src/util/taler-exchange-secmod-rsa.c
+++ b/src/util/taler-exchange-secmod-rsa.c
@@ -1986,7 +1986,15 @@ run (void *cls,
GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
NULL);
if (0 == max_workers)
- max_workers = sysconf (_SC_NPROCESSORS_CONF);
+ {
+ long lret;
+
+ lret = sysconf (_SC_NPROCESSORS_CONF);
+ if (lret <= 0)
+ lret = 1;
+ max_workers = (unsigned int) lret;
+ }
+
for (unsigned int i = 0; i<max_workers; i++)
if (GNUNET_OK !=
start_worker ())
diff --git a/src/util/test_helper_rsa.c b/src/util/test_helper_rsa.c
index 1b67607ce..1c7cc5bfe 100644
--- a/src/util/test_helper_rsa.c
+++ b/src/util/test_helper_rsa.c
@@ -603,6 +603,7 @@ test_batch_signing (struct TALER_CRYPTO_RsaDenominationHelper *dh,
case TALER_EC_EXCHANGE_GENERIC_DENOMINATION_KEY_UNKNOWN:
for (unsigned int i = 0; i<batch_size; i++)
TALER_blinded_denom_sig_free (&ds[i]);
+ break;
default:
/* unexpected error */
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,