aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2024-08-27 00:15:54 +0200
committerChristian Grothoff <christian@grothoff.org>2024-08-27 00:15:54 +0200
commit4521504d17fd2e37c9159b98aba131bd4b5b693f (patch)
tree684b83f534a646670ca9716938352e7f40b99901
parent0b25fe9e91304f9b0be6acebba243481615b7907 (diff)
-style fixes
-rw-r--r--src/auditordb/pg_update_generic_suppressed.c4
-rw-r--r--src/bank-lib/fakebank_bank_get_root.c5
-rw-r--r--src/bank-lib/fakebank_common_lp.c1
-rw-r--r--src/bank-lib/fakebank_common_make_admin_transfer.c1
-rw-r--r--src/bank-lib/fakebank_common_parser.c1
-rw-r--r--src/bank-lib/fakebank_tbr.c1
-rw-r--r--src/bank-lib/fakebank_tbr_get_history.c4
-rw-r--r--src/bank-lib/fakebank_tbr_get_root.c6
-rw-r--r--src/bank-lib/fakebank_twg_get_root.c6
-rw-r--r--src/bank-lib/fakebank_twg_history.c9
-rw-r--r--src/bank-lib/fakebank_twg_transfer.c84
-rw-r--r--src/exchange/taler-exchange-closer.c85
-rw-r--r--src/exchange/taler-exchange-httpd.c11
-rw-r--r--src/exchange/taler-exchange-httpd_age-withdraw.c5
-rw-r--r--src/exchange/taler-exchange-httpd_aml-decision.c1
-rw-r--r--src/exchange/taler-exchange-httpd_coins_get.c5
-rw-r--r--src/exchange/taler-exchange-httpd_common_kyc.c2
-rw-r--r--src/exchange/taler-exchange-httpd_extensions.c4
-rw-r--r--src/exchange/taler-exchange-httpd_keys.c2
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-check.c1
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-check.h2
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-info.c12
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-proof.c2
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-start.c2
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-start.h11
-rw-r--r--src/exchange/taler-exchange-httpd_kyc-upload.c5
-rw-r--r--src/exchange/taler-exchange-httpd_refreshes_reveal.c118
-rw-r--r--src/exchange/taler-exchange-httpd_reserves_history.c5
-rw-r--r--src/exchange/taler-exchange-httpd_spa.c3
-rw-r--r--src/exchange/taler-exchange-httpd_terms.c1
-rw-r--r--src/exchangedb/Makefile.am3
-rw-r--r--src/exchangedb/exchangedb_plugin.c2
-rw-r--r--src/exchangedb/pg_batch_ensure_coin_known.c93
-rw-r--r--src/exchangedb/pg_begin_revolving_shard.c16
-rw-r--r--src/exchangedb/pg_begin_shard.c14
-rw-r--r--src/exchangedb/pg_inject_auditor_triggers.c1
-rw-r--r--src/exchangedb/pg_iterate_reserve_close_info.c2
-rw-r--r--src/exchangedb/pg_lookup_completed_legitimization.c4
-rw-r--r--src/exchangedb/pg_preflight.c11
-rw-r--r--src/exchangedb/pg_reserves_in_insert.c16
-rw-r--r--src/exchangedb/pg_select_reserve_closed_above_serial_id.c2
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c5
-rw-r--r--src/extensions/extensions.c5
-rw-r--r--src/include/taler_crypto_lib.h2
-rw-r--r--src/include/taler_pq_lib.h20
-rw-r--r--src/json/json.c10
-rw-r--r--src/kyclogic/kyclogic_api.c4
-rw-r--r--src/kyclogic/plugin_kyclogic_oauth2.c10
-rw-r--r--src/kyclogic/plugin_kyclogic_persona.c10
-rw-r--r--src/mhd/mhd_legal.c4
-rw-r--r--src/pq/pq_query_helper.c16
-rw-r--r--src/pq/pq_result_helper.c121
-rw-r--r--src/sq/sq_result_helper.c6
-rw-r--r--src/templating/mustach-tool.c5
-rw-r--r--src/util/crypto_confirmation.c5
-rw-r--r--src/util/crypto_contract.c11
-rw-r--r--src/util/crypto_helper_common.c1
-rw-r--r--src/util/crypto_helper_cs.c8
-rw-r--r--src/util/crypto_helper_esign.c2
-rw-r--r--src/util/crypto_helper_rsa.c6
-rw-r--r--src/util/iban.c4
-rw-r--r--src/util/os_installation.c3
-rw-r--r--src/util/payto.c2
-rw-r--r--src/util/secmod_common.c39
-rw-r--r--src/util/taler-exchange-secmod-cs.c40
-rw-r--r--src/util/taler-exchange-secmod-eddsa.c18
-rw-r--r--src/util/taler-exchange-secmod-rsa.c43
-rw-r--r--src/util/tokens.c2
68 files changed, 494 insertions, 471 deletions
diff --git a/src/auditordb/pg_update_generic_suppressed.c b/src/auditordb/pg_update_generic_suppressed.c
index ef58d855c..21002a185 100644
--- a/src/auditordb/pg_update_generic_suppressed.c
+++ b/src/auditordb/pg_update_generic_suppressed.c
@@ -13,12 +13,10 @@
You should have received a copy of the GNU General Public License along with
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
-
-
#include "platform.h"
#include "taler_pq_lib.h"
#include "pg_helper.h"
-#include "pg_update_closure_lags.h"
+#include "pg_update_generic_suppressed.h"
struct Preparations
{
diff --git a/src/bank-lib/fakebank_bank_get_root.c b/src/bank-lib/fakebank_bank_get_root.c
index 8c34697b4..ef2247e36 100644
--- a/src/bank-lib/fakebank_bank_get_root.c
+++ b/src/bank-lib/fakebank_bank_get_root.c
@@ -46,10 +46,9 @@ TALER_FAKEBANK_bank_get_root_ (struct TALER_FAKEBANK_Handle *h,
#define HELLOMSG "Hello, Fakebank!"
(void) h;
- resp = MHD_create_response_from_buffer (
+ resp = MHD_create_response_from_buffer_static (
strlen (HELLOMSG),
- HELLOMSG,
- MHD_RESPMEM_MUST_COPY);
+ HELLOMSG);
ret = MHD_queue_response (connection,
MHD_HTTP_OK,
resp);
diff --git a/src/bank-lib/fakebank_common_lp.c b/src/bank-lib/fakebank_common_lp.c
index 22a9e3ab4..e73ed4593 100644
--- a/src/bank-lib/fakebank_common_lp.c
+++ b/src/bank-lib/fakebank_common_lp.c
@@ -32,6 +32,7 @@
#include "taler_mhd_lib.h"
#include <gnunet/gnunet_mhd_compat.h>
#include "fakebank.h"
+#include "fakebank_common_lp.h"
void
diff --git a/src/bank-lib/fakebank_common_make_admin_transfer.c b/src/bank-lib/fakebank_common_make_admin_transfer.c
index 865eaa640..c80592d73 100644
--- a/src/bank-lib/fakebank_common_make_admin_transfer.c
+++ b/src/bank-lib/fakebank_common_make_admin_transfer.c
@@ -28,6 +28,7 @@
#include "taler_mhd_lib.h"
#include <gnunet/gnunet_mhd_compat.h>
#include "fakebank.h"
+#include "fakebank_common_make_admin_transfer.h"
#include "fakebank_common_lookup.h"
#include "fakebank_common_lp.h"
#include "fakebank_common_transact.h"
diff --git a/src/bank-lib/fakebank_common_parser.c b/src/bank-lib/fakebank_common_parser.c
index cf2dc5a74..82836359a 100644
--- a/src/bank-lib/fakebank_common_parser.c
+++ b/src/bank-lib/fakebank_common_parser.c
@@ -27,6 +27,7 @@
#include "taler_mhd_lib.h"
#include <gnunet/gnunet_mhd_compat.h>
#include "fakebank.h"
+#include "fakebank_common_parser.h"
enum GNUNET_GenericReturnValue
diff --git a/src/bank-lib/fakebank_tbr.c b/src/bank-lib/fakebank_tbr.c
index 0f0e5bdc1..4de6028a9 100644
--- a/src/bank-lib/fakebank_tbr.c
+++ b/src/bank-lib/fakebank_tbr.c
@@ -27,6 +27,7 @@
#include "taler_mhd_lib.h"
#include <gnunet/gnunet_mhd_compat.h>
#include "fakebank.h"
+#include "fakebank_tbr.h"
#include "fakebank_tbr_get_history.h"
#include "fakebank_tbr_get_root.h"
diff --git a/src/bank-lib/fakebank_tbr_get_history.c b/src/bank-lib/fakebank_tbr_get_history.c
index a6cfaad8d..f6aa8f5cc 100644
--- a/src/bank-lib/fakebank_tbr_get_history.c
+++ b/src/bank-lib/fakebank_tbr_get_history.c
@@ -296,7 +296,7 @@ finish:
0);
}
{
- json_t *h = hc->history;
+ json_t *jh = hc->history;
hc->history = NULL;
return TALER_MHD_REPLY_JSON_PACK (
@@ -307,6 +307,6 @@ finish:
acc_payto_uri),
GNUNET_JSON_pack_array_steal (
"incoming_transactions",
- h));
+ jh));
}
}
diff --git a/src/bank-lib/fakebank_tbr_get_root.c b/src/bank-lib/fakebank_tbr_get_root.c
index 6e518d661..17591da18 100644
--- a/src/bank-lib/fakebank_tbr_get_root.c
+++ b/src/bank-lib/fakebank_tbr_get_root.c
@@ -27,6 +27,7 @@
#include "taler_mhd_lib.h"
#include <gnunet/gnunet_mhd_compat.h>
#include "fakebank.h"
+#include "fakebank_tbr_get_root.h"
MHD_RESULT
@@ -38,10 +39,9 @@ TALER_FAKEBANK_tbr_get_root (struct TALER_FAKEBANK_Handle *h,
#define HELLOMSG "Hello, Fakebank (Bank Revenue API here)!"
(void) h;
- resp = MHD_create_response_from_buffer (
+ resp = MHD_create_response_from_buffer_static (
strlen (HELLOMSG),
- HELLOMSG,
- MHD_RESPMEM_MUST_COPY);
+ HELLOMSG);
ret = MHD_queue_response (connection,
MHD_HTTP_OK,
resp);
diff --git a/src/bank-lib/fakebank_twg_get_root.c b/src/bank-lib/fakebank_twg_get_root.c
index 09589890e..af40ed820 100644
--- a/src/bank-lib/fakebank_twg_get_root.c
+++ b/src/bank-lib/fakebank_twg_get_root.c
@@ -27,6 +27,7 @@
#include "taler_mhd_lib.h"
#include <gnunet/gnunet_mhd_compat.h>
#include "fakebank.h"
+#include "fakebank_twg_get_root.h"
/**
@@ -46,10 +47,9 @@ TALER_FAKEBANK_twg_get_root_ (
#define HELLOMSG "Hello, Fakebank (Taler Wire Gateway)!"
(void) h;
- resp = MHD_create_response_from_buffer (
+ resp = MHD_create_response_from_buffer_static (
strlen (HELLOMSG),
- HELLOMSG,
- MHD_RESPMEM_MUST_COPY);
+ HELLOMSG);
ret = MHD_queue_response (connection,
MHD_HTTP_OK,
resp);
diff --git a/src/bank-lib/fakebank_twg_history.c b/src/bank-lib/fakebank_twg_history.c
index ccb385537..9e5ef3b98 100644
--- a/src/bank-lib/fakebank_twg_history.c
+++ b/src/bank-lib/fakebank_twg_history.c
@@ -28,6 +28,7 @@
#include "taler_mhd_lib.h"
#include <gnunet/gnunet_mhd_compat.h>
#include "fakebank.h"
+#include "fakebank_twg_history.h"
#include "fakebank_common_lookup.h"
#include "fakebank_common_lp.h"
#include "fakebank_common_parser.h"
@@ -288,7 +289,7 @@ finish:
0);
}
{
- json_t *h = hc->history;
+ json_t *jh = hc->history;
hc->history = NULL;
return TALER_MHD_REPLY_JSON_PACK (
@@ -299,7 +300,7 @@ finish:
acc_payto_uri),
GNUNET_JSON_pack_array_steal (
"outgoing_transactions",
- h));
+ jh));
}
}
@@ -564,7 +565,7 @@ finish:
0);
}
{
- json_t *h = hc->history;
+ json_t *jh = hc->history;
hc->history = NULL;
return TALER_MHD_REPLY_JSON_PACK (
@@ -575,6 +576,6 @@ finish:
acc_payto_uri),
GNUNET_JSON_pack_array_steal (
"incoming_transactions",
- h));
+ jh));
}
}
diff --git a/src/bank-lib/fakebank_twg_transfer.c b/src/bank-lib/fakebank_twg_transfer.c
index fef314a52..6a22c7dad 100644
--- a/src/bank-lib/fakebank_twg_transfer.c
+++ b/src/bank-lib/fakebank_twg_transfer.c
@@ -117,53 +117,49 @@ TALER_FAKEBANK_handle_transfer_ (
json_decref (json);
return (GNUNET_NO == ret) ? MHD_YES : MHD_NO;
}
+ credit = TALER_xtalerbank_account_from_payto (credit_account);
+ if (NULL == credit)
{
- enum GNUNET_GenericReturnValue ret;
-
- credit = TALER_xtalerbank_account_from_payto (credit_account);
- if (NULL == credit)
- {
- GNUNET_break_op (0);
- return TALER_MHD_reply_with_error (
- connection,
- MHD_HTTP_BAD_REQUEST,
- TALER_EC_GENERIC_PAYTO_URI_MALFORMED,
- credit_account);
- }
- ret = TALER_FAKEBANK_make_transfer_ (h,
- account,
- credit,
- &amount,
- &wtid,
- base_url,
- &uuid,
- &row_id,
- &ts);
- if (GNUNET_OK != ret)
- {
- MHD_RESULT res;
- char *uids;
+ GNUNET_break_op (0);
+ return TALER_MHD_reply_with_error (
+ connection,
+ MHD_HTTP_BAD_REQUEST,
+ TALER_EC_GENERIC_PAYTO_URI_MALFORMED,
+ credit_account);
+ }
+ ret = TALER_FAKEBANK_make_transfer_ (h,
+ account,
+ credit,
+ &amount,
+ &wtid,
+ base_url,
+ &uuid,
+ &row_id,
+ &ts);
+ if (GNUNET_OK != ret)
+ {
+ MHD_RESULT res;
+ char *uids;
- GNUNET_break (0);
- uids = GNUNET_STRINGS_data_to_string_alloc (&uuid,
- sizeof (uuid));
- json_decref (json);
- res = TALER_MHD_reply_with_error (connection,
- MHD_HTTP_CONFLICT,
- TALER_EC_BANK_TRANSFER_REQUEST_UID_REUSED,
- uids);
- GNUNET_free (uids);
- return res;
- }
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Receiving incoming wire transfer: %s->%s, subject: %s, amount: %s, from %s\n",
- account,
- credit,
- TALER_B2S (&wtid),
- TALER_amount2s (&amount),
- base_url);
- GNUNET_free (credit);
+ GNUNET_break (0);
+ uids = GNUNET_STRINGS_data_to_string_alloc (&uuid,
+ sizeof (uuid));
+ json_decref (json);
+ res = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_CONFLICT,
+ TALER_EC_BANK_TRANSFER_REQUEST_UID_REUSED,
+ uids);
+ GNUNET_free (uids);
+ return res;
}
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Receiving incoming wire transfer: %s->%s, subject: %s, amount: %s, from %s\n",
+ account,
+ credit,
+ TALER_B2S (&wtid),
+ TALER_amount2s (&amount),
+ base_url);
+ GNUNET_free (credit);
}
json_decref (json);
diff --git a/src/exchange/taler-exchange-closer.c b/src/exchange/taler-exchange-closer.c
index 779525c4e..4e64e2b20 100644
--- a/src/exchange/taler-exchange-closer.c
+++ b/src/exchange/taler-exchange-closer.c
@@ -224,7 +224,6 @@ expired_reserve_cb (void *cls,
struct TALER_Amount closing_fee;
struct TALER_WireFeeSet fees;
enum TALER_AmountArithmeticResult ret;
- enum GNUNET_DB_QueryStatus qs;
const struct TALER_EXCHANGEDB_AccountInfo *wa;
(void) cls;
@@ -316,30 +315,37 @@ expired_reserve_cb (void *cls,
reserve_pub,
GNUNET_MIN (sizeof (wtid),
sizeof (*reserve_pub)));
- qs = db_plugin->insert_reserve_closed (db_plugin->cls,
- reserve_pub,
- now,
- account_payto_uri,
- &wtid,
- left,
- &closing_fee,
- close_request_row);
- GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Closing reserve %s over %s (%d, %d)\n",
- TALER_B2S (reserve_pub),
- TALER_amount2s (left),
- (int) ret,
- qs);
- /* Check for hard failure */
- if (GNUNET_DB_STATUS_HARD_ERROR == qs)
+
{
- GNUNET_break (0);
- global_ret = EXIT_FAILURE;
- GNUNET_SCHEDULER_shutdown ();
- return GNUNET_SYSERR;
+ enum GNUNET_DB_QueryStatus qs;
+
+ qs = db_plugin->insert_reserve_closed (db_plugin->cls,
+ reserve_pub,
+ now,
+ account_payto_uri,
+ &wtid,
+ left,
+ &closing_fee,
+ close_request_row);
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Closing reserve %s over %s (%d, %d)\n",
+ TALER_B2S (reserve_pub),
+ TALER_amount2s (left),
+ (int) ret,
+ qs);
+ /* Check for hard failure */
+ if (GNUNET_DB_STATUS_HARD_ERROR == qs)
+ {
+ GNUNET_break (0);
+ global_ret = EXIT_FAILURE;
+ GNUNET_SCHEDULER_shutdown ();
+ return GNUNET_SYSERR;
+ }
}
if (TALER_amount_is_zero (&amount_without_fee))
{
+ enum GNUNET_DB_QueryStatus qs;
+
/* Reserve balance was zero OR soft error */
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Reserve was virtually empty, moving on\n");
@@ -361,6 +367,7 @@ expired_reserve_cb (void *cls,
{
void *buf;
size_t buf_size;
+ enum GNUNET_DB_QueryStatus qs;
TALER_BANK_prepare_transfer (account_payto_uri,
&amount_without_fee,
@@ -374,24 +381,24 @@ expired_reserve_cb (void *cls,
buf,
buf_size);
GNUNET_free (buf);
- }
- switch (qs)
- {
- case GNUNET_DB_STATUS_HARD_ERROR:
- GNUNET_break (0);
- global_ret = EXIT_FAILURE;
- GNUNET_SCHEDULER_shutdown ();
- return GNUNET_SYSERR;
- case GNUNET_DB_STATUS_SOFT_ERROR:
- /* start again */
- 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;
+ switch (qs)
+ {
+ case GNUNET_DB_STATUS_HARD_ERROR:
+ GNUNET_break (0);
+ global_ret = EXIT_FAILURE;
+ GNUNET_SCHEDULER_shutdown ();
+ return GNUNET_SYSERR;
+ case GNUNET_DB_STATUS_SOFT_ERROR:
+ /* start again */
+ 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_OK;
}
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index f2fccfe87..7fa8885e7 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -2601,10 +2601,10 @@ connection_done (void *cls,
static void
do_shutdown (void *cls)
{
- struct MHD_Daemon *mhd;
+ struct MHD_Daemon *my_mhd;
(void) cls;
- mhd = TALER_MHD_daemon_stop ();
+ my_mhd = TALER_MHD_daemon_stop ();
TEH_resume_keys_requests (true);
TEH_age_withdraw_cleanup ();
TEH_batch_withdraw_cleanup ();
@@ -2619,11 +2619,12 @@ do_shutdown (void *cls)
TEH_kyc_check_cleanup ();
TEH_kyc_info_cleanup ();
TEH_kyc_proof_cleanup ();
+ TEH_kyc_start_cleanup ();
TALER_KYCLOGIC_kyc_done ();
- if (NULL != mhd)
+ if (NULL != my_mhd)
{
- MHD_stop_daemon (mhd);
- mhd = NULL;
+ MHD_stop_daemon (my_mhd);
+ my_mhd = NULL;
}
TEH_wire_done ();
TEH_extensions_done ();
diff --git a/src/exchange/taler-exchange-httpd_age-withdraw.c b/src/exchange/taler-exchange-httpd_age-withdraw.c
index ce1ea951d..dbfc9b5e7 100644
--- a/src/exchange/taler-exchange-httpd_age-withdraw.c
+++ b/src/exchange/taler-exchange-httpd_age-withdraw.c
@@ -966,6 +966,8 @@ TEH_handler_age_withdraw (
size_t num_coins = json_array_size (j_denom_hs);
const char *error = NULL;
+ _Static_assert ((TALER_MAX_FRESH_COINS < INT_MAX / TALER_CNC_KAPPA),
+ "TALER_MAX_FRESH_COINS too large");
if (0 == num_coins)
error = "denoms_h must not be empty";
else if (num_coins != json_array_size (j_blinded_coin_evs))
@@ -979,9 +981,6 @@ TEH_handler_age_withdraw (
error =
"maximum number of coins that can be withdrawn has been exceeded";
- _Static_assert ((TALER_MAX_FRESH_COINS < INT_MAX / TALER_CNC_KAPPA),
- "TALER_MAX_FRESH_COINS too large");
-
if (NULL != error)
{
GNUNET_break_op (0);
diff --git a/src/exchange/taler-exchange-httpd_aml-decision.c b/src/exchange/taler-exchange-httpd_aml-decision.c
index 5eeec080f..64d808896 100644
--- a/src/exchange/taler-exchange-httpd_aml-decision.c
+++ b/src/exchange/taler-exchange-httpd_aml-decision.c
@@ -29,6 +29,7 @@
#include "taler_kyclogic_lib.h"
#include "taler_signatures.h"
#include "taler-exchange-httpd_responses.h"
+#include "taler-exchange-httpd_aml-decision.h"
MHD_RESULT
diff --git a/src/exchange/taler-exchange-httpd_coins_get.c b/src/exchange/taler-exchange-httpd_coins_get.c
index 7d61fd5a4..7c192b26a 100644
--- a/src/exchange/taler-exchange-httpd_coins_get.c
+++ b/src/exchange/taler-exchange-httpd_coins_get.c
@@ -655,9 +655,8 @@ TEH_handler_coins_get (struct TEH_RequestContext *rc,
if (NULL == tl)
{
/* 204: empty history */
- resp = MHD_create_response_from_buffer (0,
- "",
- MHD_RESPMEM_PERSISTENT);
+ resp = MHD_create_response_from_buffer_static (0,
+ "");
http_status = MHD_HTTP_NO_CONTENT;
}
else
diff --git a/src/exchange/taler-exchange-httpd_common_kyc.c b/src/exchange/taler-exchange-httpd_common_kyc.c
index 226bc581d..20d8b0ecf 100644
--- a/src/exchange/taler-exchange-httpd_common_kyc.c
+++ b/src/exchange/taler-exchange-httpd_common_kyc.c
@@ -503,7 +503,7 @@ add_kyc_history_entry (
* @param cb_cls closure for @a cb
* @return handle to cancel the operation
*/
-struct TEH_KycAmlTrigger *
+static struct TEH_KycAmlTrigger *
TEH_kyc_finished2 (
const struct GNUNET_AsyncScopeId *scope,
uint64_t process_row,
diff --git a/src/exchange/taler-exchange-httpd_extensions.c b/src/exchange/taler-exchange-httpd_extensions.c
index e95ec56e2..607db5804 100644
--- a/src/exchange/taler-exchange-httpd_extensions.c
+++ b/src/exchange/taler-exchange-httpd_extensions.c
@@ -48,11 +48,11 @@ extension_update_event_cb (void *cls,
const void *extra,
size_t extra_size)
{
- (void) cls;
uint32_t nbo_type;
enum TALER_Extension_Type type;
const struct TALER_Extension *extension;
+ (void) cls;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Received extensions update event\n");
@@ -67,7 +67,7 @@ extension_update_event_cb (void *cls,
GNUNET_assert (NULL != extra);
nbo_type = *(uint32_t *) extra;
- type = (enum TALER_Extension_Type) ntohl (nbo_type);
+ type = (enum TALER_Extension_Type) (int) ntohl (nbo_type);
/* Get the corresponding extension */
extension = TALER_extensions_get_by_type (type);
diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c
index 094a41b37..107e77961 100644
--- a/src/exchange/taler-exchange-httpd_keys.c
+++ b/src/exchange/taler-exchange-httpd_keys.c
@@ -956,7 +956,7 @@ TEH_wire_update_state (void)
*
* @return NULL on error
*/
-struct WireStateHandle *
+static struct WireStateHandle *
get_wire_state (void)
{
struct WireStateHandle *old_wsh;
diff --git a/src/exchange/taler-exchange-httpd_kyc-check.c b/src/exchange/taler-exchange-httpd_kyc-check.c
index 78073d83b..bc4a120f3 100644
--- a/src/exchange/taler-exchange-httpd_kyc-check.c
+++ b/src/exchange/taler-exchange-httpd_kyc-check.c
@@ -30,6 +30,7 @@
#include "taler_signatures.h"
#include "taler_dbevents.h"
#include "taler-exchange-httpd_keys.h"
+#include "taler-exchange-httpd_kyc-check.h"
#include "taler-exchange-httpd_kyc-wallet.h"
#include "taler-exchange-httpd_responses.h"
diff --git a/src/exchange/taler-exchange-httpd_kyc-check.h b/src/exchange/taler-exchange-httpd_kyc-check.h
index f1f2c9e7d..147aa5888 100644
--- a/src/exchange/taler-exchange-httpd_kyc-check.h
+++ b/src/exchange/taler-exchange-httpd_kyc-check.h
@@ -36,7 +36,7 @@
MHD_RESULT
TEH_handler_kyc_check (
struct TEH_RequestContext *rc,
- const char *const args[]);
+ const char *const args[1]);
/**
diff --git a/src/exchange/taler-exchange-httpd_kyc-info.c b/src/exchange/taler-exchange-httpd_kyc-info.c
index 88da07de3..b2b4a0d8d 100644
--- a/src/exchange/taler-exchange-httpd_kyc-info.c
+++ b/src/exchange/taler-exchange-httpd_kyc-info.c
@@ -30,7 +30,7 @@
#include "taler_signatures.h"
#include "taler_dbevents.h"
#include "taler-exchange-httpd_keys.h"
-#include "taler-exchange-httpd_kyc-wallet.h"
+#include "taler-exchange-httpd_kyc-info.h"
#include "taler-exchange-httpd_responses.h"
@@ -221,18 +221,18 @@ generate_reply (struct KycPoller *kyp,
&measures),
GNUNET_JSON_spec_end ()
};
- enum GNUNET_GenericReturnValue res;
+ enum GNUNET_GenericReturnValue ret;
const char *ename;
unsigned int eline;
json_t *kris;
size_t i;
json_t *mi;
- res = GNUNET_JSON_parse (jmeasures,
+ ret = GNUNET_JSON_parse (jmeasures,
spec,
&ename,
&eline);
- if (GNUNET_OK != res)
+ if (GNUNET_OK != ret)
{
GNUNET_break (0);
return TALER_MHD_reply_with_ec (
@@ -255,11 +255,11 @@ generate_reply (struct KycPoller *kyp,
};
json_t *kri;
- res = GNUNET_JSON_parse (mi,
+ ret = GNUNET_JSON_parse (mi,
ispec,
&ename,
&eline);
- if (GNUNET_OK != res)
+ if (GNUNET_OK != ret)
{
GNUNET_break (0);
json_decref (kris);
diff --git a/src/exchange/taler-exchange-httpd_kyc-proof.c b/src/exchange/taler-exchange-httpd_kyc-proof.c
index 657c28c6a..1ba978a3a 100644
--- a/src/exchange/taler-exchange-httpd_kyc-proof.c
+++ b/src/exchange/taler-exchange-httpd_kyc-proof.c
@@ -198,7 +198,7 @@ proof_finish (
* @param message extended message to return
* @return MHD response object
*/
-struct MHD_Response *
+static struct MHD_Response *
make_html_error (struct MHD_Connection *connection,
const char *template,
unsigned int *http_status,
diff --git a/src/exchange/taler-exchange-httpd_kyc-start.c b/src/exchange/taler-exchange-httpd_kyc-start.c
index 2477a9315..f49f07e8a 100644
--- a/src/exchange/taler-exchange-httpd_kyc-start.c
+++ b/src/exchange/taler-exchange-httpd_kyc-start.c
@@ -30,7 +30,7 @@
#include "taler_signatures.h"
#include "taler_dbevents.h"
#include "taler-exchange-httpd_keys.h"
-#include "taler-exchange-httpd_kyc-wallet.h"
+#include "taler-exchange-httpd_kyc-start.h"
#include "taler-exchange-httpd_responses.h"
diff --git a/src/exchange/taler-exchange-httpd_kyc-start.h b/src/exchange/taler-exchange-httpd_kyc-start.h
index 99d5a7891..f6e8013f9 100644
--- a/src/exchange/taler-exchange-httpd_kyc-start.h
+++ b/src/exchange/taler-exchange-httpd_kyc-start.h
@@ -26,18 +26,25 @@
/**
+ * Resume suspended requests for /kyc-start.
+ */
+void
+TEH_kyc_start_cleanup (void);
+
+
+/**
* Handle a "/kyc-start" request.
*
* @param rc request to handle
* @param root uploaded JSON data (empty by current API)
- * @param args empty array
+ * @param args array with the ID
* @return MHD result code
*/
MHD_RESULT
TEH_handler_kyc_start (
struct TEH_RequestContext *rc,
const json_t *root,
- const char *const args[]);
+ const char *const args[1]);
#endif
diff --git a/src/exchange/taler-exchange-httpd_kyc-upload.c b/src/exchange/taler-exchange-httpd_kyc-upload.c
index 4724da95e..2841b94d0 100644
--- a/src/exchange/taler-exchange-httpd_kyc-upload.c
+++ b/src/exchange/taler-exchange-httpd_kyc-upload.c
@@ -579,9 +579,8 @@ TEH_handler_kyc_upload (
}
empty_response
- = MHD_create_response_from_buffer (0,
- "",
- MHD_RESPMEM_PERSISTENT);
+ = MHD_create_response_from_buffer_static (0,
+ "");
uc->kat = TEH_kyc_finished (
&rc->async_scope_id,
legi_process_row,
diff --git a/src/exchange/taler-exchange-httpd_refreshes_reveal.c b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
index 5630051cf..530cce5a7 100644
--- a/src/exchange/taler-exchange-httpd_refreshes_reveal.c
+++ b/src/exchange/taler-exchange-httpd_refreshes_reveal.c
@@ -445,7 +445,6 @@ resolve_refreshes_reveal_denominations (
MHD_RESULT ret;
struct TEH_KeyStateHandle *ksh;
uint64_t melt_serial_id;
- enum GNUNET_DB_QueryStatus qs;
memset (dks, 0, sizeof (dks));
memset (rrcs, 0, sizeof (rrcs));
@@ -781,77 +780,80 @@ clean_age:
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Signatures ready, starting DB interaction\n");
-
- for (unsigned int r = 0; r<MAX_TRANSACTION_COMMIT_RETRIES; r++)
{
- bool changed;
+ enum GNUNET_DB_QueryStatus qs;
- /* Persist operation result in DB */
- if (GNUNET_OK !=
- TEH_plugin->start (TEH_plugin->cls,
- "insert_refresh_reveal batch"))
+ for (unsigned int r = 0; r<MAX_TRANSACTION_COMMIT_RETRIES; r++)
{
- GNUNET_break (0);
- ret = TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_START_FAILED,
- NULL);
- goto cleanup;
- }
+ bool changed;
- qs = TEH_plugin->insert_refresh_reveal (
- TEH_plugin->cls,
- melt_serial_id,
- num_fresh_coins,
- rrcs,
- TALER_CNC_KAPPA - 1,
- rctx->transfer_privs,
- &rctx->gamma_tp);
- if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
- {
- TEH_plugin->rollback (TEH_plugin->cls);
- continue;
- }
- /* 0 == qs is ok, as we did not check for repeated requests */
- if (GNUNET_DB_STATUS_HARD_ERROR == qs)
- {
- GNUNET_break (0);
+ /* Persist operation result in DB */
+ if (GNUNET_OK !=
+ TEH_plugin->start (TEH_plugin->cls,
+ "insert_refresh_reveal batch"))
+ {
+ GNUNET_break (0);
+ ret = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_START_FAILED,
+ NULL);
+ goto cleanup;
+ }
+
+ qs = TEH_plugin->insert_refresh_reveal (
+ TEH_plugin->cls,
+ melt_serial_id,
+ num_fresh_coins,
+ rrcs,
+ TALER_CNC_KAPPA - 1,
+ rctx->transfer_privs,
+ &rctx->gamma_tp);
+ if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
+ {
+ TEH_plugin->rollback (TEH_plugin->cls);
+ continue;
+ }
+ /* 0 == qs is ok, as we did not check for repeated requests */
+ if (GNUNET_DB_STATUS_HARD_ERROR == qs)
+ {
+ GNUNET_break (0);
+ TEH_plugin->rollback (TEH_plugin->cls);
+ ret = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_STORE_FAILED,
+ "insert_refresh_reveal");
+ goto cleanup;
+ }
+ changed = (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
+ qs = TEH_plugin->commit (TEH_plugin->cls);
+ if (qs >= 0)
+ {
+ if (changed)
+ TEH_METRICS_num_success[TEH_MT_SUCCESS_REFRESH_REVEAL]++;
+ break; /* success */
+ }
+ if (GNUNET_DB_STATUS_HARD_ERROR == qs)
+ {
+ GNUNET_break (0);
+ TEH_plugin->rollback (TEH_plugin->cls);
+ ret = TALER_MHD_reply_with_error (connection,
+ MHD_HTTP_INTERNAL_SERVER_ERROR,
+ TALER_EC_GENERIC_DB_COMMIT_FAILED,
+ NULL);
+ goto cleanup;
+ }
TEH_plugin->rollback (TEH_plugin->cls);
- ret = TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_STORE_FAILED,
- "insert_refresh_reveal");
- goto cleanup;
- }
- changed = (GNUNET_DB_STATUS_SUCCESS_ONE_RESULT == qs);
- qs = TEH_plugin->commit (TEH_plugin->cls);
- if (qs >= 0)
- {
- if (changed)
- TEH_METRICS_num_success[TEH_MT_SUCCESS_REFRESH_REVEAL]++;
- break; /* success */
}
- if (GNUNET_DB_STATUS_HARD_ERROR == qs)
+ if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
{
GNUNET_break (0);
TEH_plugin->rollback (TEH_plugin->cls);
ret = TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_COMMIT_FAILED,
+ TALER_EC_GENERIC_DB_SOFT_FAILURE,
NULL);
goto cleanup;
}
- TEH_plugin->rollback (TEH_plugin->cls);
- }
- if (GNUNET_DB_STATUS_SOFT_ERROR == qs)
- {
- GNUNET_break (0);
- TEH_plugin->rollback (TEH_plugin->cls);
- ret = TALER_MHD_reply_with_error (connection,
- MHD_HTTP_INTERNAL_SERVER_ERROR,
- TALER_EC_GENERIC_DB_SOFT_FAILURE,
- NULL);
- goto cleanup;
}
/* Generate final (positive) response */
ret = reply_refreshes_reveal_success (connection,
diff --git a/src/exchange/taler-exchange-httpd_reserves_history.c b/src/exchange/taler-exchange-httpd_reserves_history.c
index 61e6043a2..24f836cdd 100644
--- a/src/exchange/taler-exchange-httpd_reserves_history.c
+++ b/src/exchange/taler-exchange-httpd_reserves_history.c
@@ -466,9 +466,8 @@ TEH_handler_reserves_history (
if (NULL == rh)
{
/* 204: empty history */
- resp = MHD_create_response_from_buffer (0,
- "",
- MHD_RESPMEM_PERSISTENT);
+ resp = MHD_create_response_from_buffer_static (0,
+ "");
http_status = MHD_HTTP_NO_CONTENT;
}
else
diff --git a/src/exchange/taler-exchange-httpd_spa.c b/src/exchange/taler-exchange-httpd_spa.c
index 6dd9a7a87..4794b2d35 100644
--- a/src/exchange/taler-exchange-httpd_spa.c
+++ b/src/exchange/taler-exchange-httpd_spa.c
@@ -24,6 +24,7 @@
#include "taler_mhd_lib.h"
#include <gnunet/gnunet_mhd_compat.h>
#include "taler-exchange-httpd.h"
+#include "taler-exchange-httpd_spa.h"
/**
@@ -106,7 +107,7 @@ TEH_spa_init ()
* Nicely shut down.
*/
void __attribute__ ((destructor))
-get_spa_fini ()
+get_spa_fini (void)
{
if (NULL != kyc_spa)
{
diff --git a/src/exchange/taler-exchange-httpd_terms.c b/src/exchange/taler-exchange-httpd_terms.c
index 10114f157..04966dda8 100644
--- a/src/exchange/taler-exchange-httpd_terms.c
+++ b/src/exchange/taler-exchange-httpd_terms.c
@@ -25,6 +25,7 @@
#include <microhttpd.h>
#include "taler_mhd_lib.h"
#include "taler-exchange-httpd_responses.h"
+#include "taler-exchange-httpd_terms.h"
/**
* Our terms of service.
diff --git a/src/exchangedb/Makefile.am b/src/exchangedb/Makefile.am
index d51768f46..e25e09c78 100644
--- a/src/exchangedb/Makefile.am
+++ b/src/exchangedb/Makefile.am
@@ -101,7 +101,8 @@ libtaler_plugin_exchangedb_postgres_la_SOURCES = \
plugin_exchangedb_common.c plugin_exchangedb_common.h \
pg_setup_wire_target.h pg_setup_wire_target.c \
pg_compute_shard.h pg_compute_shard.c \
- plugin_exchangedb_postgres.c pg_helper.h \
+ plugin_exchangedb_postgres.c plugin_exchangedb_postgres.h \
+ pg_helper.h \
pg_reserves_update.h pg_reserves_update.c \
pg_select_aggregation_amounts_for_kyc_check.h pg_select_aggregation_amounts_for_kyc_check.c \
pg_lookup_wire_fee_by_time.h pg_lookup_wire_fee_by_time.c \
diff --git a/src/exchangedb/exchangedb_plugin.c b/src/exchangedb/exchangedb_plugin.c
index 5dc41d988..68a916b4e 100644
--- a/src/exchangedb/exchangedb_plugin.c
+++ b/src/exchangedb/exchangedb_plugin.c
@@ -20,7 +20,7 @@
* @author Sree Harsha Totakura <sreeharsha@totakura.in>
*/
#include "platform.h"
-#include "taler_exchangedb_plugin.h"
+#include "taler_exchangedb_lib.h"
#include <ltdl.h>
diff --git a/src/exchangedb/pg_batch_ensure_coin_known.c b/src/exchangedb/pg_batch_ensure_coin_known.c
index aca2732c6..fdf3852b2 100644
--- a/src/exchangedb/pg_batch_ensure_coin_known.c
+++ b/src/exchangedb/pg_batch_ensure_coin_known.c
@@ -38,16 +38,6 @@ insert1 (struct PostgresClosure *pg,
enum GNUNET_DB_QueryStatus qs;
bool is_denom_pub_hash_null = false;
bool is_age_hash_null = false;
- PREPARE (pg,
- "batch1_known_coin",
- "SELECT"
- " existed1 AS existed"
- ",known_coin_id1 AS known_coin_id"
- ",denom_pub_hash1 AS denom_hash"
- ",age_commitment_hash1 AS h_age_commitment"
- " FROM exchange_do_batch1_known_coin"
- " ($1, $2, $3, $4);"
- );
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&coin[0].coin_pub),
GNUNET_PQ_query_param_auto_from_type (&coin[0].denom_pub_hash),
@@ -71,6 +61,16 @@ insert1 (struct PostgresClosure *pg,
GNUNET_PQ_result_spec_end
};
+ PREPARE (pg,
+ "batch1_known_coin",
+ "SELECT"
+ " existed1 AS existed"
+ ",known_coin_id1 AS known_coin_id"
+ ",denom_pub_hash1 AS denom_hash"
+ ",age_commitment_hash1 AS h_age_commitment"
+ " FROM exchange_do_batch1_known_coin"
+ " ($1, $2, $3, $4);"
+ );
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"batch1_known_coin",
params,
@@ -140,21 +140,6 @@ insert2 (struct PostgresClosure *pg,
enum GNUNET_DB_QueryStatus qs;
bool is_denom_pub_hash_null[2] = {false, false};
bool is_age_hash_null[2] = {false, false};
-
- PREPARE (pg,
- "batch2_known_coin",
- "SELECT"
- " existed1 AS existed"
- ",known_coin_id1 AS known_coin_id"
- ",denom_pub_hash1 AS denom_hash"
- ",age_commitment_hash1 AS h_age_commitment"
- ",existed2 AS existed2"
- ",known_coin_id2 AS known_coin_id2"
- ",denom_pub_hash2 AS denom_hash2"
- ",age_commitment_hash2 AS h_age_commitment2"
- " FROM exchange_do_batch2_known_coin"
- " ($1, $2, $3, $4, $5, $6, $7, $8);"
- );
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&coin[0].coin_pub),
GNUNET_PQ_query_param_auto_from_type (&coin[0].denom_pub_hash),
@@ -195,6 +180,20 @@ insert2 (struct PostgresClosure *pg,
GNUNET_PQ_result_spec_end
};
+ PREPARE (pg,
+ "batch2_known_coin",
+ "SELECT"
+ " existed1 AS existed"
+ ",known_coin_id1 AS known_coin_id"
+ ",denom_pub_hash1 AS denom_hash"
+ ",age_commitment_hash1 AS h_age_commitment"
+ ",existed2 AS existed2"
+ ",known_coin_id2 AS known_coin_id2"
+ ",denom_pub_hash2 AS denom_hash2"
+ ",age_commitment_hash2 AS h_age_commitment2"
+ " FROM exchange_do_batch2_known_coin"
+ " ($1, $2, $3, $4, $5, $6, $7, $8);"
+ );
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"batch2_known_coin",
params,
@@ -259,28 +258,6 @@ insert4 (struct PostgresClosure *pg,
enum GNUNET_DB_QueryStatus qs;
bool is_denom_pub_hash_null[4] = {false, false, false, false};
bool is_age_hash_null[4] = {false, false, false, false};
- PREPARE (pg,
- "batch4_known_coin",
- "SELECT"
- " existed1 AS existed"
- ",known_coin_id1 AS known_coin_id"
- ",denom_pub_hash1 AS denom_hash"
- ",age_commitment_hash1 AS h_age_commitment"
- ",existed2 AS existed2"
- ",known_coin_id2 AS known_coin_id2"
- ",denom_pub_hash2 AS denom_hash2"
- ",age_commitment_hash2 AS h_age_commitment2"
- ",existed3 AS existed3"
- ",known_coin_id3 AS known_coin_id3"
- ",denom_pub_hash3 AS denom_hash3"
- ",age_commitment_hash3 AS h_age_commitment3"
- ",existed4 AS existed4"
- ",known_coin_id4 AS known_coin_id4"
- ",denom_pub_hash4 AS denom_hash4"
- ",age_commitment_hash4 AS h_age_commitment4"
- " FROM exchange_do_batch2_known_coin"
- " ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16);"
- );
struct GNUNET_PQ_QueryParam params[] = {
GNUNET_PQ_query_param_auto_from_type (&coin[0].coin_pub),
GNUNET_PQ_query_param_auto_from_type (&coin[0].denom_pub_hash),
@@ -355,6 +332,28 @@ insert4 (struct PostgresClosure *pg,
GNUNET_PQ_result_spec_end
};
+ PREPARE (pg,
+ "batch4_known_coin",
+ "SELECT"
+ " existed1 AS existed"
+ ",known_coin_id1 AS known_coin_id"
+ ",denom_pub_hash1 AS denom_hash"
+ ",age_commitment_hash1 AS h_age_commitment"
+ ",existed2 AS existed2"
+ ",known_coin_id2 AS known_coin_id2"
+ ",denom_pub_hash2 AS denom_hash2"
+ ",age_commitment_hash2 AS h_age_commitment2"
+ ",existed3 AS existed3"
+ ",known_coin_id3 AS known_coin_id3"
+ ",denom_pub_hash3 AS denom_hash3"
+ ",age_commitment_hash3 AS h_age_commitment3"
+ ",existed4 AS existed4"
+ ",known_coin_id4 AS known_coin_id4"
+ ",denom_pub_hash4 AS denom_hash4"
+ ",age_commitment_hash4 AS h_age_commitment4"
+ " FROM exchange_do_batch2_known_coin"
+ " ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16);"
+ );
qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
"batch4_known_coin",
params,
diff --git a/src/exchangedb/pg_begin_revolving_shard.c b/src/exchangedb/pg_begin_revolving_shard.c
index 86cdf80fd..8d0b31a2d 100644
--- a/src/exchangedb/pg_begin_revolving_shard.c
+++ b/src/exchangedb/pg_begin_revolving_shard.c
@@ -164,7 +164,7 @@ TEH_PG_begin_revolving_shard (void *cls,
end_row),
GNUNET_PQ_result_spec_end
};
- /* Used in #postgres_begin_revolving_shard() */
+
PREPARE (pg,
"get_open_revolving_shard",
"SELECT"
@@ -194,9 +194,9 @@ TEH_PG_begin_revolving_shard (void *cls,
return qs;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
{
- enum GNUNET_DB_QueryStatus qs;
+ enum GNUNET_DB_QueryStatus qsz;
struct GNUNET_TIME_Timestamp now;
- struct GNUNET_PQ_QueryParam params[] = {
+ struct GNUNET_PQ_QueryParam iparams[] = {
GNUNET_PQ_query_param_string (job_name),
GNUNET_PQ_query_param_timestamp (&now),
GNUNET_PQ_query_param_uint32 (start_row),
@@ -205,8 +205,6 @@ TEH_PG_begin_revolving_shard (void *cls,
};
now = GNUNET_TIME_timestamp_get ();
-
- /* Used in #postgres_begin_revolving_shard() */
PREPARE (pg,
"reclaim_revolving_shard",
"UPDATE revolving_work_shards"
@@ -215,10 +213,10 @@ TEH_PG_begin_revolving_shard (void *cls,
" WHERE job_name=$1"
" AND start_row=$3"
" AND end_row=$4");
- qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "reclaim_revolving_shard",
- params);
- switch (qs)
+ qsz = GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "reclaim_revolving_shard",
+ iparams);
+ switch (qsz)
{
case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0);
diff --git a/src/exchangedb/pg_begin_shard.c b/src/exchangedb/pg_begin_shard.c
index 48e077990..214198534 100644
--- a/src/exchangedb/pg_begin_shard.c
+++ b/src/exchangedb/pg_begin_shard.c
@@ -94,9 +94,9 @@ TEH_PG_begin_shard (void *cls,
continue;
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
{
- enum GNUNET_DB_QueryStatus qs;
+ enum GNUNET_DB_QueryStatus qsz;
struct GNUNET_TIME_Absolute now;
- struct GNUNET_PQ_QueryParam params[] = {
+ struct GNUNET_PQ_QueryParam iparams[] = {
GNUNET_PQ_query_param_string (job_name),
GNUNET_PQ_query_param_absolute_time (&now),
GNUNET_PQ_query_param_uint64 (start_row),
@@ -112,15 +112,15 @@ TEH_PG_begin_shard (void *cls,
" WHERE job_name=$1"
" AND start_row=$3"
" AND end_row=$4");
- qs = GNUNET_PQ_eval_prepared_non_select (pg->conn,
- "reclaim_shard",
- params);
- switch (qs)
+ qsz = GNUNET_PQ_eval_prepared_non_select (pg->conn,
+ "reclaim_shard",
+ iparams);
+ switch (qsz)
{
case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0);
TEH_PG_rollback (pg);
- return qs;
+ return qsz;
case GNUNET_DB_STATUS_SOFT_ERROR:
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Serialization error on claiming open shard\n");
diff --git a/src/exchangedb/pg_inject_auditor_triggers.c b/src/exchangedb/pg_inject_auditor_triggers.c
index 562a1a22c..3b27908c9 100644
--- a/src/exchangedb/pg_inject_auditor_triggers.c
+++ b/src/exchangedb/pg_inject_auditor_triggers.c
@@ -24,6 +24,7 @@
#include "taler_pq_lib.h"
#include "pg_gc.h"
#include "pg_helper.h"
+#include "pg_inject_auditor_triggers.h"
/**
diff --git a/src/exchangedb/pg_iterate_reserve_close_info.c b/src/exchangedb/pg_iterate_reserve_close_info.c
index ff0a813c3..6b4e72d69 100644
--- a/src/exchangedb/pg_iterate_reserve_close_info.c
+++ b/src/exchangedb/pg_iterate_reserve_close_info.c
@@ -22,7 +22,7 @@
#include "taler_error_codes.h"
#include "taler_dbevents.h"
#include "taler_pq_lib.h"
-#include "pg_insert_reserve_open_deposit.h"
+#include "pg_iterate_reserve_close_info.h"
#include "pg_helper.h"
/**
diff --git a/src/exchangedb/pg_lookup_completed_legitimization.c b/src/exchangedb/pg_lookup_completed_legitimization.c
index 35647c847..3a500dc32 100644
--- a/src/exchangedb/pg_lookup_completed_legitimization.c
+++ b/src/exchangedb/pg_lookup_completed_legitimization.c
@@ -14,7 +14,7 @@
TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
*/
/**
- * @file exchangedb/pg_lookup_pending_legitimization.c
+ * @file exchangedb/pg_lookup_completed_legitimization.c
* @brief Implementation of the lookup_pending_legitimization function for Postgres
* @author Christian Grothoff
*/
@@ -22,7 +22,7 @@
#include "taler_error_codes.h"
#include "taler_dbevents.h"
#include "taler_pq_lib.h"
-#include "pg_lookup_pending_legitimization.h"
+#include "pg_lookup_completed_legitimization.h"
#include "pg_helper.h"
diff --git a/src/exchangedb/pg_preflight.c b/src/exchangedb/pg_preflight.c
index 4533c9a97..c30a9651e 100644
--- a/src/exchangedb/pg_preflight.c
+++ b/src/exchangedb/pg_preflight.c
@@ -24,16 +24,7 @@
#include "taler_pq_lib.h"
#include "pg_preflight.h"
#include "pg_helper.h"
-
-
-/**
- * Connect to the database if the connection does not exist yet.
- *
- * @param pg the plugin-specific state
- * @return #GNUNET_OK on success
- */
-enum GNUNET_GenericReturnValue
-TEH_PG_internal_setup (struct PostgresClosure *pg);
+#include "plugin_exchangedb_postgres.h"
enum GNUNET_GenericReturnValue
diff --git a/src/exchangedb/pg_reserves_in_insert.c b/src/exchangedb/pg_reserves_in_insert.c
index 21734942a..95e488771 100644
--- a/src/exchangedb/pg_reserves_in_insert.c
+++ b/src/exchangedb/pg_reserves_in_insert.c
@@ -327,18 +327,18 @@ TEH_PG_reserves_in_insert (
&duplicate),
GNUNET_PQ_result_spec_end
};
- enum GNUNET_DB_QueryStatus qs;
+ enum GNUNET_DB_QueryStatus qsi;
- qs = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
- "reserves_update",
- params,
- rs);
- if (qs < 0)
+ qsi = GNUNET_PQ_eval_prepared_singleton_select (pg->conn,
+ "reserves_update",
+ params,
+ rs);
+ if (qsi < 0)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Failed to update reserves (%d)\n",
- qs);
- results[i] = qs;
+ qsi);
+ results[i] = qsi;
goto finished;
}
results[i] = duplicate
diff --git a/src/exchangedb/pg_select_reserve_closed_above_serial_id.c b/src/exchangedb/pg_select_reserve_closed_above_serial_id.c
index d24d6a600..9f239fe40 100644
--- a/src/exchangedb/pg_select_reserve_closed_above_serial_id.c
+++ b/src/exchangedb/pg_select_reserve_closed_above_serial_id.c
@@ -22,7 +22,7 @@
#include "taler_error_codes.h"
#include "taler_dbevents.h"
#include "taler_pq_lib.h"
-#include "pg_get_reserve_history.h"
+#include "pg_select_reserve_closed_above_serial_id.h"
#include "plugin_exchangedb_common.h"
#include "pg_helper.h"
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index 8de6f4626..c13a7d193 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -225,13 +225,10 @@
#include "pg_test_aml_officer.h"
#include "pg_lookup_aml_officer.h"
#include "pg_trigger_aml_process.h"
-// #include "pg_select_justification_for_missing_wire.h"
#include "pg_lookup_kyc_requirement_by_row.h"
-// #include "pg_select_aml_history.h"
-// #include "pg_select_aml_process.h"
-// #include "pg_select_aml_threshold.h"
#include "pg_insert_aml_decision.h"
#include "pg_batch_ensure_coin_known.h"
+#include "plugin_exchangedb_postgres.h"
/**
* Set to 1 to enable Postgres auto_explain module. This will
diff --git a/src/extensions/extensions.c b/src/extensions/extensions.c
index 999e9317a..f3222178b 100644
--- a/src/extensions/extensions.c
+++ b/src/extensions/extensions.c
@@ -362,11 +362,10 @@ TALER_extensions_load_manifests (
}
-/*
+/**
* Policy related
*/
-
-static char *fulfillment2str[] = {
+static const char *fulfillment2str[] = {
[TALER_PolicyFulfillmentInitial] = "<init>",
[TALER_PolicyFulfillmentReady] = "Ready",
[TALER_PolicyFulfillmentSuccess] = "Success",
diff --git a/src/include/taler_crypto_lib.h b/src/include/taler_crypto_lib.h
index ac5d21aeb..29796cadc 100644
--- a/src/include/taler_crypto_lib.h
+++ b/src/include/taler_crypto_lib.h
@@ -2539,7 +2539,7 @@ TALER_token_use_blinding_secret_create (
* @return singleton to use for RSA blinding
*/
const struct TALER_TokenUseMerchantValues *
-TALER_token_blind_input_rsa_singleton ();
+TALER_token_blind_input_rsa_singleton (void);
/**
diff --git a/src/include/taler_pq_lib.h b/src/include/taler_pq_lib.h
index f45de61d9..860be0e4d 100644
--- a/src/include/taler_pq_lib.h
+++ b/src/include/taler_pq_lib.h
@@ -169,10 +169,11 @@ TALER_PQ_query_param_array_blinded_coin_hash (
/**
- * Generate query parameter for an array of GNUNET_HashCode
+ * Generate query parameter for an array of
+ * `struct GNUNET_HashCode`.
*
* @param num number of elements in @e hash_codes
- * @param hashes array of GNUNET_HashCode
+ * @param hashes array of hashes
* @param db context for the db-connection
*/
struct GNUNET_PQ_QueryParam
@@ -183,6 +184,21 @@ TALER_PQ_query_param_array_hash_code (
/**
+ * Generate query parameter for an array of
+ * `struct TALER_DenominationHashP`
+ *
+ * @param num number of elements in @e hash_codes
+ * @param hashes array of GNUNET_HashCode
+ * @param db context for the db-connection
+ */
+struct GNUNET_PQ_QueryParam
+TALER_PQ_query_param_array_denom_hash (
+ size_t num,
+ const struct TALER_DenominationHashP *denom_hs,
+ struct GNUNET_PQ_Context *db);
+
+
+/**
* Generate query parameter for an array of amounts
*
* @param num of elements in @e amounts
diff --git a/src/json/json.c b/src/json/json.c
index 639bd530c..551605cb9 100644
--- a/src/json/json.c
+++ b/src/json/json.c
@@ -701,6 +701,8 @@ parse_path (json_t *obj,
{
char *end_bracket = strchr (bracket,
']');
+ json_t *array;
+
if (NULL == end_bracket)
{
GNUNET_free (id);
@@ -708,12 +710,10 @@ parse_path (json_t *obj,
return GNUNET_SYSERR;
}
*end_bracket = '\0';
-
*bracket = '\0';
bracket++;
-
- json_t *array = json_object_get (obj,
- next_id);
+ array = json_object_get (obj,
+ next_id);
if (0 == strcmp (bracket,
"*"))
{
@@ -808,7 +808,7 @@ TALER_JSON_get_error_code (const json_t *json)
return TALER_EC_INVALID;
}
if (json_is_integer (jc))
- return (enum TALER_ErrorCode) json_integer_value (jc);
+ return (enum TALER_ErrorCode) (int) json_integer_value (jc);
GNUNET_break_op (0);
return TALER_EC_INVALID;
}
diff --git a/src/kyclogic/kyclogic_api.c b/src/kyclogic/kyclogic_api.c
index 3fb62d5fa..9e37f16f9 100644
--- a/src/kyclogic/kyclogic_api.c
+++ b/src/kyclogic/kyclogic_api.c
@@ -862,7 +862,7 @@ TALER_KYCLOGIC_rules_to_limits (const json_t *jrules)
* @param measure_name name of measure to find
* @return NULL if not found, otherwise the measure
*/
-const struct TALER_KYCLOGIC_Measure *
+static const struct TALER_KYCLOGIC_Measure *
find_measure (
const struct TALER_KYCLOGIC_LegitimizationRuleSet *lrs,
const char *measure_name)
@@ -1511,7 +1511,6 @@ add_check (const struct GNUNET_CONFIGURATION_Handle *cfg,
{
bool voluntary;
enum TALER_KYCLOGIC_CheckType ct;
- char *form_name = NULL;
char *description = NULL;
json_t *description_i18n = NULL;
char *requires = NULL;
@@ -1728,7 +1727,6 @@ add_check (const struct GNUNET_CONFIGURATION_Handle *cfg,
return GNUNET_OK;
fail:
- GNUNET_free (form_name);
GNUNET_free (description);
json_decref (description_i18n);
GNUNET_free (requires);
diff --git a/src/kyclogic/plugin_kyclogic_oauth2.c b/src/kyclogic/plugin_kyclogic_oauth2.c
index 50d26d1f2..3c72dfcd2 100644
--- a/src/kyclogic/plugin_kyclogic_oauth2.c
+++ b/src/kyclogic/plugin_kyclogic_oauth2.c
@@ -1057,9 +1057,8 @@ converted_proof_cb (void *cls,
ph->provider_user_id = GNUNET_strdup (id);
}
ph->status = TALER_KYCLOGIC_STATUS_SUCCESS;
- ph->response = MHD_create_response_from_buffer (0,
- "",
- MHD_RESPMEM_PERSISTENT);
+ ph->response = MHD_create_response_from_buffer_static (0,
+ "");
GNUNET_assert (NULL != ph->response);
GNUNET_break (MHD_YES ==
MHD_add_response_header (
@@ -1612,9 +1611,8 @@ wh_return_not_found (void *cls)
struct MHD_Response *response;
wh->task = NULL;
- response = MHD_create_response_from_buffer (0,
- "",
- MHD_RESPMEM_PERSISTENT);
+ response = MHD_create_response_from_buffer_static (0,
+ "");
wh->cb (wh->cb_cls,
0LLU,
NULL,
diff --git a/src/kyclogic/plugin_kyclogic_persona.c b/src/kyclogic/plugin_kyclogic_persona.c
index e9bc69a46..8d45b6f80 100644
--- a/src/kyclogic/plugin_kyclogic_persona.c
+++ b/src/kyclogic/plugin_kyclogic_persona.c
@@ -1073,9 +1073,8 @@ proof_post_conversion_cb (void *cls,
return;
}
expiration = GNUNET_TIME_relative_to_absolute (ph->pd->validity);
- resp = MHD_create_response_from_buffer (0,
- "",
- MHD_RESPMEM_PERSISTENT);
+ resp = MHD_create_response_from_buffer_static (0,
+ "");
GNUNET_break (MHD_YES ==
MHD_add_response_header (resp,
MHD_HTTP_HEADER_LOCATION,
@@ -1565,9 +1564,8 @@ webhook_generic_reply (struct TALER_KYCLOGIC_WebhookHandle *wh,
expiration = GNUNET_TIME_relative_to_absolute (wh->pd->validity);
else
expiration = GNUNET_TIME_UNIT_ZERO_ABS;
- resp = MHD_create_response_from_buffer (0,
- "",
- MHD_RESPMEM_PERSISTENT);
+ resp = MHD_create_response_from_buffer_static (0,
+ "");
TALER_MHD_add_global_headers (resp);
wh->cb (wh->cb_cls,
wh->process_row,
diff --git a/src/mhd/mhd_legal.c b/src/mhd/mhd_legal.c
index 9b80bf41b..df2c3f308 100644
--- a/src/mhd/mhd_legal.c
+++ b/src/mhd/mhd_legal.c
@@ -191,8 +191,8 @@ TALER_MHD_reply_legal (struct MHD_Connection *conn,
/* Default terms of service if none are configured */
static struct Terms none = {
.mime_type = "text/plain",
- .terms = "not configured",
- .language = "en",
+ .terms = (void *) "not configured",
+ .language = (void *) "en",
.terms_size = strlen ("not configured")
};
struct MHD_Response *resp;
diff --git a/src/pq/pq_query_helper.c b/src/pq/pq_query_helper.c
index 9b0bd4c4e..2dd2582a2 100644
--- a/src/pq/pq_query_helper.c
+++ b/src/pq/pq_query_helper.c
@@ -668,14 +668,14 @@ qconv_array (
same_sized = (0 != meta->same_size);
#define RETURN_UNLESS(cond) \
- do { \
- if (! (cond)) \
- { \
- GNUNET_break ((cond)); \
- noerror = false; \
- goto DONE; \
- } \
- } while (0)
+ do { \
+ if (! (cond)) \
+ { \
+ GNUNET_break ((cond)); \
+ noerror = false; \
+ goto DONE; \
+ } \
+ } while (0)
/* Calculate sizes and check bounds */
{
diff --git a/src/pq/pq_result_helper.c b/src/pq/pq_result_helper.c
index 384200cfb..3d25d4c5b 100644
--- a/src/pq/pq_result_helper.c
+++ b/src/pq/pq_result_helper.c
@@ -1162,13 +1162,13 @@ extract_array_generic (
*((void **) dst) = NULL;
#define FAIL_IF(cond) \
- do { \
- if ((cond)) \
- { \
- GNUNET_break (! (cond)); \
- goto FAIL; \
- } \
- } while (0)
+ do { \
+ if ((cond)) \
+ { \
+ GNUNET_break (! (cond)); \
+ goto FAIL; \
+ } \
+ } while (0)
col_num = PQfnumber (result, fname);
FAIL_IF (0 > col_num);
@@ -1444,17 +1444,19 @@ TALER_PQ_result_spec_array_blinded_denom_sig (
GNUNET_PQ_get_oid_by_name (db,
"bytea",
&info->oid));
+ {
+ struct GNUNET_PQ_ResultSpec res = {
+ .conv = extract_array_generic,
+ .cleaner = array_cleanup,
+ .dst = (void *) denom_sigs,
+ .fname = name,
+ .cls = info
+ };
+
+ return res;
+ }
+}
- struct GNUNET_PQ_ResultSpec res = {
- .conv = extract_array_generic,
- .cleaner = array_cleanup,
- .dst = (void *) denom_sigs,
- .fname = name,
- .cls = info
- };
- return res;
-
-};
struct GNUNET_PQ_ResultSpec
TALER_PQ_result_spec_array_blinded_coin_hash (
@@ -1471,17 +1473,19 @@ TALER_PQ_result_spec_array_blinded_coin_hash (
GNUNET_PQ_get_oid_by_name (db,
"bytea",
&info->oid));
+ {
+ struct GNUNET_PQ_ResultSpec res = {
+ .conv = extract_array_generic,
+ .cleaner = array_cleanup,
+ .dst = (void *) h_coin_evs,
+ .fname = name,
+ .cls = info
+ };
+
+ return res;
+ }
+}
- struct GNUNET_PQ_ResultSpec res = {
- .conv = extract_array_generic,
- .cleaner = array_cleanup,
- .dst = (void *) h_coin_evs,
- .fname = name,
- .cls = info
- };
- return res;
-
-};
struct GNUNET_PQ_ResultSpec
TALER_PQ_result_spec_array_denom_hash (
@@ -1498,17 +1502,19 @@ TALER_PQ_result_spec_array_denom_hash (
GNUNET_PQ_get_oid_by_name (db,
"bytea",
&info->oid));
+ {
+ struct GNUNET_PQ_ResultSpec res = {
+ .conv = extract_array_generic,
+ .cleaner = array_cleanup,
+ .dst = (void *) denom_hs,
+ .fname = name,
+ .cls = info
+ };
+
+ return res;
+ }
+}
- struct GNUNET_PQ_ResultSpec res = {
- .conv = extract_array_generic,
- .cleaner = array_cleanup,
- .dst = (void *) denom_hs,
- .fname = name,
- .cls = info
- };
- return res;
-
-};
struct GNUNET_PQ_ResultSpec
TALER_PQ_result_spec_array_amount (
@@ -1535,15 +1541,17 @@ TALER_PQ_result_spec_array_amount (
currency,
clen);
}
-
- struct GNUNET_PQ_ResultSpec res = {
- .conv = extract_array_generic,
- .cleaner = array_cleanup,
- .dst = (void *) amounts,
- .fname = name,
- .cls = info,
- };
- return res;
+ {
+ struct GNUNET_PQ_ResultSpec res = {
+ .conv = extract_array_generic,
+ .cleaner = array_cleanup,
+ .dst = (void *) amounts,
+ .fname = name,
+ .cls = info,
+ };
+
+ return res;
+ }
}
@@ -1563,15 +1571,18 @@ TALER_PQ_result_spec_array_hash_code (
GNUNET_PQ_get_oid_by_name (db,
"gnunet_hashcode",
&info->oid));
-
- struct GNUNET_PQ_ResultSpec res = {
- .conv = extract_array_generic,
- .cleaner = array_cleanup,
- .dst = (void *) hashes,
- .fname = name,
- .cls = info,
- };
- return res;
+ {
+ struct GNUNET_PQ_ResultSpec res = {
+ .conv = extract_array_generic,
+ .cleaner = array_cleanup,
+ .dst = (void *) hashes,
+ .fname = name,
+ .cls = info,
+ };
+
+ return res;
+ }
}
+
/* end of pq_result_helper.c */
diff --git a/src/sq/sq_result_helper.c b/src/sq/sq_result_helper.c
index 9d80837bd..b950ce926 100644
--- a/src/sq/sq_result_helper.c
+++ b/src/sq/sq_result_helper.c
@@ -47,6 +47,8 @@ extract_amount (void *cls,
{
struct TALER_Amount *amount = dst;
const char *currency = cls;
+ uint64_t frac;
+
if ((sizeof (struct TALER_Amount) != *dst_size) ||
(SQLITE_INTEGER != sqlite3_column_type (result,
(int) column)) ||
@@ -61,8 +63,8 @@ extract_amount (void *cls,
TALER_CURRENCY_LEN);
amount->value = (uint64_t) sqlite3_column_int64 (result,
(int) column);
- uint64_t frac = (uint64_t) sqlite3_column_int64 (result,
- (int) column + 1);
+ frac = (uint64_t) sqlite3_column_int64 (result,
+ (int) column + 1);
amount->fraction = (uint32_t) frac;
return GNUNET_YES;
}
diff --git a/src/templating/mustach-tool.c b/src/templating/mustach-tool.c
index 5f28c1f58..66ddc1f36 100644
--- a/src/templating/mustach-tool.c
+++ b/src/templating/mustach-tool.c
@@ -129,11 +129,12 @@ static char *readfile(const char *filename, size_t *length)
static int load_json(const char *filename);
static int process(const char *content, size_t length);
-static void close_json();
+static void close_json(void);
int main(int ac, char **av)
{
- char *t, *f;
+ char *t;
+ const char *f;
char *prog = *av;
int s;
size_t length;
diff --git a/src/util/crypto_confirmation.c b/src/util/crypto_confirmation.c
index 99552f150..ee043404f 100644
--- a/src/util/crypto_confirmation.c
+++ b/src/util/crypto_confirmation.c
@@ -29,7 +29,7 @@
* How long is a TOTP code valid?
*/
#define TOTP_VALIDITY_PERIOD GNUNET_TIME_relative_multiply ( \
- GNUNET_TIME_UNIT_SECONDS, 30)
+ GNUNET_TIME_UNIT_SECONDS, 30)
/**
* Range of time we allow (plus-minus).
@@ -132,6 +132,7 @@ TALER_rfc3548_base32decode (const char *val,
{
if ((rpos < val_size) && (vbit < 8))
{
+ const char *p;
char c = val[rpos++];
if (c == '=')
@@ -144,7 +145,7 @@ TALER_rfc3548_base32decode (const char *val,
break; /* Ok, 2x '=' padding is allowed */
return -1; /* invalid padding */
}
- const char *p = strchr (decTable__, toupper (c));
+ p = strchr (decTable__, toupper (c));
if (! p)
{
/* invalid character */
diff --git a/src/util/crypto_contract.c b/src/util/crypto_contract.c
index bec34c983..8656af766 100644
--- a/src/util/crypto_contract.c
+++ b/src/util/crypto_contract.c
@@ -459,12 +459,6 @@ TALER_CRYPTO_contract_decrypt_for_deposit (
size_t econtract_size)
{
const struct TALER_PurseContractPublicKeyP *purse_pub = econtract;
-
- if (econtract_size < sizeof (*purse_pub))
- {
- GNUNET_break_op (0);
- return NULL;
- }
struct GNUNET_HashCode key;
void *xhdr;
size_t hdr_size;
@@ -474,6 +468,11 @@ TALER_CRYPTO_contract_decrypt_for_deposit (
json_error_t json_error;
json_t *ret;
+ if (econtract_size < sizeof (*purse_pub))
+ {
+ GNUNET_break_op (0);
+ return NULL;
+ }
if (GNUNET_OK !=
GNUNET_CRYPTO_ecdh_eddsa (&contract_priv->ecdhe_priv,
&purse_pub->eddsa_pub,
diff --git a/src/util/crypto_helper_common.c b/src/util/crypto_helper_common.c
index 9eddb7dcb..d39b61933 100644
--- a/src/util/crypto_helper_common.c
+++ b/src/util/crypto_helper_common.c
@@ -21,6 +21,7 @@
#include "platform.h"
#include "taler_util.h"
#include "taler_signatures.h"
+#include "crypto_helper_common.h"
enum GNUNET_GenericReturnValue
diff --git a/src/util/crypto_helper_cs.c b/src/util/crypto_helper_cs.c
index 4c4a56feb..d423ae640 100644
--- a/src/util/crypto_helper_cs.c
+++ b/src/util/crypto_helper_cs.c
@@ -534,7 +534,7 @@ more:
const struct TALER_CRYPTO_SignFailure *sf =
(const struct TALER_CRYPTO_SignFailure *) buf;
- ec = (enum TALER_ErrorCode) ntohl (sf->ec);
+ ec = (enum TALER_ErrorCode) (int) ntohl (sf->ec);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Signing failed with status %d!\n",
ec);
@@ -757,7 +757,7 @@ more:
const struct TALER_CRYPTO_RDeriveFailure *rdf =
(const struct TALER_CRYPTO_RDeriveFailure *) buf;
- ec = (enum TALER_ErrorCode) ntohl (rdf->ec);
+ ec = (enum TALER_ErrorCode) (int) ntohl (rdf->ec);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"R derivation failed!\n");
finished = true;
@@ -995,7 +995,7 @@ more:
const struct TALER_CRYPTO_SignFailure *sf =
(const struct TALER_CRYPTO_SignFailure *) buf;
- ec = (enum TALER_ErrorCode) ntohl (sf->ec);
+ ec = (enum TALER_ErrorCode) (int) ntohl (sf->ec);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Signing %u failed with status %d!\n",
wpos,
@@ -1238,7 +1238,7 @@ more:
const struct TALER_CRYPTO_RDeriveFailure *rdf =
(const struct TALER_CRYPTO_RDeriveFailure *) buf;
- ec = (enum TALER_ErrorCode) ntohl (rdf->ec);
+ ec = (enum TALER_ErrorCode) (int) ntohl (rdf->ec);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"R derivation %u failed with status %d!\n",
wpos,
diff --git a/src/util/crypto_helper_esign.c b/src/util/crypto_helper_esign.c
index e044d31d1..4c46cec56 100644
--- a/src/util/crypto_helper_esign.c
+++ b/src/util/crypto_helper_esign.c
@@ -466,7 +466,7 @@ more:
(const struct TALER_CRYPTO_EddsaSignFailure *) buf;
finished = true;
- ec = (enum TALER_ErrorCode) ntohl (sf->ec);
+ ec = (enum TALER_ErrorCode) (int) ntohl (sf->ec);
break;
}
case TALER_HELPER_EDDSA_MT_AVAIL:
diff --git a/src/util/crypto_helper_rsa.c b/src/util/crypto_helper_rsa.c
index e23e12a88..df14c9100 100644
--- a/src/util/crypto_helper_rsa.c
+++ b/src/util/crypto_helper_rsa.c
@@ -21,9 +21,9 @@
#include "platform.h"
#include "taler_util.h"
#include "taler_signatures.h"
+#include "crypto_helper_common.h"
#include "taler-exchange-secmod-rsa.h"
#include <poll.h>
-#include "crypto_helper_common.h"
struct TALER_CRYPTO_RsaDenominationHelper
@@ -553,7 +553,7 @@ more:
const struct TALER_CRYPTO_SignFailure *sf =
(const struct TALER_CRYPTO_SignFailure *) buf;
- ec = (enum TALER_ErrorCode) ntohl (sf->ec);
+ ec = (enum TALER_ErrorCode) (int) ntohl (sf->ec);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Signing failed!\n");
finished = true;
@@ -808,7 +808,7 @@ more:
const struct TALER_CRYPTO_SignFailure *sf =
(const struct TALER_CRYPTO_SignFailure *) buf;
- ec = (enum TALER_ErrorCode) ntohl (sf->ec);
+ ec = (enum TALER_ErrorCode) (int) ntohl (sf->ec);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Signing %u failed with status %d!\n",
wpos,
diff --git a/src/util/iban.c b/src/util/iban.c
index c2274d3cb..8d1e898cb 100644
--- a/src/util/iban.c
+++ b/src/util/iban.c
@@ -223,7 +223,6 @@ TALER_iban_validate (const char *iban)
char *nbuf;
unsigned long long dividend;
unsigned long long remainder;
- unsigned int i;
unsigned int j;
if (NULL == iban)
@@ -255,7 +254,8 @@ TALER_iban_validate (const char *iban)
return msg;
}
nbuf = GNUNET_malloc ((len * 2) + 1);
- for (i = 0, j = 0; i < len; i++)
+ j = 0;
+ for (unsigned int i = 0; i < len; i++)
{
if (isalpha ((unsigned char) ibancpy[i]))
{
diff --git a/src/util/os_installation.c b/src/util/os_installation.c
index 1cbb9e78a..79beba51c 100644
--- a/src/util/os_installation.c
+++ b/src/util/os_installation.c
@@ -24,7 +24,7 @@
*/
#include "platform.h"
#include <gnunet/gnunet_util_lib.h>
-
+#include "taler_util.h"
/**
* Default project data used for installation path detection
@@ -44,6 +44,7 @@ static const struct GNUNET_OS_ProjectData taler_pd = {
.is_gnu = 1,
.gettext_domain = "taler",
.gettext_path = NULL,
+ .agpl_url = "https://git.taler.net/"
};
diff --git a/src/util/payto.c b/src/util/payto.c
index a471175a9..528108efa 100644
--- a/src/util/payto.c
+++ b/src/util/payto.c
@@ -347,8 +347,6 @@ TALER_payto_validate (const char *payto_uri)
if (NULL == strchr (ALLOWED_CHARACTERS,
(int) payto_uri[i]))
{
- char *ret;
-
GNUNET_asprintf (&ret,
"Encountered invalid character `%c' at offset %u in payto URI `%s'",
payto_uri[i],
diff --git a/src/util/secmod_common.c b/src/util/secmod_common.c
index 87ce17e06..3156b15c4 100644
--- a/src/util/secmod_common.c
+++ b/src/util/secmod_common.c
@@ -133,7 +133,7 @@ TES_transmit (int sock,
struct GNUNET_NETWORK_Handle *
-TES_open_socket (const char *unixpath)
+TES_open_socket (const char *my_unixpath)
{
int sock;
mode_t old_umask;
@@ -159,25 +159,25 @@ TES_open_socket (const char *unixpath)
struct sockaddr_un un;
if (GNUNET_OK !=
- GNUNET_DISK_directory_create_for_file (unixpath))
+ GNUNET_DISK_directory_create_for_file (my_unixpath))
{
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
"mkdir(dirname)",
- unixpath);
+ my_unixpath);
}
- if (0 != unlink (unixpath))
+ if (0 != unlink (my_unixpath))
{
if (ENOENT != errno)
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
"unlink",
- unixpath);
+ my_unixpath);
}
memset (&un,
0,
sizeof (un));
un.sun_family = AF_UNIX;
strncpy (un.sun_path,
- unixpath,
+ my_unixpath,
sizeof (un.sun_path) - 1);
if (0 != bind (sock,
(const struct sockaddr *) &un,
@@ -185,7 +185,7 @@ TES_open_socket (const char *unixpath)
{
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
"bind",
- unixpath);
+ my_unixpath);
GNUNET_break (0 == close (sock));
goto cleanup;
}
@@ -196,7 +196,7 @@ TES_open_socket (const char *unixpath)
{
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR,
"listen",
- unixpath);
+ my_unixpath);
GNUNET_break (GNUNET_OK ==
GNUNET_NETWORK_socket_close (ret));
ret = NULL;
@@ -218,14 +218,17 @@ TES_wake_clients (void)
NULL != client;
client = client->next)
{
- GNUNET_assert (sizeof (num) ==
#ifdef __linux__
+ GNUNET_assert (sizeof (num) ==
write (client->esock,
+ &num,
+ sizeof (num)));
#else
+ GNUNET_assert (sizeof (num) ==
write (client->esock_in,
-#endif
&num,
sizeof (num)));
+#endif
}
GNUNET_assert (0 == pthread_mutex_unlock (&TES_clients_lock));
}
@@ -249,7 +252,7 @@ TES_read_work (void *cls,
recv_size = recv (client->csock,
&buf[off],
sizeof (client->iobuf) - off,
- 0);
+ 0);
if (-1 == recv_size)
{
if ( (0 == off) &&
@@ -334,23 +337,27 @@ TES_await_ready (struct TES_Client *client)
"poll");
for (int i = 0; i<2; i++)
{
+ if (
#ifdef __linux__
- if ( (pfds[i].fd == client->esock) &&
+ (pfds[i].fd == client->esock) &&
#else
- if ( (pfds[i].fd == client->esock_out) &&
+ (pfds[i].fd == client->esock_out) &&
#endif
- (POLLIN == pfds[i].revents) )
+ (POLLIN == pfds[i].revents) )
{
uint64_t num;
- GNUNET_assert (sizeof (num) ==
#ifdef __linux__
+ GNUNET_assert (sizeof (num) ==
read (client->esock,
+ &num,
+ sizeof (num)));
#else
+ GNUNET_assert (sizeof (num) ==
read (client->esock_out,
-#endif
&num,
sizeof (num)));
+#endif
return true;
}
}
diff --git a/src/util/taler-exchange-secmod-cs.c b/src/util/taler-exchange-secmod-cs.c
index 3e9ba1558..f69acd890 100644
--- a/src/util/taler-exchange-secmod-cs.c
+++ b/src/util/taler-exchange-secmod-cs.c
@@ -327,13 +327,13 @@ static int global_ret;
* Time when the key update is executed.
* Either the actual current time, or a pretended time.
*/
-static struct GNUNET_TIME_Timestamp now;
+static struct GNUNET_TIME_Timestamp global_now;
/**
* The time for the key update, as passed by the user
* on the command line.
*/
-static struct GNUNET_TIME_Timestamp now_tmp;
+static struct GNUNET_TIME_Timestamp global_now_tmp;
/**
* Where do we store the keys?
@@ -1107,7 +1107,8 @@ setup_key (struct DenominationKey *dk,
keydir,
denom->section,
(unsigned long long) (dk->anchor.abs_time.abs_value_us
- / GNUNET_TIME_UNIT_SECONDS.rel_value_us));
+ / GNUNET_TIME_UNIT_SECONDS.rel_value_us
+ ));
if (GNUNET_OK !=
GNUNET_DISK_fn_write (dk->filename,
&priv,
@@ -2185,15 +2186,17 @@ run (void *cls,
(void) cls;
(void) args;
(void) cfgfile;
- if (GNUNET_TIME_timestamp_cmp (now, !=, now_tmp))
+ if (GNUNET_TIME_timestamp_cmp (global_now,
+ !=,
+ global_now_tmp))
{
/* The user gave "--now", use it! */
- now = now_tmp;
+ global_now = global_now_tmp;
}
else
{
/* get current time again, we may be timetraveling! */
- now = GNUNET_TIME_timestamp_get ();
+ global_now = GNUNET_TIME_timestamp_get ();
}
GNUNET_asprintf (&secname,
"%s-secmod-cs",
@@ -2211,24 +2214,17 @@ run (void *cls,
global_ret = EXIT_NOTCONFIGURED;
return;
}
- GNUNET_free (secname);
if (GNUNET_OK !=
load_durations (cfg))
{
global_ret = EXIT_NOTCONFIGURED;
- return;
- }
- {
- char *secname;
-
- GNUNET_asprintf (&secname,
- "%s-secmod-cs",
- section);
- global_ret = TES_listen_start (cfg,
- secname,
- &cb);
GNUNET_free (secname);
+ return;
}
+ global_ret = TES_listen_start (cfg,
+ secname,
+ &cb);
+ GNUNET_free (secname);
if (0 != global_ret)
return;
sem_init (&worker_sem,
@@ -2258,7 +2254,7 @@ run (void *cls,
struct LoadContext lc = {
.cfg = cfg,
.ret = GNUNET_OK,
- .t = now
+ .t = global_now
};
GNUNET_assert (0 == pthread_mutex_lock (&keys_lock));
@@ -2312,7 +2308,7 @@ main (int argc,
"time",
"TIMESTAMP",
"pretend it is a different time for the update",
- &now_tmp),
+ &global_now_tmp),
GNUNET_GETOPT_option_uint ('w',
"workers",
"COUNT",
@@ -2329,7 +2325,9 @@ main (int argc,
not do this, the linker may "optimize" libtalerutil
away and skip #TALER_OS_init(), which we do need */
TALER_OS_init ();
- now_tmp = now = GNUNET_TIME_timestamp_get ();
+ global_now_tmp
+ = global_now
+ = GNUNET_TIME_timestamp_get ();
ret = GNUNET_PROGRAM_run (argc, argv,
"taler-exchange-secmod-cs",
"Handle private CS key operations for a Taler exchange",
diff --git a/src/util/taler-exchange-secmod-eddsa.c b/src/util/taler-exchange-secmod-eddsa.c
index 0b95447f7..401ac5835 100644
--- a/src/util/taler-exchange-secmod-eddsa.c
+++ b/src/util/taler-exchange-secmod-eddsa.c
@@ -371,7 +371,8 @@ setup_key (struct Key *key,
"%s/%llu",
keydir,
(unsigned long long) (key->anchor.abs_time.abs_value_us
- / GNUNET_TIME_UNIT_SECONDS.rel_value_us));
+ / GNUNET_TIME_UNIT_SECONDS.rel_value_us
+ ));
if (GNUNET_OK !=
GNUNET_DISK_fn_write (key->filename,
&priv,
@@ -1118,20 +1119,11 @@ run (void *cls,
global_ret = EXIT_NOTCONFIGURED;
return;
}
- GNUNET_free (secname);
GNUNET_SCHEDULER_add_shutdown (&do_shutdown,
NULL);
- {
- char *secname;
-
- GNUNET_asprintf (&secname,
- "%s-secmod-eddsa",
- section);
- global_ret = TES_listen_start (cfg,
- secname,
- &cb);
- GNUNET_free (secname);
- }
+ global_ret = TES_listen_start (cfg,
+ secname,
+ &cb);
if (0 != global_ret)
return;
/* Load keys */
diff --git a/src/util/taler-exchange-secmod-rsa.c b/src/util/taler-exchange-secmod-rsa.c
index c80e2e3c4..6be78b20e 100644
--- a/src/util/taler-exchange-secmod-rsa.c
+++ b/src/util/taler-exchange-secmod-rsa.c
@@ -294,13 +294,13 @@ static int global_ret;
* Time when the key update is executed.
* Either the actual current time, or a pretended time.
*/
-static struct GNUNET_TIME_Timestamp now;
+static struct GNUNET_TIME_Timestamp global_now;
/**
* The time for the key update, as passed by the user
* on the command line.
*/
-static struct GNUNET_TIME_Timestamp now_tmp;
+static struct GNUNET_TIME_Timestamp global_now_tmp;
/**
* Where do we store the keys?
@@ -893,7 +893,8 @@ setup_key (struct DenominationKey *dk,
keydir,
denom->section,
(unsigned long long) (dk->anchor.abs_time.abs_value_us
- / GNUNET_TIME_UNIT_SECONDS.rel_value_us));
+ / GNUNET_TIME_UNIT_SECONDS.rel_value_us
+ ));
if (GNUNET_OK !=
GNUNET_DISK_fn_write (dk->filename,
buf,
@@ -1973,15 +1974,17 @@ run (void *cls,
(void) cls;
(void) args;
(void) cfgfile;
- if (GNUNET_TIME_timestamp_cmp (now, !=, now_tmp))
+ if (GNUNET_TIME_timestamp_cmp (global_now,
+ !=,
+ global_now_tmp))
{
/* The user gave "--now", use it! */
- now = now_tmp;
+ global_now = global_now_tmp;
}
else
{
/* get current time again, we may be timetraveling! */
- now = GNUNET_TIME_timestamp_get ();
+ global_now = GNUNET_TIME_timestamp_get ();
}
GNUNET_asprintf (&secname,
"%s-secmod-rsa",
@@ -1999,24 +2002,20 @@ run (void *cls,
global_ret = EXIT_NOTCONFIGURED;
return;
}
- GNUNET_free (secname);
if (GNUNET_OK !=
load_durations (cfg))
{
global_ret = EXIT_NOTCONFIGURED;
- return;
- }
- {
- char *secname;
-
- GNUNET_asprintf (&secname,
- "%s-secmod-rsa",
- section);
- global_ret = TES_listen_start (cfg,
- secname,
- &cb);
GNUNET_free (secname);
+ return;
}
+ GNUNET_asprintf (&secname,
+ "%s-secmod-rsa",
+ section);
+ global_ret = TES_listen_start (cfg,
+ secname,
+ &cb);
+ GNUNET_free (secname);
if (0 != global_ret)
return;
sem_init (&worker_sem,
@@ -2047,7 +2046,7 @@ run (void *cls,
struct LoadContext lc = {
.cfg = cfg,
.ret = GNUNET_OK,
- .t = now
+ .t = global_now
};
GNUNET_assert (0 == pthread_mutex_lock (&keys_lock));
@@ -2101,7 +2100,7 @@ main (int argc,
"time",
"TIMESTAMP",
"pretend it is a different time for the update",
- &now_tmp),
+ &global_now_tmp),
GNUNET_GETOPT_option_uint ('w',
"workers",
"COUNT",
@@ -2118,7 +2117,9 @@ main (int argc,
not do this, the linker may "optimize" libtalerutil
away and skip #TALER_OS_init(), which we do need */
TALER_OS_init ();
- now_tmp = now = GNUNET_TIME_timestamp_get ();
+ global_now_tmp
+ = global_now
+ = GNUNET_TIME_timestamp_get ();
ret = GNUNET_PROGRAM_run (argc, argv,
"taler-exchange-secmod-rsa",
"Handle private RSA key operations for a Taler exchange",
diff --git a/src/util/tokens.c b/src/util/tokens.c
index b79dda61a..c9f68448f 100644
--- a/src/util/tokens.c
+++ b/src/util/tokens.c
@@ -235,4 +235,4 @@ TALER_token_issue_sig_unblind (
return GNUNET_SYSERR;
}
return GNUNET_OK;
-} \ No newline at end of file
+}