aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-08-24 23:16:57 +0200
committerChristian Grothoff <christian@grothoff.org>2024-08-24 23:16:57 +0200
commite2c67f76b01c0c5aa21727feb88946c2c9f3a877 (patch)
tree9ec538976a61c0e178e13d54dd4c2bc16b1f291f
parente4953537863704b733e336989c75f34836885eec (diff)
fix misc bugs
-rw-r--r--src/auditor/taler-auditor-httpd.c2
-rw-r--r--src/auditor/taler-auditor-httpd_deposit-confirmation-get.c115
-rw-r--r--src/auditor/taler-auditor-httpd_emergency-by-count-del.c5
-rw-r--r--src/auditor/taler-helper-auditor-coins.c2
-rw-r--r--src/bank-lib/fakebank_twg_get_transfers.c3
-rw-r--r--src/bank-lib/taler-exchange-wire-gateway-client.c1
-rw-r--r--src/exchange/taler-exchange-httpd.c2
-rw-r--r--src/exchange/taler-exchange-wirewatch.c4
-rw-r--r--src/kyclogic/kyclogic_api.c38
-rw-r--r--src/lib/exchange_api_lookup_kyc_attributes.c4
-rw-r--r--src/testing/testing_api_cmd_check_aml_decisions.c2
11 files changed, 95 insertions, 83 deletions
diff --git a/src/auditor/taler-auditor-httpd.c b/src/auditor/taler-auditor-httpd.c
index 1accf25cb..d8643c60e 100644
--- a/src/auditor/taler-auditor-httpd.c
+++ b/src/auditor/taler-auditor-httpd.c
@@ -805,7 +805,7 @@ handle_mhd_request (void *cls,
size_t ulen = strlen (url) + 1;
char d[ulen];
/* const */ struct TAH_RequestHandler *match = NULL;
- bool url_match;
+ bool url_match = false;
(void) cls;
(void) version;
diff --git a/src/auditor/taler-auditor-httpd_deposit-confirmation-get.c b/src/auditor/taler-auditor-httpd_deposit-confirmation-get.c
index 56a90ac65..0c1a3f096 100644
--- a/src/auditor/taler-auditor-httpd_deposit-confirmation-get.c
+++ b/src/auditor/taler-auditor-httpd_deposit-confirmation-get.c
@@ -48,53 +48,60 @@ add_deposit_confirmation (
{
json_t *list = cls;
json_t *obj;
-
json_t *coin_pubs_json = json_array ();
json_t *coin_sigs_json = json_array ();
- for (int i = 0; dc->num_coins > i; i++)
+ GNUNET_assert (NULL != coin_pubs_json);
+ GNUNET_assert (NULL != coin_sigs_json);
+ for (unsigned int i = 0; i < dc->num_coins; i++)
{
-
- int sz_pub = sizeof(dc->coin_pubs[0]) * 9;
- char *o_pub = malloc (sz_pub);
- GNUNET_STRINGS_data_to_string (&dc->coin_pubs[i], sizeof(dc->coin_pubs[0]),
- o_pub, sz_pub);
- json_t *pub = json_string (o_pub);
- json_array_append_new (coin_pubs_json, pub);
- free (o_pub);
-
-
- int sz_sig = sizeof(dc->coin_sigs[0]) * 9;
- char *o_sig = malloc (sz_sig);
- GNUNET_STRINGS_data_to_string (&dc->coin_sigs[i], sizeof(dc->coin_sigs[0]),
- o_sig, sz_sig);
- json_t *sig = json_string (o_sig);
- json_array_append_new (coin_sigs_json, sig);
- free (o_sig);
-
+ json_t *pub;
+ json_t *sig;
+
+ pub = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_data_auto (NULL,
+ &dc->coin_pubs[i]));
+ GNUNET_assert (0 ==
+ json_array_append_new (coin_pubs_json,
+ pub));
+ sig = GNUNET_JSON_PACK (
+ GNUNET_JSON_pack_data_auto (NULL,
+ &dc->coin_sigs[i]));
+ GNUNET_assert (0 ==
+ json_array_append_new (coin_sigs_json,
+ sig));
}
obj = GNUNET_JSON_PACK (
-
- GNUNET_JSON_pack_int64 ("deposit_confirmation_serial_id", serial_id),
- GNUNET_JSON_pack_data_auto ("h_contract_terms", &dc->h_contract_terms),
- GNUNET_JSON_pack_data_auto ("h_policy", &dc->h_policy),
- GNUNET_JSON_pack_data_auto ("h_wire", &dc->h_wire),
- GNUNET_JSON_pack_timestamp ("exchange_timestamp", dc->exchange_timestamp),
- GNUNET_JSON_pack_timestamp ("refund_deadline", dc->refund_deadline),
- GNUNET_JSON_pack_timestamp ("wire_deadline", dc->wire_deadline),
- TALER_JSON_pack_amount ("total_without_fee", &dc->total_without_fee),
-
- GNUNET_JSON_pack_array_steal ("coin_pubs", coin_pubs_json),
- GNUNET_JSON_pack_array_steal ("coin_sigs", coin_sigs_json),
-
- GNUNET_JSON_pack_data_auto ("merchant_pub", &dc->merchant),
- GNUNET_JSON_pack_data_auto ("exchange_sig", &dc->exchange_sig),
- GNUNET_JSON_pack_data_auto ("exchange_pub", &dc->exchange_pub),
- GNUNET_JSON_pack_data_auto ("master_sig", &dc->master_sig)
-
+ GNUNET_JSON_pack_int64 ("deposit_confirmation_serial_id",
+ serial_id),
+ GNUNET_JSON_pack_data_auto ("h_contract_terms",
+ &dc->h_contract_terms),
+ GNUNET_JSON_pack_data_auto ("h_policy",
+ &dc->h_policy),
+ GNUNET_JSON_pack_data_auto ("h_wire",
+ &dc->h_wire),
+ GNUNET_JSON_pack_timestamp ("exchange_timestamp",
+ dc->exchange_timestamp),
+ GNUNET_JSON_pack_timestamp ("refund_deadline",
+ dc->refund_deadline),
+ GNUNET_JSON_pack_timestamp ("wire_deadline",
+ dc->wire_deadline),
+ TALER_JSON_pack_amount ("total_without_fee",
+ &dc->total_without_fee),
+ GNUNET_JSON_pack_array_steal ("coin_pubs",
+ coin_pubs_json),
+ GNUNET_JSON_pack_array_steal ("coin_sigs",
+ coin_sigs_json),
+ GNUNET_JSON_pack_data_auto ("merchant_pub",
+ &dc->merchant),
+ GNUNET_JSON_pack_data_auto ("exchange_sig",
+ &dc->exchange_sig),
+ GNUNET_JSON_pack_data_auto ("exchange_pub",
+ &dc->exchange_pub),
+ GNUNET_JSON_pack_data_auto ("master_sig",
+ &dc->master_sig)
);
-
GNUNET_break (0 ==
json_array_append_new (list,
obj));
@@ -113,6 +120,9 @@ TAH_DEPOSIT_CONFIRMATION_handler_get (
{
json_t *ja;
enum GNUNET_DB_QueryStatus qs;
+ bool return_suppressed = false;
+ int64_t limit = -20;
+ uint64_t offset;
(void) rh;
(void) connection_cls;
@@ -127,36 +137,29 @@ TAH_DEPOSIT_CONFIRMATION_handler_get (
TALER_EC_GENERIC_DB_SETUP_FAILED,
NULL);
}
- ja = json_array ();
- GNUNET_break (NULL != ja);
-
- bool return_suppressed = false;
-
- int64_t limit = -20; // unused here
- uint64_t offset;
-
TALER_MHD_parse_request_snumber (connection,
"limit",
&limit);
-
if (limit < 0)
offset = INT64_MAX;
else
offset = 0;
-
TALER_MHD_parse_request_number (connection,
"offset",
&offset);
-
-
- const char *ret_s = MHD_lookup_connection_value (connection,
- MHD_GET_ARGUMENT_KIND,
- "return_suppressed");
- if (ret_s != NULL && strcmp (ret_s, "true") == 0)
{
- return_suppressed = true;
+ const char *ret_s = MHD_lookup_connection_value (connection,
+ MHD_GET_ARGUMENT_KIND,
+ "return_suppressed");
+ if ( (NULL != ret_s) &&
+ (0 == strcmp (ret_s, "true")) )
+ {
+ return_suppressed = true;
+ }
}
+ ja = json_array ();
+ GNUNET_break (NULL != ja);
qs = TAH_plugin->get_deposit_confirmations (
TAH_plugin->cls,
limit,
diff --git a/src/auditor/taler-auditor-httpd_emergency-by-count-del.c b/src/auditor/taler-auditor-httpd_emergency-by-count-del.c
index 4af459bf2..b58dc765c 100644
--- a/src/auditor/taler-auditor-httpd_emergency-by-count-del.c
+++ b/src/auditor/taler-auditor-httpd_emergency-by-count-del.c
@@ -27,10 +27,7 @@ TAH_EMERGENCY_BY_COUNT_handler_delete (struct TAH_RequestHandler *rh,
size_t *upload_data_size,
const char *const args[])
{
-
- MHD_RESULT res;
enum GNUNET_DB_QueryStatus qs;
-
uint64_t row_id;
if (args[2] != NULL)
@@ -75,6 +72,4 @@ TAH_EMERGENCY_BY_COUNT_handler_delete (struct TAH_RequestHandler *rh,
MHD_HTTP_NO_CONTENT,
GNUNET_JSON_pack_string ("status",
"EMERGENCY_BY_COUNT_OK"));
-
- return res;
}
diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c
index 9b754b069..da97c8bc0 100644
--- a/src/auditor/taler-helper-auditor-coins.c
+++ b/src/auditor/taler-helper-auditor-coins.c
@@ -1966,7 +1966,7 @@ check_recoup (struct CoinContext *cc,
.operation = (char *) operation,
.loss = *amount,
// TODO: maybe adding the wrong pub
- bsl.operation_specific_pub = coin->coin_pub.eddsa_pub
+ .operation_specific_pub = coin->coin_pub.eddsa_pub
};
qs = TALER_ARL_adb->insert_bad_sig_losses (
diff --git a/src/bank-lib/fakebank_twg_get_transfers.c b/src/bank-lib/fakebank_twg_get_transfers.c
index 18b66dd54..ea1064268 100644
--- a/src/bank-lib/fakebank_twg_get_transfers.c
+++ b/src/bank-lib/fakebank_twg_get_transfers.c
@@ -132,7 +132,8 @@ TALER_FAKEBANK_twg_get_transfers_ (
(t->row_id == offset) )
overflow = true; /* full circle, give up! */
}
- if (t->debit_account != acc)
+ if ( (NULL == t) ||
+ (t->debit_account != acc) )
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Invalid start specified, transaction %llu not with account %s!\n",
diff --git a/src/bank-lib/taler-exchange-wire-gateway-client.c b/src/bank-lib/taler-exchange-wire-gateway-client.c
index 81b63401c..230cc1e33 100644
--- a/src/bank-lib/taler-exchange-wire-gateway-client.c
+++ b/src/bank-lib/taler-exchange-wire-gateway-client.c
@@ -214,6 +214,7 @@ credit_history_cb (void *cls,
TALER_B2S (&cd->details.kycauth.account_pub),
TALER_amount2s (&cd->amount),
GNUNET_TIME_timestamp2s (cd->execution_date));
+ break;
case TALER_BANK_CT_WAD:
GNUNET_break (0); // FIXME
break;
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index e047d8471..f2fccfe87 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -2096,7 +2096,7 @@ handle_mhd_request (void *cls,
return ret;
}
return TEH_handler_kyc_upload (rc,
- url + strlen ("/kyc-upload/"),
+ &url[strlen ("/kyc-upload/")],
upload_data_size,
upload_data);
}
diff --git a/src/exchange/taler-exchange-wirewatch.c b/src/exchange/taler-exchange-wirewatch.c
index 174eb8aff..cd604d2c4 100644
--- a/src/exchange/taler-exchange-wirewatch.c
+++ b/src/exchange/taler-exchange-wirewatch.c
@@ -581,6 +581,10 @@ process_reply (const struct TALER_BANK_CreditDetails *details,
struct TALER_EXCHANGEDB_ReserveInInfo reserves[details_length];
unsigned int j = 0;
+ /* make compiler happy */
+ memset (qss,
+ 0,
+ sizeof (qss));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Importing %u transactions\n",
details_length);
diff --git a/src/kyclogic/kyclogic_api.c b/src/kyclogic/kyclogic_api.c
index f7364bd96..def2cbd29 100644
--- a/src/kyclogic/kyclogic_api.c
+++ b/src/kyclogic/kyclogic_api.c
@@ -1043,7 +1043,9 @@ TALER_KYCLOGIC_check_to_measures (
mi = GNUNET_JSON_PACK (
GNUNET_JSON_pack_string ("check_name",
- check->check_name),
+ NULL == check
+ ? "SKIP"
+ : check->check_name),
GNUNET_JSON_pack_string ("prog_name",
kcc->prog_name),
GNUNET_JSON_pack_allow_null (
@@ -1802,11 +1804,10 @@ add_rule (const struct GNUNET_CONFIGURATION_Handle *cfg,
"amount required");
return GNUNET_SYSERR;
}
- if (GNUNET_YES !=
- GNUNET_CONFIGURATION_get_value_yesno (cfg,
- section,
- "EXPOSED"))
- exposed = false;
+ exposed = (GNUNET_YES ==
+ GNUNET_CONFIGURATION_get_value_yesno (cfg,
+ section,
+ "EXPOSED"));
{
enum GNUNET_GenericReturnValue r;
@@ -1887,16 +1888,18 @@ add_rule (const struct GNUNET_CONFIGURATION_Handle *cfg,
"Adding KYC rule %s\n",
section);
{
- struct TALER_KYCLOGIC_KycRule kt;
+ struct TALER_KYCLOGIC_KycRule kt = {
+ .lrs = &default_rules,
+ .rule_name = GNUNET_strdup (&section[strlen ("kyc-rule-")]),
+ .timeframe = timeframe,
+ .threshold = threshold,
+ .trigger = ot,
+ .is_and_combinator = is_and,
+ .exposed = exposed,
+ .display_priority = 0,
+ .verboten = false
+ };
- kt.lrs = &default_rules;
- kt.rule_name = GNUNET_strdup (&section[strlen ("kyc-rule-")]);
- kt.timeframe = timeframe;
- kt.threshold = threshold;
- kt.trigger = ot;
- kt.is_and_combinator = is_and;
- kt.exposed = exposed;
- kt.verboten = false;
add_tokens (measures,
" ",
&kt.next_measures,
@@ -3162,6 +3165,11 @@ TALER_KYCLOGIC_check_to_provider (const char *check_name)
{
struct TALER_KYCLOGIC_KycCheck *kc;
+ if (NULL == check_name)
+ return NULL;
+ if (0 == strcasecmp (check_name,
+ "SKIP"))
+ return NULL;
kc = find_check (check_name);
switch (kc->type)
{
diff --git a/src/lib/exchange_api_lookup_kyc_attributes.c b/src/lib/exchange_api_lookup_kyc_attributes.c
index dd19aefa6..6be04f4e4 100644
--- a/src/lib/exchange_api_lookup_kyc_attributes.c
+++ b/src/lib/exchange_api_lookup_kyc_attributes.c
@@ -277,13 +277,13 @@ TALER_EXCHANGE_lookup_kyc_attributes (
&officer_sig);
{
- char payto_s[sizeof (h_payto) * 2];
+ char payto_s[sizeof (*h_payto) * 2];
char pub_str[sizeof (officer_pub) * 2];
char *end;
end = GNUNET_STRINGS_data_to_string (
h_payto,
- sizeof (h_payto),
+ sizeof (*h_payto),
payto_s,
sizeof (payto_s));
*end = '\0';
diff --git a/src/testing/testing_api_cmd_check_aml_decisions.c b/src/testing/testing_api_cmd_check_aml_decisions.c
index 74ad5f66f..0c31c5471 100644
--- a/src/testing/testing_api_cmd_check_aml_decisions.c
+++ b/src/testing/testing_api_cmd_check_aml_decisions.c
@@ -155,7 +155,7 @@ check_aml_decisions_run (
struct TALER_TESTING_Interpreter *is)
{
struct AmlCheckState *ds = cls;
- const struct TALER_PaytoHashP *h_payto;
+ const struct TALER_PaytoHashP *h_payto = NULL;
const struct TALER_AmlOfficerPrivateKeyP *officer_priv;
const struct TALER_TESTING_Command *ref;
const char *exchange_url;