summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMS <ms@taler.net>2020-06-10 17:56:58 +0200
committerMS <ms@taler.net>2020-06-10 17:56:58 +0200
commit1039a1c2f472155c88fca3d69a7a226c6c4a8d1c (patch)
tree2daca9d88536caf701a1368df6e5baee2a3978f2
parentab1fc20a450d57db3d76f04ab6176ee1ff0e59b1 (diff)
downloadexchange-1039a1c2f472155c88fca3d69a7a226c6c4a8d1c.tar.gz
exchange-1039a1c2f472155c88fca3d69a7a226c6c4a8d1c.tar.bz2
exchange-1039a1c2f472155c88fca3d69a7a226c6c4a8d1c.zip
IBAN parser skips BIC part.
-rw-r--r--src/json/json_wire.c3
-rw-r--r--src/json/test_json_wire.c9
2 files changed, 10 insertions, 2 deletions
diff --git a/src/json/json_wire.c b/src/json/json_wire.c
index fc3d67a8..7d3453e1 100644
--- a/src/json/json_wire.c
+++ b/src/json/json_wire.c
@@ -343,7 +343,8 @@ validate_payto_iban (const char *account_url)
IBAN_PREFIX,
strlen (IBAN_PREFIX)))
return GNUNET_NO;
- iban = &account_url[strlen (IBAN_PREFIX)];
+
+ iban = strrchr (account_url, '/') + 1;
#undef IBAN_PREFIX
q = strchr (iban,
'?');
diff --git a/src/json/test_json_wire.c b/src/json/test_json_wire.c
index 27de0691..75208c40 100644
--- a/src/json/test_json_wire.c
+++ b/src/json/test_json_wire.c
@@ -33,7 +33,7 @@ main (int argc,
json_t *wire_xtalerbank;
json_t *wire_iban;
const char *payto_xtalerbank = "payto://x-taler-bank/42";
- const char *payto_iban = "payto://iban/DE89370400440532013000";
+ const char *payto_iban = "payto://iban/BIC-TO-BE-SKIPPED/DE89370400440532013000";
char *p_xtalerbank;
char *p_iban;
@@ -49,6 +49,13 @@ main (int argc,
&master_priv);
wire_iban = TALER_JSON_exchange_wire_signature_make (payto_iban,
&master_priv);
+ if (NULL == wire_iban)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+ "Could not parse payto/IBAN (%s) into 'wire object'\n",
+ payto_iban);
+ return 1;
+ }
p_xtalerbank = TALER_JSON_wire_to_payto (wire_xtalerbank);
p_iban = TALER_JSON_wire_to_payto (wire_iban);
GNUNET_assert (0 == strcmp (p_xtalerbank, payto_xtalerbank));