diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-10-07 15:10:24 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-10-07 15:10:24 +0200 |
commit | cc5d09cf1d28e31ca8eca054b7da2c3873e2efe7 (patch) | |
tree | eb843f228165457fa066038058df380fc5652405 /src/exchange/taler-exchange-httpd_responses.c | |
parent | 7935349d35611901d42d088f0e6dbd5ec8c47272 (diff) | |
download | exchange-cc5d09cf1d28e31ca8eca054b7da2c3873e2efe7.tar.gz exchange-cc5d09cf1d28e31ca8eca054b7da2c3873e2efe7.tar.bz2 exchange-cc5d09cf1d28e31ca8eca054b7da2c3873e2efe7.zip |
properly handle signing errors if httpd lacks signing keys by returning internal errors (and handling new return value from TEH_KS_sign)
Diffstat (limited to 'src/exchange/taler-exchange-httpd_responses.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_responses.c | 38 |
1 files changed, 28 insertions, 10 deletions
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c index 1b45a0cc7..ac86416f3 100644 --- a/src/exchange/taler-exchange-httpd_responses.c +++ b/src/exchange/taler-exchange-httpd_responses.c @@ -474,7 +474,7 @@ TEH_RESPONSE_reply_invalid_json (struct MHD_Connection *connection) * Compile the transaction history of a coin into a JSON object. * * @param tl transaction history to JSON-ify - * @return json representation of the @a rh + * @return json representation of the @a rh, NULL on error */ json_t * TEH_RESPONSE_compile_transaction_history (const struct TALER_EXCHANGEDB_TransactionList *tl) @@ -632,9 +632,15 @@ TEH_RESPONSE_compile_transaction_history (const struct TALER_EXCHANGEDB_Transact &payback->value); pc.coin_pub = payback->coin.coin_pub; pc.reserve_pub = payback->reserve_pub; - TEH_KS_sign (&pc.purpose, - &epub, - &esig); + if (GNUNET_OK != + TEH_KS_sign (&pc.purpose, + &epub, + &esig)) + { + GNUNET_break (0); + json_decref (history); + return NULL; + } GNUNET_assert (0 == json_array_append_new (history, json_pack ("{s:s, s:o, s:o, s:o, s:o, s:o}", @@ -796,9 +802,15 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto &payback->value); pc.coin_pub = payback->coin.coin_pub; pc.reserve_pub = payback->reserve_pub; - TEH_KS_sign (&pc.purpose, - &pub, - &sig); + if (GNUNET_OK != + TEH_KS_sign (&pc.purpose, + &pub, + &sig)) + { + GNUNET_break (0); + json_decref (json_history); + return NULL; + } GNUNET_assert (0 == json_array_append_new (json_history, @@ -852,9 +864,15 @@ TEH_RESPONSE_compile_reserve_history (const struct TALER_EXCHANGEDB_ReserveHisto return NULL; } rcc.wtid = pos->details.closing->wtid; - TEH_KS_sign (&rcc.purpose, - &pub, - &sig); + if (GNUNET_OK != + TEH_KS_sign (&rcc.purpose, + &pub, + &sig)) + { + GNUNET_break (0); + json_decref (json_history); + return NULL; + } GNUNET_assert (0 == json_array_append_new (json_history, json_pack ("{s:s, s:O, s:o, s:o, s:o, s:o, s:o, s:o}", |