diff options
author | Sree Harsha Totakura <sreeharsha@totakura.in> | 2015-08-17 10:30:45 +0200 |
---|---|---|
committer | Sree Harsha Totakura <sreeharsha@totakura.in> | 2015-08-17 10:30:45 +0200 |
commit | 8e6f121a68c00cb6bdf9d160164684446af6d6c2 (patch) | |
tree | 24c9e045897bb84cb53748b3afe574635fce2e92 /src/mint/taler-mint-httpd_responses.c | |
parent | 767e2f18f19bf5106ffaf9cc5c5cf053aaca6cea (diff) | |
parent | 08c947a01f9e2048f7668cabac58a5938dc477f5 (diff) |
Merge branch 'master' of git+ssh://taler.net/var/git/mint
Diffstat (limited to 'src/mint/taler-mint-httpd_responses.c')
-rw-r--r-- | src/mint/taler-mint-httpd_responses.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/mint/taler-mint-httpd_responses.c b/src/mint/taler-mint-httpd_responses.c index 8a5573e8..418bc175 100644 --- a/src/mint/taler-mint-httpd_responses.c +++ b/src/mint/taler-mint-httpd_responses.c @@ -416,6 +416,19 @@ compile_transaction_history (const struct TALER_MINTDB_TransactionList *tl) &deposit->deposit_fee); dr.merchant = deposit->merchant_pub; dr.coin_pub = deposit->coin.coin_pub; + + /* internal sanity check before we hand out a bogus sig... */ + if (GNUNET_OK != + GNUNET_CRYPTO_eddsa_verify (ntohl (dr.purpose.purpose), + &dr.purpose, + &deposit->csig.eddsa_signature, + &deposit->coin.coin_pub.eddsa_pub)) + { + GNUNET_break (0); + json_decref (history); + return NULL; + } + transaction = TALER_json_from_eddsa_sig (&dr.purpose, &deposit->csig.eddsa_signature); break; @@ -435,6 +448,19 @@ compile_transaction_history (const struct TALER_MINTDB_TransactionList *tl) TALER_amount_hton (&ms.melt_fee, &melt->melt_fee); ms.coin_pub = melt->coin.coin_pub; + + /* internal sanity check before we hand out a bogus sig... */ + if (GNUNET_OK != + GNUNET_CRYPTO_eddsa_verify (ntohl (ms.purpose.purpose), + &ms.purpose, + &melt->coin_sig.eddsa_signature, + &melt->coin.coin_pub.eddsa_pub)) + { + GNUNET_break (0); + json_decref (history); + return NULL; + } + transaction = TALER_json_from_eddsa_sig (&ms.purpose, &melt->coin_sig.eddsa_signature); } @@ -476,6 +502,8 @@ TMH_RESPONSE_reply_deposit_insufficient_funds (struct MHD_Connection *connection json_t *history; history = compile_transaction_history (tl); + if (NULL == history) + return TMH_RESPONSE_reply_internal_db_error (connection); return TMH_RESPONSE_reply_json_pack (connection, MHD_HTTP_FORBIDDEN, "{s:s, s:o}", @@ -710,8 +738,10 @@ TMH_RESPONSE_reply_refresh_melt_insufficient_funds (struct MHD_Connection *conne json_t *history; history = compile_transaction_history (tl); + if (NULL == history) + return TMH_RESPONSE_reply_internal_db_error (connection); return TMH_RESPONSE_reply_json_pack (connection, - MHD_HTTP_NOT_FOUND, + MHD_HTTP_FORBIDDEN, "{s:s, s:o, s:o, s:o, s:o, s:o}", "error", "insufficient funds", |