diff options
author | Christian Grothoff <grothoff@gnunet.org> | 2023-11-25 15:04:44 +0900 |
---|---|---|
committer | Christian Grothoff <grothoff@gnunet.org> | 2023-11-25 15:04:44 +0900 |
commit | 9a4407f7a58af8cfe208436152fa32233a5ca0b3 (patch) | |
tree | aeef9137133ab3bc3e0fd545b9b428f17e0286c5 /src/exchange | |
parent | baa070d19cda046cb0349e85a9a8aabcd9f52661 (diff) | |
download | exchange-9a4407f7a58af8cfe208436152fa32233a5ca0b3.tar.gz exchange-9a4407f7a58af8cfe208436152fa32233a5ca0b3.tar.bz2 exchange-9a4407f7a58af8cfe208436152fa32233a5ca0b3.zip |
more strict spec parsers for payto URIs, Web URLs, and AML decision states
Diffstat (limited to 'src/exchange')
9 files changed, 17 insertions, 19 deletions
diff --git a/src/exchange/taler-exchange-httpd_aml-decision.c b/src/exchange/taler-exchange-httpd_aml-decision.c index e688b2ba6..bf43fdbf2 100644 --- a/src/exchange/taler-exchange-httpd_aml-decision.c +++ b/src/exchange/taler-exchange-httpd_aml-decision.c @@ -246,7 +246,6 @@ TEH_handler_post_aml_decision ( struct DecisionContext dc = { .officer_pub = officer_pub }; - uint32_t new_state32; struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("officer_sig", &dc.officer_sig), @@ -259,8 +258,8 @@ TEH_handler_post_aml_decision ( &dc.justification), GNUNET_JSON_spec_timestamp ("decision_time", &dc.decision_time), - GNUNET_JSON_spec_uint32 ("new_state", - &new_state32), + TALER_JSON_spec_aml_decision ("new_state", + &dc.new_state), GNUNET_JSON_spec_mark_optional ( GNUNET_JSON_spec_array_const ("kyc_requirements", &dc.kyc_requirements), @@ -282,7 +281,6 @@ TEH_handler_post_aml_decision ( return MHD_YES; /* failure */ } } - dc.new_state = (enum TALER_AmlDecisionState) new_state32; TEH_METRICS_num_verifications[TEH_MT_SIGNATURE_EDDSA]++; if (GNUNET_OK != TALER_officer_aml_decision_verify (dc.justification, diff --git a/src/exchange/taler-exchange-httpd_batch-deposit.c b/src/exchange/taler-exchange-httpd_batch-deposit.c index 516739f76..baf2b964d 100644 --- a/src/exchange/taler-exchange-httpd_batch-deposit.c +++ b/src/exchange/taler-exchange-httpd_batch-deposit.c @@ -476,8 +476,8 @@ TEH_handler_batch_deposit (struct TEH_RequestContext *rc, const json_t *coins; bool no_refund_deadline = true; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_string ("merchant_payto_uri", - &bd->receiver_wire_account), + TALER_JSON_spec_payto_uri ("merchant_payto_uri", + &bd->receiver_wire_account), GNUNET_JSON_spec_fixed_auto ("wire_salt", &bd->wire_salt), GNUNET_JSON_spec_fixed_auto ("merchant_pub", diff --git a/src/exchange/taler-exchange-httpd_management_auditors.c b/src/exchange/taler-exchange-httpd_management_auditors.c index 9c7a5c472..7e0593534 100644 --- a/src/exchange/taler-exchange-httpd_management_auditors.c +++ b/src/exchange/taler-exchange-httpd_management_auditors.c @@ -153,7 +153,7 @@ TEH_handler_management_auditors ( &aac.master_sig), GNUNET_JSON_spec_fixed_auto ("auditor_pub", &aac.auditor_pub), - GNUNET_JSON_spec_string ("auditor_url", + TALER_JSON_spec_web_url ("auditor_url", &aac.auditor_url), GNUNET_JSON_spec_string ("auditor_name", &aac.auditor_name), diff --git a/src/exchange/taler-exchange-httpd_management_drain.c b/src/exchange/taler-exchange-httpd_management_drain.c index 565c292f4..1e490d799 100644 --- a/src/exchange/taler-exchange-httpd_management_drain.c +++ b/src/exchange/taler-exchange-httpd_management_drain.c @@ -124,8 +124,8 @@ TEH_handler_management_post_drain ( struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_string ("debit_account_section", &dc.account_section), - GNUNET_JSON_spec_string ("credit_payto_uri", - &dc.payto_uri), + TALER_JSON_spec_payto_uri ("credit_payto_uri", + &dc.payto_uri), GNUNET_JSON_spec_fixed_auto ("wtid", &dc.wtid), GNUNET_JSON_spec_fixed_auto ("master_sig", diff --git a/src/exchange/taler-exchange-httpd_management_partners.c b/src/exchange/taler-exchange-httpd_management_partners.c index e336d24ed..fc8a4207d 100644 --- a/src/exchange/taler-exchange-httpd_management_partners.c +++ b/src/exchange/taler-exchange-httpd_management_partners.c @@ -48,7 +48,7 @@ TEH_handler_management_partners ( &partner_pub), GNUNET_JSON_spec_fixed_auto ("master_sig", &master_sig), - GNUNET_JSON_spec_string ("partner_base_url", + TALER_JSON_spec_web_url ("partner_base_url", &partner_base_url), TALER_JSON_spec_amount ("wad_fee", TEH_currency, diff --git a/src/exchange/taler-exchange-httpd_management_wire_disable.c b/src/exchange/taler-exchange-httpd_management_wire_disable.c index 5bca5736b..d3015fb68 100644 --- a/src/exchange/taler-exchange-httpd_management_wire_disable.c +++ b/src/exchange/taler-exchange-httpd_management_wire_disable.c @@ -143,8 +143,8 @@ TEH_handler_management_post_wire_disable ( struct GNUNET_JSON_Specification spec[] = { GNUNET_JSON_spec_fixed_auto ("master_sig_del", &awc.master_sig), - GNUNET_JSON_spec_string ("payto_uri", - &awc.payto_uri), + TALER_JSON_spec_payto_uri ("payto_uri", + &awc.payto_uri), GNUNET_JSON_spec_timestamp ("validity_end", &awc.validity_end), GNUNET_JSON_spec_end () diff --git a/src/exchange/taler-exchange-httpd_management_wire_enable.c b/src/exchange/taler-exchange-httpd_management_wire_enable.c index b0db390a2..ca5b4ee78 100644 --- a/src/exchange/taler-exchange-httpd_management_wire_enable.c +++ b/src/exchange/taler-exchange-httpd_management_wire_enable.c @@ -170,10 +170,10 @@ TEH_handler_management_post_wire ( &awc.master_sig_wire), GNUNET_JSON_spec_fixed_auto ("master_sig_add", &awc.master_sig_add), - GNUNET_JSON_spec_string ("payto_uri", - &awc.payto_uri), + TALER_JSON_spec_payto_uri ("payto_uri", + &awc.payto_uri), GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_string ("conversion_url", + TALER_JSON_spec_web_url ("conversion_url", &awc.conversion_url), NULL), GNUNET_JSON_spec_array_const ("credit_restrictions", diff --git a/src/exchange/taler-exchange-httpd_purses_merge.c b/src/exchange/taler-exchange-httpd_purses_merge.c index d1edc49b4..5b66254f5 100644 --- a/src/exchange/taler-exchange-httpd_purses_merge.c +++ b/src/exchange/taler-exchange-httpd_purses_merge.c @@ -421,8 +421,8 @@ TEH_handler_purses_merge ( .exchange_timestamp = GNUNET_TIME_timestamp_get () }; struct GNUNET_JSON_Specification spec[] = { - GNUNET_JSON_spec_string ("payto_uri", - &pcc.payto_uri), + TALER_JSON_spec_payto_uri ("payto_uri", + &pcc.payto_uri), GNUNET_JSON_spec_fixed_auto ("reserve_sig", &pcc.reserve_sig), GNUNET_JSON_spec_fixed_auto ("merge_sig", diff --git a/src/exchange/taler-exchange-httpd_reserves_close.c b/src/exchange/taler-exchange-httpd_reserves_close.c index bcde80881..bbf234428 100644 --- a/src/exchange/taler-exchange-httpd_reserves_close.c +++ b/src/exchange/taler-exchange-httpd_reserves_close.c @@ -367,8 +367,8 @@ TEH_handler_reserves_close (struct TEH_RequestContext *rc, GNUNET_JSON_spec_timestamp ("request_timestamp", &rcc.timestamp), GNUNET_JSON_spec_mark_optional ( - GNUNET_JSON_spec_string ("payto_uri", - &rcc.payto_uri), + TALER_JSON_spec_payto_uri ("payto_uri", + &rcc.payto_uri), NULL), GNUNET_JSON_spec_fixed_auto ("reserve_sig", &rcc.reserve_sig), |