check return value from TALER_JSON_hash
This commit is contained in:
parent
1da03b95eb
commit
2f715c27f8
@ -2182,8 +2182,15 @@ check_wire_out_cb (void *cls,
|
||||
wcc.date = date;
|
||||
TALER_amount_get_zero (amount->currency,
|
||||
&wcc.total_deposits);
|
||||
if (GNUNET_OK !=
|
||||
TALER_JSON_hash (wire,
|
||||
&wcc.h_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,
|
||||
|
@ -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;
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_JSON_hash (merchant_details,
|
||||
&dr.h_wire);
|
||||
&dr.h_wire));
|
||||
|
||||
dr.timestamp = GNUNET_TIME_absolute_hton (timestamp);
|
||||
dr.refund_deadline = GNUNET_TIME_absolute_hton (refund_deadline);
|
||||
|
@ -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 ==
|
||||
if (GNUNET_OK !=
|
||||
TALER_JSON_hash (wire_details,
|
||||
&h_wire));
|
||||
&h_wire))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
return NULL;
|
||||
}
|
||||
key_state = TALER_EXCHANGE_get_keys (exchange);
|
||||
dki = TALER_EXCHANGE_get_denomination_key (key_state,
|
||||
denom_pub);
|
||||
|
@ -354,8 +354,13 @@ parse_reserve_history (struct TALER_EXCHANGE_Handle *exchange,
|
||||
}
|
||||
TALER_amount_hton (&rcc.closing_amount,
|
||||
&amount);
|
||||
if (GNUNET_OK !=
|
||||
TALER_JSON_hash (rhistory[off].details.close_details.receiver_account_details,
|
||||
&rcc.h_wire);
|
||||
&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);
|
||||
|
@ -1709,8 +1709,9 @@ wire_deposits_cb (void *cls,
|
||||
wire = json_loads (dep->details.deposit.wire_details,
|
||||
JSON_REJECT_DUPLICATES,
|
||||
NULL);
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_JSON_hash (wire,
|
||||
&hw);
|
||||
&hw));
|
||||
json_decref (wire);
|
||||
if (0 != memcmp (&hw,
|
||||
h_wire,
|
||||
@ -2261,8 +2262,9 @@ interpreter_run (void *cls)
|
||||
fail (is);
|
||||
return;
|
||||
}
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_JSON_hash (contract_terms,
|
||||
&h_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;
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_JSON_hash (wire,
|
||||
&dr.h_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);
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_JSON_hash (wire,
|
||||
&h_wire);
|
||||
&h_wire));
|
||||
json_decref (wire);
|
||||
contract_terms = json_loads (ref->details.deposit.contract_terms,
|
||||
JSON_REJECT_DUPLICATES,
|
||||
NULL);
|
||||
GNUNET_assert (NULL != contract_terms);
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_JSON_hash (contract_terms,
|
||||
&h_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);
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_JSON_hash (contract_terms,
|
||||
&h_contract_terms);
|
||||
&h_contract_terms));
|
||||
json_decref (contract_terms);
|
||||
|
||||
coin = find_command (is,
|
||||
|
@ -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);
|
||||
if (GNUNET_OK !=
|
||||
TALER_JSON_hash (au->wire,
|
||||
&au->h_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));
|
||||
|
@ -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;
|
||||
if (GNUNET_OK !=
|
||||
TALER_JSON_hash (pos->details.closing->receiver_account_details,
|
||||
&rcc.h_wire);
|
||||
&rcc.h_wire))
|
||||
{
|
||||
GNUNET_break (0);
|
||||
json_decref (json_history);
|
||||
return NULL;
|
||||
}
|
||||
rcc.wtid = pos->details.closing->wtid;
|
||||
TEH_KS_sign (&rcc.purpose,
|
||||
&pub,
|
||||
|
@ -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);
|
||||
GNUNET_assert (GNUNET_OK ==
|
||||
TALER_JSON_hash (wire,
|
||||
&deposit.h_wire);
|
||||
&deposit.h_wire));
|
||||
deposit.receiver_wire_account = wire;
|
||||
deposit.amount_with_fee = value;
|
||||
deposit.deposit_fee = fee_deposit;
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user