diff options
Diffstat (limited to 'src/exchange/taler-exchange-httpd_deposit.c')
-rw-r--r-- | src/exchange/taler-exchange-httpd_deposit.c | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/exchange/taler-exchange-httpd_deposit.c b/src/exchange/taler-exchange-httpd_deposit.c index e1b30272c..fd36bb4a0 100644 --- a/src/exchange/taler-exchange-httpd_deposit.c +++ b/src/exchange/taler-exchange-httpd_deposit.c | |||
@@ -250,6 +250,8 @@ verify_and_execute_deposit (struct MHD_Connection *connection, | |||
250 | struct DepositContext dc; | 250 | struct DepositContext dc; |
251 | struct TEH_KS_StateHandle *mks; | 251 | struct TEH_KS_StateHandle *mks; |
252 | const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki; | 252 | const struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki; |
253 | enum TALER_ErrorCode ec; | ||
254 | unsigned int hc; | ||
253 | 255 | ||
254 | /* check signature */ | 256 | /* check signature */ |
255 | dr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT); | 257 | dr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_COIN_DEPOSIT); |
@@ -287,12 +289,15 @@ verify_and_execute_deposit (struct MHD_Connection *connection, | |||
287 | } | 289 | } |
288 | dki = TEH_KS_denomination_key_lookup_by_hash (mks, | 290 | dki = TEH_KS_denomination_key_lookup_by_hash (mks, |
289 | &deposit->coin.denom_pub_hash, | 291 | &deposit->coin.denom_pub_hash, |
290 | TEH_KS_DKU_DEPOSIT); | 292 | TEH_KS_DKU_DEPOSIT, |
293 | &ec, | ||
294 | &hc); | ||
291 | if (NULL == dki) | 295 | if (NULL == dki) |
292 | { | 296 | { |
293 | TEH_KS_release (mks); | 297 | TEH_KS_release (mks); |
294 | return TEH_RESPONSE_reply_internal_db_error (connection, | 298 | return TEH_RESPONSE_reply_with_error (connection, |
295 | TALER_EC_DEPOSIT_DB_DENOMINATION_KEY_UNKNOWN); | 299 | ec, |
300 | hc); | ||
296 | } | 301 | } |
297 | TALER_amount_ntoh (&dc.value, | 302 | TALER_amount_ntoh (&dc.value, |
298 | &dki->issue.properties.value); | 303 | &dki->issue.properties.value); |
@@ -388,6 +393,7 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh, | |||
388 | json_t *wire; | 393 | json_t *wire; |
389 | char *emsg; | 394 | char *emsg; |
390 | enum TALER_ErrorCode ec; | 395 | enum TALER_ErrorCode ec; |
396 | unsigned int hc; | ||
391 | struct TALER_EXCHANGEDB_Deposit deposit; | 397 | struct TALER_EXCHANGEDB_Deposit deposit; |
392 | struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki; | 398 | struct TALER_EXCHANGEDB_DenominationKeyIssueInformation *dki; |
393 | struct TEH_KS_StateHandle *key_state; | 399 | struct TEH_KS_StateHandle *key_state; |
@@ -497,16 +503,17 @@ TEH_DEPOSIT_handler_deposit (struct TEH_RequestHandler *rh, | |||
497 | } | 503 | } |
498 | dki = TEH_KS_denomination_key_lookup_by_hash (key_state, | 504 | dki = TEH_KS_denomination_key_lookup_by_hash (key_state, |
499 | &deposit.coin.denom_pub_hash, | 505 | &deposit.coin.denom_pub_hash, |
500 | TEH_KS_DKU_DEPOSIT); | 506 | TEH_KS_DKU_DEPOSIT, |
507 | &ec, | ||
508 | &hc); | ||
501 | if (NULL == dki) | 509 | if (NULL == dki) |
502 | { | 510 | { |
503 | /* FIXME: #3887: if DK was revoked, we might want to give a 403 and not a 404! */ | ||
504 | TEH_KS_release (key_state); | 511 | TEH_KS_release (key_state); |
505 | TALER_LOG_WARNING ("Unknown denomination key in /deposit request\n"); | 512 | TALER_LOG_WARNING ("Unknown denomination key in /deposit request\n"); |
506 | GNUNET_JSON_parse_free (spec); | 513 | GNUNET_JSON_parse_free (spec); |
507 | return TEH_RESPONSE_reply_arg_unknown (connection, | 514 | return TEH_RESPONSE_reply_with_error (connection, |
508 | TALER_EC_DEPOSIT_DENOMINATION_KEY_UNKNOWN, | 515 | ec, |
509 | "denom_pub"); | 516 | hc); |
510 | } | 517 | } |
511 | TALER_amount_ntoh (&deposit.deposit_fee, | 518 | TALER_amount_ntoh (&deposit.deposit_fee, |
512 | &dki->issue.properties.fee_deposit); | 519 | &dki->issue.properties.fee_deposit); |