diff options
Diffstat (limited to 'src/backend/taler-merchant-httpd_helper.c')
-rw-r--r-- | src/backend/taler-merchant-httpd_helper.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/src/backend/taler-merchant-httpd_helper.c b/src/backend/taler-merchant-httpd_helper.c index f4129e0e..8c15a542 100644 --- a/src/backend/taler-merchant-httpd_helper.c +++ b/src/backend/taler-merchant-httpd_helper.c @@ -315,26 +315,29 @@ TMH_taxes_array_valid (const json_t *taxes) struct TMH_WireMethod * TMH_setup_wire_account (const char *payto_uri) { - struct TALER_WireSalt salt; struct TMH_WireMethod *wm; + char *emsg; + + if (NULL != (emsg = TALER_payto_validate (payto_uri))) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Invalid URI `%s': %s\n", + payto_uri, + emsg); + GNUNET_free (emsg); + return NULL; + } - GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, - &salt, - sizeof (salt)); wm = GNUNET_new (struct TMH_WireMethod); - wm->j_wire = GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("payto_uri", - payto_uri), - GNUNET_JSON_pack_data_auto ("salt", - &salt)); - GNUNET_assert (NULL != wm->j_wire); - /* This also tests for things like the IBAN being malformed */ - GNUNET_assert (GNUNET_OK == - TALER_JSON_merchant_wire_signature_hash (wm->j_wire, - &wm->h_wire)); + GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE, + &wm->wire_salt, + sizeof (wm->wire_salt)); + wm->payto_uri = GNUNET_strdup (payto_uri); + TALER_merchant_wire_signature_hash (payto_uri, + &wm->wire_salt, + &wm->h_wire); wm->wire_method = TALER_payto_get_method (payto_uri); - GNUNET_assert (NULL != wm->wire_method); /* checked earlier */ wm->active = true; return wm; } |