IBAN parser skips BIC part.

This commit is contained in:
MS 2020-06-10 17:56:58 +02:00
parent ab1fc20a45
commit 1039a1c2f4
No known key found for this signature in database
GPG Key ID: 8D526861953F4C0F
2 changed files with 10 additions and 2 deletions

View File

@ -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,
'?');

View File

@ -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));