From 9ed99558e21ac6b81f112670b982262d2349e5a5 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Mon, 22 Aug 2022 22:45:41 +0200 Subject: -fix clang compiler warnings --- src/auditor/taler-helper-auditor-coins.c | 10 +++ src/bank-lib/fakebank.c | 40 +++-------- src/exchange-tools/taler-crypto-worker.c | 1 + src/exchange-tools/taler-exchange-dbinit.c | 2 +- src/exchange-tools/taler-exchange-offline.c | 72 ++++++++++++------- src/exchange/taler-exchange-closer.c | 84 ++++++++++++++-------- src/exchange/taler-exchange-httpd_batch-deposit.c | 1 + src/exchange/taler-exchange-httpd_transfers_get.c | 1 + src/exchangedb/irbt_callbacks.c | 2 +- src/exchangedb/plugin_exchangedb_postgres.c | 43 +++-------- src/exchangedb/test_exchangedb.c | 23 +++--- src/include/taler_exchangedb_plugin.h | 11 +-- src/json/json_helper.c | 7 +- src/kyclogic/kyclogic_api.c | 1 + src/kyclogic/plugin_kyclogic_oauth2.c | 9 +++ src/kyclogic/plugin_kyclogic_template.c | 11 +++ src/kyclogic/taler-exchange-kyc-tester.c | 12 +++- src/lib/exchange_api_handle.c | 41 ++++++----- src/lib/exchange_api_purse_deposit.c | 2 + src/sq/test_sq.c | 2 + src/templating/templating_api.c | 3 +- src/templating/test_mustach_jansson.c | 2 + .../testing_api_cmd_bank_admin_add_incoming.c | 2 +- src/testing/testing_api_helpers_auditor.c | 1 + src/util/age_restriction.c | 4 +- src/util/exchange_signatures.c | 10 +-- src/util/taler-exchange-secmod-rsa.c | 1 + 27 files changed, 226 insertions(+), 172 deletions(-) (limited to 'src') diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c index a3c8afb54..aa3e34b76 100644 --- a/src/auditor/taler-helper-auditor-coins.c +++ b/src/auditor/taler-helper-auditor-coins.c @@ -1982,6 +1982,16 @@ check_recoup (struct CoinContext *cc, enum GNUNET_DB_QueryStatus qs; const struct TALER_EXCHANGEDB_DenominationKeyInformation *issue; + if (GNUNET_OK != + TALER_wallet_recoup_verify (&coin->denom_pub_hash, + coin_blind, + &coin->coin_pub, + coin_sig)) + { + report_row_inconsistency (operation, + rowid, + "recoup signature invalid"); + } if (GNUNET_OK != TALER_test_coin_valid (coin, denom_pub)) diff --git a/src/bank-lib/fakebank.c b/src/bank-lib/fakebank.c index 142fd4a99..bda0b68cf 100644 --- a/src/bank-lib/fakebank.c +++ b/src/bank-lib/fakebank.c @@ -3040,14 +3040,12 @@ handle_bank_integration (struct TALER_FAKEBANK_Handle *h, * @param h the handle * @param connection the connection * @param account_name name of the account - * @param con_cls closure for request * @return MHD result code */ static MHD_RESULT get_account_access (struct TALER_FAKEBANK_Handle *h, struct MHD_Connection *connection, - const char *account_name, - void **con_cls) + const char *account_name) { struct Account *acc; @@ -3093,15 +3091,13 @@ get_account_access (struct TALER_FAKEBANK_Handle *h, * @param connection the connection * @param account_name name of the account * @param withdrawal_id withdrawal ID to return status of - * @param con_cls closure for request * @return MHD result code */ static MHD_RESULT get_account_withdrawals_access (struct TALER_FAKEBANK_Handle *h, struct MHD_Connection *connection, const char *account_name, - const char *withdrawal_id, - void **con_cls) + const char *withdrawal_id) { struct WithdrawalOperation *wo; struct Account *acc; @@ -3435,19 +3431,13 @@ notify_withdrawal (struct TALER_FAKEBANK_Handle *h, * @param connection the connection * @param account_name name of the debited account * @param withdrawal_id the withdrawal operation identifier - * @param upload_data request data - * @param upload_data_size size of @a upload_data in bytes - * @param con_cls closure for request * @return MHD result code */ static MHD_RESULT access_withdrawals_abort (struct TALER_FAKEBANK_Handle *h, struct MHD_Connection *connection, const char *account_name, - const char *withdrawal_id, - const void *upload_data, - size_t *upload_data_size, - void **con_cls) + const char *withdrawal_id) { struct WithdrawalOperation *wo; struct Account *acc; @@ -3513,19 +3503,13 @@ access_withdrawals_abort (struct TALER_FAKEBANK_Handle *h, * @param connection the connection * @param account_name name of the debited account * @param withdrawal_id the withdrawal operation identifier - * @param upload_data request data - * @param upload_data_size size of @a upload_data in bytes - * @param con_cls closure for request * @return MHD result code */ static MHD_RESULT access_withdrawals_confirm (struct TALER_FAKEBANK_Handle *h, struct MHD_Connection *connection, const char *account_name, - const char *withdrawal_id, - const void *upload_data, - size_t *upload_data_size, - void **con_cls) + const char *withdrawal_id) { struct WithdrawalOperation *wo; struct Account *acc; @@ -3701,10 +3685,7 @@ handle_bank_access (struct TALER_FAKEBANK_Handle *h, ret = access_withdrawals_abort (h, connection, acc, - wi, - upload_data, - upload_data_size, - con_cls); + wi); GNUNET_free (wi); GNUNET_free (acc); return ret; @@ -3715,10 +3696,7 @@ handle_bank_access (struct TALER_FAKEBANK_Handle *h, ret = access_withdrawals_confirm (h, connection, acc, - wi, - upload_data, - upload_data_size, - con_cls); + wi); GNUNET_free (wi); GNUNET_free (acc); return ret; @@ -3752,8 +3730,7 @@ handle_bank_access (struct TALER_FAKEBANK_Handle *h, { ret = get_account_access (h, connection, - acc_name, - con_cls); + acc_name); return ret; } if (0 != strncmp (end_acc, @@ -3772,8 +3749,7 @@ handle_bank_access (struct TALER_FAKEBANK_Handle *h, ret = get_account_withdrawals_access (h, connection, acc, - wid, - con_cls); + wid); GNUNET_free (acc); return ret; } diff --git a/src/exchange-tools/taler-crypto-worker.c b/src/exchange-tools/taler-crypto-worker.c index 475d98c13..8c3a123c3 100644 --- a/src/exchange-tools/taler-crypto-worker.c +++ b/src/exchange-tools/taler-crypto-worker.c @@ -50,6 +50,7 @@ run (void *cls, (void) cls; (void) args; (void) cfgfile; + (void) cfg; json_t *req; GNUNET_log (GNUNET_ERROR_TYPE_INFO, diff --git a/src/exchange-tools/taler-exchange-dbinit.c b/src/exchange-tools/taler-exchange-dbinit.c index 8746d3e58..7dd5c0151 100644 --- a/src/exchange-tools/taler-exchange-dbinit.c +++ b/src/exchange-tools/taler-exchange-dbinit.c @@ -171,7 +171,7 @@ run (void *cls, } if (clear_shards) { - if (0 > + if (GNUNET_OK != plugin->delete_shard_locks (plugin->cls)) { fprintf (stderr, diff --git a/src/exchange-tools/taler-exchange-offline.c b/src/exchange-tools/taler-exchange-offline.c index 6dcc9d5cf..a4413a244 100644 --- a/src/exchange-tools/taler-exchange-offline.c +++ b/src/exchange-tools/taler-exchange-offline.c @@ -4237,58 +4237,72 @@ do_setup (char *const *args) } -/* +/** * Print the current extensions as configured + * + * @param args the array of command-line arguments to process next */ static void do_extensions_show (char *const *args) { - - json_t *obj = json_object (); - json_t *exts = json_object (); const struct TALER_Extension *it; + json_t *exts = json_object (); + json_t *obj; + GNUNET_assert (NULL != exts); for (it = TALER_extensions_get_head (); NULL != it; it = it->next) - json_object_set (exts, it->name, it->config_to_json (it)); - - json_object_set (obj, "extensions", exts); - - GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "%s\n", - json_dumps (obj, JSON_INDENT (2))); - + GNUNET_assert (0 == + json_object_set_new (exts, + it->name, + it->config_to_json (it))); + obj = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_object_steal ("extensions", + exts)); + GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, + "%s\n", + json_dumps (obj, + JSON_INDENT (2))); json_decref (obj); + next (args); } -/* +/** * Sign the configurations of the enabled extensions */ static void do_extensions_sign (char *const *args) { - json_t *obj = json_object (); json_t *extensions = json_object (); struct TALER_ExtensionConfigHashP h_config; struct TALER_MasterSignatureP sig; const struct TALER_Extension *it; + json_t *obj; - if (GNUNET_OK != TALER_extensions_load_taler_config (kcfg)) + GNUNET_assert (NULL != extensions); + if (GNUNET_OK != + TALER_extensions_load_taler_config (kcfg)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "error while loading taler config for extensions\n"); + json_decref (extensions); return; } - for (it = TALER_extensions_get_head (); NULL != it; it = it->next) - json_object_set (extensions, it->name, it->config_to_json (it)); + GNUNET_assert (0 == + json_object_set_new (extensions, + it->name, + it->config_to_json (it))); if (GNUNET_OK != - TALER_JSON_extensions_config_hash (extensions, &h_config)) + TALER_JSON_extensions_config_hash (extensions, + &h_config)) { + json_decref (extensions); GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "error while hashing config for extensions\n"); return; @@ -4296,25 +4310,29 @@ do_extensions_sign (char *const *args) if (GNUNET_OK != load_offline_key (GNUNET_NO)) + { + json_decref (extensions); return; - + } TALER_exchange_offline_extension_config_hash_sign (&h_config, &master_priv, &sig); - json_object_set (obj, "extensions", extensions); - json_object_update (obj, - GNUNET_JSON_PACK ( - GNUNET_JSON_pack_data_auto ( - "extensions_sig", - &sig))); - - output_operation (OP_EXTENSIONS, obj); + obj = GNUNET_JSON_PACK ( + GNUNET_JSON_pack_object_steal ("extensions", + extensions), + GNUNET_JSON_pack_data_auto ( + "extensions_sig", + &sig)); + output_operation (OP_EXTENSIONS, + obj); + next (args); } static void -cmd_handler (char *const *args, const struct SubCommand *cmds) +cmd_handler (char *const *args, + const struct SubCommand *cmds) { nxt = NULL; for (unsigned int i = 0; NULL != cmds[i].name; i++) diff --git a/src/exchange/taler-exchange-closer.c b/src/exchange/taler-exchange-closer.c index 92ba7babb..0e203f0fe 100644 --- a/src/exchange/taler-exchange-closer.c +++ b/src/exchange/taler-exchange-closer.c @@ -204,9 +204,11 @@ commit_or_warn (void) * @param account_payto_uri information about the bank account that initially * caused the reserve to be created * @param expiration_date when did the reserve expire - * @return transaction status code + * @return #GNUNET_OK on success (continue) + * #GNUNET_NO on non-fatal errors (try again) + * #GNUNET_SYSERR on fatal errors (abort) */ -static enum GNUNET_DB_QueryStatus +static enum GNUNET_GenericReturnValue expired_reserve_cb (void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, const struct TALER_Amount *left, @@ -239,7 +241,7 @@ expired_reserve_cb (void *cls, account_payto_uri); global_ret = EXIT_FAILURE; GNUNET_SCHEDULER_shutdown (); - return GNUNET_DB_STATUS_HARD_ERROR; + return GNUNET_SYSERR; } /* lookup `fees` from time of actual reserve expiration @@ -257,13 +259,22 @@ expired_reserve_cb (void *cls, &end_date, &fees, &master_sig); - if (0 >= qs) + switch (qs) { + case GNUNET_DB_STATUS_HARD_ERROR: + GNUNET_break (0); + return GNUNET_SYSERR; + case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not get wire fees for %s at %s. Aborting run.\n", wa->method, GNUNET_TIME_timestamp2s (expiration_date)); - return GNUNET_DB_STATUS_HARD_ERROR; + return GNUNET_SYSERR; + case GNUNET_DB_STATUS_SOFT_ERROR: + return GNUNET_NO; + case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: + /* continued below */ + break; } } @@ -281,8 +292,8 @@ expired_reserve_cb (void *cls, GNUNET_assert (GNUNET_OK == TALER_amount_set_zero (left->currency, &amount_without_fee)); + ret = TALER_AAR_RESULT_ZERO; } - GNUNET_assert (TALER_AAR_RESULT_POSITIVE == ret); /* round down to enable transfer */ if (GNUNET_SYSERR == TALER_amount_round_down (&amount_without_fee, @@ -291,7 +302,7 @@ expired_reserve_cb (void *cls, GNUNET_break (0); global_ret = EXIT_FAILURE; GNUNET_SCHEDULER_shutdown (); - return GNUNET_DB_STATUS_HARD_ERROR; + return GNUNET_SYSERR; } /* NOTE: sizeof (*reserve_pub) == sizeof (wtid) right now, but to be future-compatible, we use the memset + min construction */ @@ -302,16 +313,13 @@ expired_reserve_cb (void *cls, reserve_pub, GNUNET_MIN (sizeof (wtid), sizeof (*reserve_pub))); - if (TALER_AAR_INVALID_NEGATIVE_RESULT != ret) - qs = db_plugin->insert_reserve_closed (db_plugin->cls, - reserve_pub, - now, - account_payto_uri, - &wtid, - left, - &closing_fee); - else - qs = GNUNET_DB_STATUS_HARD_ERROR; + qs = db_plugin->insert_reserve_closed (db_plugin->cls, + reserve_pub, + now, + account_payto_uri, + &wtid, + left, + &closing_fee); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Closing reserve %s over %s (%d, %d)\n", TALER_B2S (reserve_pub), @@ -319,22 +327,30 @@ expired_reserve_cb (void *cls, (int) ret, qs); /* Check for hard failure */ - if ( (TALER_AAR_INVALID_NEGATIVE_RESULT == ret) || - (GNUNET_DB_STATUS_HARD_ERROR == qs) ) + if (GNUNET_DB_STATUS_HARD_ERROR == qs) { GNUNET_break (0); global_ret = EXIT_FAILURE; GNUNET_SCHEDULER_shutdown (); - return GNUNET_DB_STATUS_HARD_ERROR; + return GNUNET_SYSERR; } - if ( (TALER_AAR_RESULT_ZERO == ret) || - (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT != qs) ) + if (TALER_amount_is_zero (&amount_without_fee)) { /* Reserve balance was zero OR soft error */ GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Reserve was virtually empty, moving on\n"); - (void) commit_or_warn (); - return qs; + qs = commit_or_warn (); + switch (qs) + { + case GNUNET_DB_STATUS_HARD_ERROR: + GNUNET_break (0); + return GNUNET_SYSERR; + case GNUNET_DB_STATUS_SOFT_ERROR: + return GNUNET_NO; + case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: + case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: + return GNUNET_OK; + } } /* success, perform wire transfer */ @@ -355,19 +371,25 @@ expired_reserve_cb (void *cls, buf_size); GNUNET_free (buf); } - if (GNUNET_DB_STATUS_HARD_ERROR == qs) + switch (qs) { + case GNUNET_DB_STATUS_HARD_ERROR: GNUNET_break (0); global_ret = EXIT_FAILURE; GNUNET_SCHEDULER_shutdown (); - return GNUNET_DB_STATUS_HARD_ERROR; - } - if (GNUNET_DB_STATUS_SOFT_ERROR == qs) - { + return GNUNET_SYSERR; + case GNUNET_DB_STATUS_SOFT_ERROR: /* start again */ - return GNUNET_DB_STATUS_SUCCESS_NO_RESULTS; + return GNUNET_NO; + case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS: + GNUNET_break (0); + global_ret = EXIT_FAILURE; + GNUNET_SCHEDULER_shutdown (); + return GNUNET_SYSERR; + case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT: + break; } - return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT; + return GNUNET_OK; } diff --git a/src/exchange/taler-exchange-httpd_batch-deposit.c b/src/exchange/taler-exchange-httpd_batch-deposit.c index 3e24f6571..c2a9cbd54 100644 --- a/src/exchange/taler-exchange-httpd_batch-deposit.c +++ b/src/exchange/taler-exchange-httpd_batch-deposit.c @@ -545,6 +545,7 @@ TEH_handler_batch_deposit (struct TEH_RequestContext *rc, }; enum GNUNET_GenericReturnValue res; + (void) args; memset (&dc, 0, sizeof (dc)); diff --git a/src/exchange/taler-exchange-httpd_transfers_get.c b/src/exchange/taler-exchange-httpd_transfers_get.c index 0a994d8ec..2a6dc8776 100644 --- a/src/exchange/taler-exchange-httpd_transfers_get.c +++ b/src/exchange/taler-exchange-httpd_transfers_get.c @@ -280,6 +280,7 @@ handle_deposit_data (void *cls, (void) rowid; (void) denom_pub; + (void) h_payto; if (GNUNET_SYSERR == ctx->is_valid) return; if (GNUNET_NO == ctx->is_valid) diff --git a/src/exchangedb/irbt_callbacks.c b/src/exchangedb/irbt_callbacks.c index e725ad2c7..ffad1c9b0 100644 --- a/src/exchangedb/irbt_callbacks.c +++ b/src/exchangedb/irbt_callbacks.c @@ -266,7 +266,7 @@ irbt_cb_table_auditors (struct PostgresClosure *pg, GNUNET_PQ_query_param_auto_from_type (&td->details.auditors.auditor_pub), GNUNET_PQ_query_param_string (td->details.auditors.auditor_name), GNUNET_PQ_query_param_string (td->details.auditors.auditor_url), - GNUNET_PQ_query_param_bool (&td->details.auditors.is_active), + GNUNET_PQ_query_param_bool (td->details.auditors.is_active), GNUNET_PQ_query_param_timestamp (&td->details.auditors.last_change), GNUNET_PQ_query_param_end }; diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c index 5fb797978..505f493e5 100644 --- a/src/exchangedb/plugin_exchangedb_postgres.c +++ b/src/exchangedb/plugin_exchangedb_postgres.c @@ -2544,24 +2544,6 @@ prepare_statements (struct PostgresClosure *pg) /* Used in #postgres_get_expired_reserves() */ GNUNET_PQ_make_prepare ( "get_expired_reserves", - /* - "SELECT" - " expiration_date" - ",payto_uri AS account_details" - ",reserve_pub" - ",current_balance_val" - ",current_balance_frac" - " FROM reserves" - " JOIN reserves_in ri" - " USING (reserve_pub)" - " JOIN wire_targets wt" - " ON (ri.wire_source_h_payto = wt.wire_target_h_payto)" - " WHERE expiration_date<=$1" - " AND (current_balance_val != 0 " - " OR current_balance_frac != 0)" - " ORDER BY expiration_date ASC" - " LIMIT 1;", - */ "WITH ed AS MATERIALIZED ( " " SELECT * " " FROM reserves " @@ -4082,18 +4064,6 @@ prepare_statements (struct PostgresClosure *pg) ") VALUES " "($1, $2, $3, $4, $5, $6, $7);", 7), - // FIXME: dead! - GNUNET_PQ_make_prepare ( - "insert_into_table_account_merges", - "INSERT INTO account_merges" - "(account_merge_request_serial_id" - ",reserve_pub" - ",reserve_sig" - ",purse_pub" - ",wallet_h_payto" - ") VALUES " - "($1, $2, $3, $4, $5);", - 5), GNUNET_PQ_make_prepare ( "insert_into_table_history_requests", "INSERT INTO history_requests" @@ -10210,7 +10180,6 @@ reserve_expired_cb (void *cls, ret = GNUNET_SYSERR; break; } - // FIXME: ret here is a qs! Bad enum conversion! FIX DESIGN!!! ret = erc->rec (erc->rec_cls, &reserve_pub, &remaining_balance, @@ -10258,8 +10227,15 @@ postgres_get_expired_reserves (void *cls, params, &reserve_expired_cb, &ectx); - if (GNUNET_OK != ectx.status) + switch (ectx.status) + { + case GNUNET_SYSERR: return GNUNET_DB_STATUS_HARD_ERROR; + case GNUNET_NO: + return GNUNET_DB_STATUS_SOFT_ERROR; + case GNUNET_OK: + break; + } return qs; } @@ -15291,7 +15267,7 @@ postgres_release_revolving_shard (void *cls, * @param cls the @e cls of this struct with the plugin-specific state * @return transaction status code */ -enum GNUNET_DB_QueryStatus +enum GNUNET_GenericReturnValue postgres_delete_shard_locks (void *cls) { struct PostgresClosure *pg = cls; @@ -15301,7 +15277,6 @@ postgres_delete_shard_locks (void *cls) GNUNET_PQ_EXECUTE_STATEMENT_END }; - // FIXME: rval is a GNUNET_GenericReturnValue, not DB status! return GNUNET_PQ_exec_statements (pg->conn, es); } diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c index 366779230..1d14c7d52 100644 --- a/src/exchangedb/test_exchangedb.c +++ b/src/exchangedb/test_exchangedb.c @@ -445,16 +445,16 @@ static unsigned int auditor_row_cnt; * @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop */ static enum GNUNET_GenericReturnValue -audit_refresh_session_cb (void *cls, - uint64_t rowid, - const struct TALER_DenominationPublicKey *denom_pub, - const struct - TALER_AgeCommitmentHash *h_age_commitment, - const struct TALER_CoinSpendPublicKeyP *coin_pub, - const struct TALER_CoinSpendSignatureP *coin_sig, - const struct TALER_Amount *amount_with_fee, - uint32_t noreveal_index, - const struct TALER_RefreshCommitmentP *rc) +audit_refresh_session_cb ( + void *cls, + uint64_t rowid, + const struct TALER_DenominationPublicKey *denom_pub, + const struct TALER_AgeCommitmentHash *h_age_commitment, + const struct TALER_CoinSpendPublicKeyP *coin_pub, + const struct TALER_CoinSpendSignatureP *coin_sig, + const struct TALER_Amount *amount_with_fee, + uint32_t noreveal_index, + const struct TALER_RefreshCommitmentP *rc) { (void) cls; (void) rowid; @@ -464,6 +464,7 @@ audit_refresh_session_cb (void *cls, (void) amount_with_fee; (void) noreveal_index; (void) rc; + (void) h_age_commitment; auditor_row_cnt++; return GNUNET_OK; } @@ -535,6 +536,7 @@ cb_wt_never (void *cls, (void) serial_id; (void) merchant_pub; (void) account_payto_uri; + (void) h_payto; (void) exec_time; (void) h_contract_terms; (void) denom_pub; @@ -574,6 +576,7 @@ cb_wt_check (void *cls, { (void) rowid; (void) denom_pub; + (void) h_payto; GNUNET_assert (cls == &cb_wt_never); GNUNET_assert (0 == GNUNET_memcmp (merchant_pub, &merchant_pub_wt)); diff --git a/src/include/taler_exchangedb_plugin.h b/src/include/taler_exchangedb_plugin.h index 58d319aae..261ffb184 100644 --- a/src/include/taler_exchangedb_plugin.h +++ b/src/include/taler_exchangedb_plugin.h @@ -2673,9 +2673,11 @@ typedef void * @param left amount left in the reserve * @param account_details information about the reserve's bank account, in payto://-format * @param expiration_date when did the reserve expire - * @return transaction status code to pass on + * @return #GNUNET_OK on success, + * #GNUNET_NO to retry + * #GNUNET_SYSERR on hard failures (exit) */ -typedef enum GNUNET_DB_QueryStatus +typedef enum GNUNET_GenericReturnValue (*TALER_EXCHANGEDB_ReserveExpiredCallback)( void *cls, const struct TALER_ReservePublicKeyP *reserve_pub, @@ -5047,9 +5049,10 @@ struct TALER_EXCHANGEDB_Plugin * changed. * * @param cls the @e cls of this struct with the plugin-specific state - * @return transaction status code + * @return #GNUNET_OK on success + * #GNUNET_SYSERR on failure */ - enum GNUNET_DB_QueryStatus + enum GNUNET_GenericReturnValue (*delete_shard_locks)(void *cls); diff --git a/src/json/json_helper.c b/src/json/json_helper.c index 1db65ff66..fd7e99d93 100644 --- a/src/json/json_helper.c +++ b/src/json/json_helper.c @@ -419,7 +419,9 @@ parse_age_commitment (void *cls, unsigned int idx; size_t num; - if (NULL == root || ! json_is_array (root)) + (void) cls; + if ( (NULL == root) || + (! json_is_array (root))) { GNUNET_break_op (0); return GNUNET_SYSERR; @@ -645,7 +647,8 @@ parse_denom_pub_cipher (void *cls, struct GNUNET_JSON_Specification *spec) { struct TALER_DenominationPublicKey *denom_pub = spec->ptr; - enum TALER_DenominationCipher cipher = (enum TALER_DenominationCipher) cls; + enum TALER_DenominationCipher cipher = + (enum TALER_DenominationCipher) (long) cls; const char *emsg; unsigned int eline; diff --git a/src/kyclogic/kyclogic_api.c b/src/kyclogic/kyclogic_api.c index 5081e09d5..3170ba99c 100644 --- a/src/kyclogic/kyclogic_api.c +++ b/src/kyclogic/kyclogic_api.c @@ -1183,6 +1183,7 @@ TALER_KYCLOGIC_requirements_to_logic (const char *requirements, unsigned int max_checks = 0; const struct TALER_KYCLOGIC_KycProvider *kp_best = NULL; + // FIXME: use 'ut' to filter providers! if (NULL == requirements) return GNUNET_NO; { diff --git a/src/kyclogic/plugin_kyclogic_oauth2.c b/src/kyclogic/plugin_kyclogic_oauth2.c index b8f2d70fd..91c936bbc 100644 --- a/src/kyclogic/plugin_kyclogic_oauth2.c +++ b/src/kyclogic/plugin_kyclogic_oauth2.c @@ -520,6 +520,7 @@ oauth2_initiate (void *cls, { struct TALER_KYCLOGIC_InitiateHandle *ih; + (void) cls; ih = GNUNET_new (struct TALER_KYCLOGIC_InitiateHandle); ih->legitimization_uuid = legitimization_uuid; ih->cb = cb; @@ -943,6 +944,7 @@ oauth2_proof (void *cls, struct TALER_KYCLOGIC_ProofHandle *ph; const char *code; + (void) url_path; GNUNET_break (NULL == provider_user_id); ph = GNUNET_new (struct TALER_KYCLOGIC_ProofHandle); GNUNET_snprintf (ph->provider_legitimization_id, @@ -1153,6 +1155,13 @@ oauth2_webhook (void *cls, struct PluginState *ps = cls; struct TALER_KYCLOGIC_WebhookHandle *wh; + (void) pd; + (void) plc; + (void) plc_cls; + (void) http_method; + (void) url_path; + (void) connection; + (void) body; wh = GNUNET_new (struct TALER_KYCLOGIC_WebhookHandle); wh->cb = cb; wh->cb_cls = cb_cls; diff --git a/src/kyclogic/plugin_kyclogic_template.c b/src/kyclogic/plugin_kyclogic_template.c index 190c3321e..b4531117e 100644 --- a/src/kyclogic/plugin_kyclogic_template.c +++ b/src/kyclogic/plugin_kyclogic_template.c @@ -249,6 +249,7 @@ template_initiate (void *cls, { struct TALER_KYCLOGIC_InitiateHandle *ih; + (void) cls; ih = GNUNET_new (struct TALER_KYCLOGIC_InitiateHandle); ih->legitimization_uuid = legitimization_uuid; ih->cb = cb; @@ -303,6 +304,11 @@ template_proof (void *cls, struct PluginState *ps = cls; struct TALER_KYCLOGIC_ProofHandle *ph; + (void) url_path; + (void) account_id; + (void) process_row; + (void) provider_user_id; + (void) provider_legitimization_id; ph = GNUNET_new (struct TALER_KYCLOGIC_ProofHandle); ph->ps = ps; ph->pd = pd; @@ -358,6 +364,11 @@ template_webhook (void *cls, struct PluginState *ps = cls; struct TALER_KYCLOGIC_WebhookHandle *wh; + (void) plc; + (void) plc_cls; + (void) http_method; + (void) url_path; + (void) body; wh = GNUNET_new (struct TALER_KYCLOGIC_WebhookHandle); wh->cb = cb; wh->cb_cls = cb_cls; diff --git a/src/kyclogic/taler-exchange-kyc-tester.c b/src/kyclogic/taler-exchange-kyc-tester.c index 306493e2c..64b140877 100644 --- a/src/kyclogic/taler-exchange-kyc-tester.c +++ b/src/kyclogic/taler-exchange-kyc-tester.c @@ -454,8 +454,15 @@ webhook_finished_cb ( { struct KycWebhookContext *kwh = cls; + (void) expiration; + (void) provider_section; kwh->wh = NULL; - // FIXME: check arguments for validity? + GNUNET_break (0 == GNUNET_memcmp (account_id, + &cmd_line_h_payto)); + GNUNET_break (0 == strcmp (provider_user_id, + cmd_provider_user_id)); + GNUNET_break (0 == strcmp (provider_legitimization_id, + cmd_provider_legitimization_id)); switch (status) { case TALER_KYCLOGIC_STATUS_SUCCESS: @@ -524,6 +531,7 @@ kyc_provider_account_lookup ( struct TALER_PaytoHashP *h_payto, uint64_t *legi_row) { + (void) cls; GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Simulated account lookup using `%s/%s'\n", provider_section, @@ -695,6 +703,7 @@ proof_cb ( { struct ProofRequestState *rs = cls; + (void) expiration; GNUNET_log (GNUNET_ERROR_TYPE_MESSAGE, "KYC legitimization %s completed with status %d (%u) for %s\n", provider_legitimization_id, @@ -1305,6 +1314,7 @@ initiate_cb ( const char *provider_legitimization_id, const char *error_msg_hint) { + (void) cls; ih = NULL; if (TALER_EC_NONE != ec) { diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c index e2cad2df6..707e5cf5b 100644 --- a/src/lib/exchange_api_handle.c +++ b/src/lib/exchange_api_handle.c @@ -310,7 +310,6 @@ parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey *sign_key, * prior to calling this function, otherwise the signature verification * performed within this function will fail. * - * @param currency expected currency of all fees * @param[out] denom_key where to return the result * @param cipher cipher type to parse * @param check_sigs should we check signatures? @@ -321,13 +320,13 @@ parse_json_signkey (struct TALER_EXCHANGE_SigningPublicKey *sign_key, * invalid or the json malformed. */ static enum GNUNET_GenericReturnValue -parse_json_denomkey_partially (const char *currency, - struct TALER_EXCHANGE_DenomPublicKey *denom_key, - enum TALER_DenominationCipher cipher, - bool check_sigs, - json_t *denom_key_obj, - struct TALER_MasterPublicKeyP *master_key, - struct GNUNET_HashCode *hash_xor) +parse_json_denomkey_partially ( + struct TALER_EXCHANGE_DenomPublicKey *denom_key, + enum TALER_DenominationCipher cipher, + bool check_sigs, + json_t *denom_key_obj, + struct TALER_MasterPublicKeyP *master_key, + struct GNUNET_HashCode *hash_xor) { struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("master_sig", @@ -961,16 +960,17 @@ decode_keys_json (const json_t *resp_obj, json_typeof (denominations_by_group)); json_array_foreach (denominations_by_group, group_idx, group_obj) { - // Running XOR of each SHA512 hash of the denominations' public key in - // this group. Used to compare against group.hash after all keys have - // been parsed. + /* Running XOR of each SHA512 hash of the denominations' public key in + this group. Used to compare against group.hash after all keys have + been parsed. */ struct GNUNET_HashCode group_hash_xor = {0}; - // First, parse { cipher, fees, value, age_mask, hash } of the current - // group. + /* First, parse { cipher, fees, value, age_mask, hash } of the current + group. */ struct TALER_DenominationGroup group = {0}; struct GNUNET_JSON_Specification group_spec[] = { - TALER_JSON_spec_denomination_group (NULL, currency, &group), + TALER_JSON_spec_denomination_group (NULL, + currency, &group), GNUNET_JSON_spec_end () }; EXITIF (GNUNET_SYSERR == @@ -979,7 +979,7 @@ decode_keys_json (const json_t *resp_obj, NULL, NULL)); - // Now, parse the individual denominations + /* Now, parse the individual denominations */ { json_t *denom_keys_array; json_t *denom_key_obj; @@ -993,24 +993,23 @@ decode_keys_json (const json_t *resp_obj, memset (&dk, 0, sizeof (dk)); - // Set the common fields from the group for this particular - // denomination. Required to make the validity check inside - // parse_json_denomkey_partially pass + /* Set the common fields from the group for this particular + denomination. Required to make the validity check inside + parse_json_denomkey_partially pass */ dk.key.cipher = group.cipher; dk.value = group.value; dk.fees = group.fees; dk.key.age_mask = group.age_mask; EXITIF (GNUNET_SYSERR == - parse_json_denomkey_partially (key_data->currency, - &dk, + parse_json_denomkey_partially (&dk, group.cipher, check_sig, denom_key_obj, &key_data->master_pub, check_sig ? &hash_xor : NULL)); - // Build the running xor of the SHA512-hash of the public keys + /* Build the running xor of the SHA512-hash of the public keys */ { struct TALER_DenominationHashP hc = {0}; TALER_denom_pub_hash (&dk.key, &hc); diff --git a/src/lib/exchange_api_purse_deposit.c b/src/lib/exchange_api_purse_deposit.c index 922251012..1056deff8 100644 --- a/src/lib/exchange_api_purse_deposit.c +++ b/src/lib/exchange_api_purse_deposit.c @@ -463,6 +463,8 @@ TALER_EXCHANGE_purse_deposit ( CURL *eh; char arg_str[sizeof (pch->purse_pub) * 2 + 32]; + // FIXME: use purse_exchange_url for wad transfers (#7271) + (void) purse_exchange_url; if (0 == num_deposits) { GNUNET_break (0); diff --git a/src/sq/test_sq.c b/src/sq/test_sq.c index 5f715ad6c..f8292b4d3 100644 --- a/src/sq/test_sq.c +++ b/src/sq/test_sq.c @@ -152,6 +152,8 @@ main (int argc, sqlite3 *db; int ret; + (void) argc; + (void) argv; GNUNET_log_setup ("test-pq", "WARNING", NULL); diff --git a/src/templating/templating_api.c b/src/templating/templating_api.c index b51c3a5c3..6384672f3 100644 --- a/src/templating/templating_api.c +++ b/src/templating/templating_api.c @@ -314,7 +314,7 @@ TALER_TEMPLATING_reply (struct MHD_Connection *connection, /** * Function called with a template's filename. * - * @param cls closure + * @param cls closure, NULL * @param filename complete filename (absolute path) * @return #GNUNET_OK to continue to iterate, * #GNUNET_NO to stop iteration with no error, @@ -331,6 +331,7 @@ load_template (void *cls, char *map; const char *name; + (void) cls; if ('.' == filename[0]) return GNUNET_OK; diff --git a/src/templating/test_mustach_jansson.c b/src/templating/test_mustach_jansson.c index 11af86faa..be3db67d2 100644 --- a/src/templating/test_mustach_jansson.c +++ b/src/templating/test_mustach_jansson.c @@ -83,6 +83,8 @@ main (int argc, const char *xc_de = "summary: DEUTSCH"; const char *xc_fr = "summary: FRANCAISE"; + (void) argc; + (void) argv; GNUNET_assert (NULL != root); GNUNET_assert (NULL != arr); GNUNET_assert (NULL != obj); diff --git a/src/testing/testing_api_cmd_bank_admin_add_incoming.c b/src/testing/testing_api_cmd_bank_admin_add_incoming.c index 9db874faf..973209f28 100644 --- a/src/testing/testing_api_cmd_bank_admin_add_incoming.c +++ b/src/testing/testing_api_cmd_bank_admin_add_incoming.c @@ -232,7 +232,7 @@ confirmation_cb (void *cls, * bounces the payment back in the same way it does for * malformed reserve public keys. */ - if (-1 == fts->expected_http_status) + if (-1 == (int) fts->expected_http_status) { TALER_TESTING_interpreter_next (is); return; diff --git a/src/testing/testing_api_helpers_auditor.c b/src/testing/testing_api_helpers_auditor.c index b74258004..2ae1efb25 100644 --- a/src/testing/testing_api_helpers_auditor.c +++ b/src/testing/testing_api_helpers_auditor.c @@ -114,6 +114,7 @@ auditor_version_cb (void *cls, struct TALER_TESTING_Interpreter *is = cls; (void) hr; + (void) vi; if (TALER_AUDITOR_VC_MATCH != compat) { TALER_TESTING_interpreter_fail (is); diff --git a/src/util/age_restriction.c b/src/util/age_restriction.c index 189ec4e8c..b87c8543e 100644 --- a/src/util/age_restriction.c +++ b/src/util/age_restriction.c @@ -39,7 +39,7 @@ TALER_age_commitment_hash ( } GNUNET_assert (__builtin_popcount (commitment->mask.bits) - 1 == - commitment->num); + (int) commitment->num); hash_context = GNUNET_CRYPTO_hash_context_start (); @@ -178,7 +178,7 @@ TALER_age_commitment_derive ( GNUNET_assert (NULL != newacp); GNUNET_assert (orig->proof.num <= orig->commitment.num); - GNUNET_assert (orig->commitment.num == + GNUNET_assert (((int) orig->commitment.num) == __builtin_popcount (orig->commitment.mask.bits) - 1); newacp->commitment.mask = orig->commitment.mask; diff --git a/src/util/exchange_signatures.c b/src/util/exchange_signatures.c index 3f590325c..52919d2e9 100644 --- a/src/util/exchange_signatures.c +++ b/src/util/exchange_signatures.c @@ -853,8 +853,9 @@ TALER_exchange_online_confirm_recoup_sign ( struct TALER_RecoupConfirmationPS pc = { .purpose.size = htonl (sizeof (pc)), .purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP), - .reserve_pub = *reserve_pub, - .coin_pub = *coin_pub + .timestamp = GNUNET_TIME_timestamp_hton (timestamp), + .coin_pub = *coin_pub, + .reserve_pub = *reserve_pub }; TALER_amount_hton (&pc.recoup_amount, @@ -877,8 +878,9 @@ TALER_exchange_online_confirm_recoup_verify ( struct TALER_RecoupConfirmationPS pc = { .purpose.size = htonl (sizeof (pc)), .purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP), - .reserve_pub = *reserve_pub, - .coin_pub = *coin_pub + .timestamp = GNUNET_TIME_timestamp_hton (timestamp), + .coin_pub = *coin_pub, + .reserve_pub = *reserve_pub }; TALER_amount_hton (&pc.recoup_amount, diff --git a/src/util/taler-exchange-secmod-rsa.c b/src/util/taler-exchange-secmod-rsa.c index 40b4f51de..819312f69 100644 --- a/src/util/taler-exchange-secmod-rsa.c +++ b/src/util/taler-exchange-secmod-rsa.c @@ -583,6 +583,7 @@ sem_init (struct Semaphore *sem, GNUNET_assert (0 == pthread_cond_init (&sem->cv, NULL)); + sem->ctr = val; } -- cgit v1.2.3