aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/auditor/taler-auditor.c29
-rw-r--r--src/benchmark/taler-exchange-benchmark.c5
-rw-r--r--src/exchange-lib/exchange_api_deposit.c10
-rw-r--r--src/exchange-lib/exchange_api_reserve.c9
-rw-r--r--src/exchange-lib/test_exchange_api.c30
-rw-r--r--src/exchange/taler-exchange-aggregator.c31
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c13
-rw-r--r--src/exchangedb/test_exchangedb.c9
-rw-r--r--src/json/json.c3
9 files changed, 92 insertions, 47 deletions
diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c
index f7ea947ab..1eff72694 100644
--- a/src/auditor/taler-auditor.c
+++ b/src/auditor/taler-auditor.c
@@ -606,7 +606,7 @@ struct ReserveContext
* Transaction status code, set to error codes if applicable.
*/
enum GNUNET_DB_QueryStatus qs;
-
+
};
@@ -2182,8 +2182,15 @@ check_wire_out_cb (void *cls,
wcc.date = date;
TALER_amount_get_zero (amount->currency,
&wcc.total_deposits);
- TALER_JSON_hash (wire,
- &wcc.h_wire);
+ if (GNUNET_OK !=
+ TALER_JSON_hash (wire,
+ &wcc.h_wire))
+ {
+ report_row_inconsistency ("wire_out",
+ rowid,
+ "could not hash wire address");
+ return GNUNET_OK;
+ }
qs = edb->lookup_wire_transfer (edb->cls,
esession,
wtid,
@@ -3170,7 +3177,7 @@ deposit_cb (void *cls,
/* This should not be possible, unless the AUDITOR
has a bug in tracking total balance. */
GNUNET_break (0);
- cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
+ cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
return GNUNET_SYSERR;
}
@@ -3191,7 +3198,7 @@ deposit_cb (void *cls,
&dfee))
{
GNUNET_break (0);
- cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
+ cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
return GNUNET_SYSERR;
}
}
@@ -3304,7 +3311,7 @@ refund_cb (void *cls,
&amount_without_fee))
{
GNUNET_break (0);
- cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
+ cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
@@ -3313,7 +3320,7 @@ refund_cb (void *cls,
&amount_without_fee))
{
GNUNET_break (0);
- cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
+ cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
@@ -3322,7 +3329,7 @@ refund_cb (void *cls,
&amount_without_fee))
{
GNUNET_break (0);
- cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
+ cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
@@ -3331,7 +3338,7 @@ refund_cb (void *cls,
&amount_without_fee))
{
GNUNET_break (0);
- cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
+ cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
return GNUNET_SYSERR;
}
@@ -3347,7 +3354,7 @@ refund_cb (void *cls,
&refund_fee))
{
GNUNET_break (0);
- cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
+ cc->qs = GNUNET_DB_STATUS_HARD_ERROR;
return GNUNET_SYSERR;
}
@@ -3431,7 +3438,7 @@ analyze_coins (void *cls)
}
/* process refreshs */
- if (0 >
+ if (0 >
(qs = edb->select_refreshs_above_serial_id (edb->cls,
esession,
pp.last_melt_serial_id,
diff --git a/src/benchmark/taler-exchange-benchmark.c b/src/benchmark/taler-exchange-benchmark.c
index 10a5eed1b..eae2ec9f0 100644
--- a/src/benchmark/taler-exchange-benchmark.c
+++ b/src/benchmark/taler-exchange-benchmark.c
@@ -883,8 +883,9 @@ spend_coin (struct Coin *coin,
dr.purpose.size = htonl (sizeof (struct TALER_DepositRequestPS));
dr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT);
dr.h_contract_terms = h_contract_terms;
- TALER_JSON_hash (merchant_details,
- &dr.h_wire);
+ GNUNET_assert (GNUNET_OK ==
+ TALER_JSON_hash (merchant_details,
+ &dr.h_wire));
dr.timestamp = GNUNET_TIME_absolute_hton (timestamp);
dr.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline);
diff --git a/src/exchange-lib/exchange_api_deposit.c b/src/exchange-lib/exchange_api_deposit.c
index 4937b14aa..d90b1aa75 100644
--- a/src/exchange-lib/exchange_api_deposit.c
+++ b/src/exchange-lib/exchange_api_deposit.c
@@ -415,9 +415,13 @@ TALER_EXCHANGE_deposit (struct TALER_EXCHANGE_Handle *exchange,
GNUNET_assert (GNUNET_YES ==
MAH_handle_is_ready (exchange));
/* initialize h_wire */
- GNUNET_assert (GNUNET_OK ==
- TALER_JSON_hash (wire_details,
- &h_wire));
+ if (GNUNET_OK !=
+ TALER_JSON_hash (wire_details,
+ &h_wire))
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
key_state = TALER_EXCHANGE_get_keys (exchange);
dki = TALER_EXCHANGE_get_denomination_key (key_state,
denom_pub);
diff --git a/src/exchange-lib/exchange_api_reserve.c b/src/exchange-lib/exchange_api_reserve.c
index 4b5152c50..644a9919c 100644
--- a/src/exchange-lib/exchange_api_reserve.c
+++ b/src/exchange-lib/exchange_api_reserve.c
@@ -354,8 +354,13 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange,
}
TALER_amount_hton (&rcc.closing_amount,
&amount);
- TALER_JSON_hash (rhistory[off].details.close_details.receiver_account_details,
- &rcc.h_wire);
+ if (GNUNET_OK !=
+ TALER_JSON_hash (rhistory[off].details.close_details.receiver_account_details,
+ &rcc.h_wire))
+ {
+ GNUNET_break (0);
+ return GNUNET_SYSERR;
+ }
rcc.wtid = rhistory[off].details.close_details.wtid;
rcc.purpose.size = htonl (sizeof (rcc));
rcc.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED);
diff --git a/src/exchange-lib/test_exchange_api.c b/src/exchange-lib/test_exchange_api.c
index 4c0a49e8b..70fb3ffdc 100644
--- a/src/exchange-lib/test_exchange_api.c
+++ b/src/exchange-lib/test_exchange_api.c
@@ -1709,8 +1709,9 @@ wire_deposits_cb (void *cls,
wire = json_loads (dep->details.deposit.wire_details,
JSON_REJECT_DUPLICATES,
NULL);
- TALER_JSON_hash (wire,
- &hw);
+ GNUNET_assert (GNUNET_OK ==
+ TALER_JSON_hash (wire,
+ &hw));
json_decref (wire);
if (0 != memcmp (&hw,
h_wire,
@@ -2261,8 +2262,9 @@ interpreter_run (void *cls)
fail (is);
return;
}
- TALER_JSON_hash (contract_terms,
- &h_contract_terms);
+ GNUNET_assert (GNUNET_OK ==
+ TALER_JSON_hash (contract_terms,
+ &h_contract_terms));
json_decref (contract_terms);
wire = json_loads (cmd->details.deposit.wire_details,
JSON_REJECT_DUPLICATES,
@@ -2307,8 +2309,9 @@ interpreter_run (void *cls)
dr.purpose.size = htonl (sizeof (struct TALER_DepositRequestPS));
dr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT);
dr.h_contract_terms = h_contract_terms;
- TALER_JSON_hash (wire,
- &dr.h_wire);
+ GNUNET_assert (GNUNET_OK ==
+ TALER_JSON_hash (wire,
+ &dr.h_wire));
dr.timestamp = GNUNET_TIME_absolute_hton (timestamp);
dr.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline);
TALER_amount_hton (&dr.amount_with_fee,
@@ -2542,15 +2545,17 @@ interpreter_run (void *cls)
JSON_REJECT_DUPLICATES,
NULL);
GNUNET_assert (NULL != wire);
- TALER_JSON_hash (wire,
- &h_wire);
+ GNUNET_assert (GNUNET_OK ==
+ TALER_JSON_hash (wire,
+ &h_wire));
json_decref (wire);
contract_terms = json_loads (ref->details.deposit.contract_terms,
JSON_REJECT_DUPLICATES,
NULL);
GNUNET_assert (NULL != contract_terms);
- TALER_JSON_hash (contract_terms,
- &h_contract_terms);
+ GNUNET_assert (GNUNET_OK ==
+ TALER_JSON_hash (contract_terms,
+ &h_contract_terms));
json_decref (contract_terms);
cmd->details.deposit_wtid.dwh
= TALER_EXCHANGE_track_transaction (exchange,
@@ -2665,8 +2670,9 @@ interpreter_run (void *cls)
JSON_REJECT_DUPLICATES,
NULL);
GNUNET_assert (NULL != contract_terms);
- TALER_JSON_hash (contract_terms,
- &h_contract_terms);
+ GNUNET_assert (GNUNET_OK ==
+ TALER_JSON_hash (contract_terms,
+ &h_contract_terms));
json_decref (contract_terms);
coin = find_command (is,
diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c
index fdb32a24c..011cb98b8 100644
--- a/src/exchange/taler-exchange-aggregator.c
+++ b/src/exchange/taler-exchange-aggregator.c
@@ -354,7 +354,7 @@ update_fees (struct WirePlugin *wp,
struct TALER_EXCHANGEDB_Session *session)
{
enum GNUNET_DB_QueryStatus qs;
-
+
advance_fees (wp,
now);
if (NULL != wp->af)
@@ -595,7 +595,7 @@ deposit_cb (void *cls,
const json_t *wire)
{
enum GNUNET_DB_QueryStatus qs;
-
+
au->merchant_pub = *merchant_pub;
if (GNUNET_SYSERR ==
TALER_amount_subtract (&au->total_amount,
@@ -611,8 +611,15 @@ deposit_cb (void *cls,
au->row_id = row_id;
GNUNET_assert (NULL == au->wire);
au->wire = json_incref ((json_t *) wire);
- TALER_JSON_hash (au->wire,
- &au->h_wire);
+ if (GNUNET_OK !=
+ TALER_JSON_hash (au->wire,
+ &au->h_wire))
+ {
+ GNUNET_break (0);
+ json_decref (au->wire);
+ au->wire = NULL;
+ return GNUNET_DB_STATUS_HARD_ERROR;
+ }
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
&au->wtid,
sizeof (au->wtid));
@@ -839,7 +846,7 @@ prepare_close_cb (void *cls,
size_t buf_size)
{
enum GNUNET_DB_QueryStatus qs;
-
+
GNUNET_assert (cls == ctc);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -867,7 +874,7 @@ prepare_close_cb (void *cls,
buf_size);
if (GNUNET_DB_STATUS_HARD_ERROR == qs)
{
- GNUNET_break (0);
+ GNUNET_break (0);
db_plugin->rollback (db_plugin->cls,
ctc->session);
global_ret = GNUNET_SYSERR;
@@ -1093,7 +1100,7 @@ run_reserve_closures (void *cls)
enum GNUNET_DB_QueryStatus qs;
const struct GNUNET_SCHEDULER_TaskContext *tc;
struct ExpiredReserveContext erc;
-
+
task = NULL;
reserves_idle = GNUNET_NO;
tc = GNUNET_SCHEDULER_get_task_context ();
@@ -1126,9 +1133,9 @@ run_reserve_closures (void *cls)
GNUNET_TIME_absolute_get (),
&expired_reserve_cb,
&erc);
- switch (qs)
+ switch (qs)
{
- case GNUNET_DB_STATUS_HARD_ERROR:
+ case GNUNET_DB_STATUS_HARD_ERROR:
GNUNET_break (0);
db_plugin->rollback (db_plugin->cls,
session);
@@ -1290,7 +1297,7 @@ run_aggregation (void *cls)
NULL);
return;
}
-
+
/* Subtract wire transfer fee and round to the unit supported by the
wire transfer method; Check if after rounding down, we still have
an amount to transfer, and if not mark as 'tiny'. */
@@ -1322,7 +1329,7 @@ run_aggregation (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to start database transaction!\n");
global_ret = GNUNET_SYSERR;
- cleanup_au ();
+ cleanup_au ();
GNUNET_SCHEDULER_shutdown ();
return;
}
@@ -1690,7 +1697,7 @@ run_transfers (void *cls)
case GNUNET_DB_STATUS_SOFT_ERROR:
/* try again */
task = GNUNET_SCHEDULER_add_now (&run_transfers,
- NULL);
+ NULL);
return;
case GNUNET_DB_STATUS_SUCCESS_NO_RESULTS:
/* no more prepared wire transfers, go back to aggregation! */
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index bde14d815..e461a95c7 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -718,6 +718,7 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto
&deposit_total,
&pos->details.bank->amount))
{
+ GNUNET_break (0);
json_decref (json_history);
return NULL;
}
@@ -748,6 +749,7 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto
&withdraw_total,
&value))
{
+ GNUNET_break (0);
json_decref (json_history);
return NULL;
}
@@ -782,6 +784,7 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto
&deposit_total,
&payback->value))
{
+ GNUNET_break (0);
json_decref (json_history);
return NULL;
}
@@ -840,8 +843,14 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto
TALER_amount_hton (&rcc.closing_fee,
&pos->details.closing->closing_fee);
rcc.reserve_pub = pos->details.closing->reserve_pub;
- TALER_JSON_hash (pos->details.closing->receiver_account_details,
- &rcc.h_wire);
+ if (GNUNET_OK !=
+ TALER_JSON_hash (pos->details.closing->receiver_account_details,
+ &rcc.h_wire))
+ {
+ GNUNET_break (0);
+ json_decref (json_history);
+ return NULL;
+ }
rcc.wtid = pos->details.closing->wtid;
TEH_KS_sign (&rcc.purpose,
&pub,
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index 6b8957718..131771bd1 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -932,7 +932,9 @@ deposit_cb (void *cls,
deposit_rowid = rowid;
if (NULL != wire)
- TALER_JSON_hash (wire, &h_wire);
+ GNUNET_assert (GNUNET_OK ==
+ TALER_JSON_hash (wire,
+ &h_wire));
if ( (0 != memcmp (merchant_pub,
&deposit->merchant_pub,
sizeof (struct TALER_MerchantPublicKeyP))) ||
@@ -1776,8 +1778,9 @@ run (void *cls)
RND_BLK (&deposit.merchant_pub);
RND_BLK (&deposit.h_contract_terms);
wire = json_loads (json_wire_str, 0, NULL);
- TALER_JSON_hash (wire,
- &deposit.h_wire);
+ GNUNET_assert (GNUNET_OK ==
+ TALER_JSON_hash (wire,
+ &deposit.h_wire));
deposit.receiver_wire_account = wire;
deposit.amount_with_fee = value;
deposit.deposit_fee = fee_deposit;
diff --git a/src/json/json.c b/src/json/json.c
index 74559e6c5..adcc2314a 100644
--- a/src/json/json.c
+++ b/src/json/json.c
@@ -40,7 +40,10 @@ TALER_JSON_hash (const json_t *json,
if (NULL == (wire_enc = json_dumps (json,
JSON_COMPACT | JSON_SORT_KEYS)))
+ {
+ GNUNET_break (0);
return GNUNET_SYSERR;
+ }
len = strlen (wire_enc) + 1;
GNUNET_CRYPTO_hash (wire_enc,
len,