diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-28 20:23:19 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-28 20:23:19 +0100 |
commit | 62d3d352502f5b1d109b18456a87c704a70fcca5 (patch) | |
tree | 020ccf88cf701c29faa59a3f22650946e5d0eb2b /src/mint/taler-mint-httpd_deposit.c | |
parent | 2debf6c3f0462a4743484c0cde7c951940e5cd2a (diff) | |
download | exchange-62d3d352502f5b1d109b18456a87c704a70fcca5.tar.gz exchange-62d3d352502f5b1d109b18456a87c704a70fcca5.tar.bz2 exchange-62d3d352502f5b1d109b18456a87c704a70fcca5.zip |
move coin validity test to libtalerutil
Diffstat (limited to 'src/mint/taler-mint-httpd_deposit.c')
-rw-r--r-- | src/mint/taler-mint-httpd_deposit.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/mint/taler-mint-httpd_deposit.c b/src/mint/taler-mint-httpd_deposit.c index 0bd1134a6..63ce03579 100644 --- a/src/mint/taler-mint-httpd_deposit.c +++ b/src/mint/taler-mint-httpd_deposit.c @@ -59,6 +59,7 @@ verify_and_execute_deposit (struct MHD_Connection *connection, { struct MintKeyState *key_state; struct TALER_DepositRequest dr; + struct TALER_MINT_DenomKeyIssuePriv *dki; dr.purpose.purpose = htonl (TALER_SIGNATURE_WALLET_DEPOSIT); dr.purpose.size = htonl (sizeof (struct TALER_DepositRequest)); @@ -77,11 +78,20 @@ verify_and_execute_deposit (struct MHD_Connection *connection, return TALER_MINT_reply_arg_invalid (connection, "csig"); } - + /* check denomination exists and is valid */ key_state = TALER_MINT_key_state_acquire (); + dki = TALER_MINT_get_denom_key (key_state, + deposit->coin.denom_pub); + if (NULL == dki) + { + TALER_MINT_key_state_release (key_state); + LOG_WARNING ("Unknown denomination key in /deposit request\n"); + return TALER_MINT_reply_arg_invalid (connection, + "denom_pub"); + } + /* check coin signature */ if (GNUNET_YES != - TALER_MINT_test_coin_valid (key_state, - &deposit->coin)) + TALER_test_coin_valid (&deposit->coin)) { LOG_WARNING ("Invalid coin passed for /deposit\n"); TALER_MINT_key_state_release (key_state); |