summaryrefslogtreecommitdiff
path: root/src/exchange/taler-exchange-httpd_deposit.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-10-06 21:54:55 +0200
committerChristian Grothoff <christian@grothoff.org>2017-10-06 21:54:55 +0200
commit332a37292c1db7261ebc6bb6fbb9ceacd7cc3220 (patch)
tree8a815d39417f13bc5a4bed09f4b2e85d9ca9d5ee /src/exchange/taler-exchange-httpd_deposit.c
parent98b7444a7b122498e5b6d693c4503b1702763307 (diff)
downloadexchange-332a37292c1db7261ebc6bb6fbb9ceacd7cc3220.tar.gz
exchange-332a37292c1db7261ebc6bb6fbb9ceacd7cc3220.tar.bz2
exchange-332a37292c1db7261ebc6bb6fbb9ceacd7cc3220.zip
handle (most) TEH_KS_acquire errors
Diffstat (limited to 'src/exchange/taler-exchange-httpd_deposit.c')
-rw-r--r--src/exchange/taler-exchange-httpd_deposit.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c
index 8d824b7fd..ea77216f0 100644
--- a/src/exchange/taler-exchange-httpd_deposit.c
+++ b/src/exchange/taler-exchange-httpd_deposit.c
@@ -104,7 +104,7 @@ struct DepositContext
* Value of the coin.
*/
struct TALER_Amount value;
-
+
};
@@ -133,7 +133,7 @@ deposit_transaction (void *cls,
struct TALER_EXCHANGEDB_TransactionList *tl;
struct TALER_Amount spent;
enum GNUNET_DB_QueryStatus qs;
-
+
qs = TEH_plugin->have_deposit (TEH_plugin->cls,
session,
deposit);
@@ -255,6 +255,13 @@ verify_and_execute_deposit (struct MHD_Connection *connection,
/* check denomination */
mks = TEH_KS_acquire ();
+ if (NULL == mks)
+ {
+ TALER_LOG_ERROR ("Lacking keys to operate\n");
+ return TEH_RESPONSE_reply_internal_error (connection,
+ TALER_EC_EXCHANGE_BAD_CONFIGURATION,
+ "no keys");
+ }
dki = TEH_KS_denomination_key_lookup (mks,
&deposit->coin.denom_pub,
TEH_KS_DKU_DEPOSIT);
@@ -450,6 +457,14 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh,
/* check denomination exists and is valid */
key_state = TEH_KS_acquire ();
+ if (NULL == key_state)
+ {
+ TALER_LOG_ERROR ("Lacking keys to operate\n");
+ GNUNET_JSON_parse_free (spec);
+ return TEH_RESPONSE_reply_internal_error (connection,
+ TALER_EC_EXCHANGE_BAD_CONFIGURATION,
+ "no keys");
+ }
dki = TEH_KS_denomination_key_lookup (key_state,
&deposit.coin.denom_pub,
TEH_KS_DKU_DEPOSIT);