diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-05-15 15:53:21 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-05-16 11:05:00 +0200 |
commit | 7c28823cafa0692849deae506e81efdbc07f2ed3 (patch) | |
tree | ae955b26766f21370e1da7d7c367c25bc9dec422 /src/wire | |
parent | be3b891dbd9b1532b9dca91629d478cc3933dfdc (diff) |
handle base32-wire transfer subject being followed by space+exchange base url in wire plugin and fakebank
Diffstat (limited to 'src/wire')
-rw-r--r-- | src/wire/plugin_wire_test.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/wire/plugin_wire_test.c b/src/wire/plugin_wire_test.c index de3a6aba6..8d625ce6b 100644 --- a/src/wire/plugin_wire_test.c +++ b/src/wire/plugin_wire_test.c @@ -822,16 +822,29 @@ bhist_cb (void *cls, if (MHD_HTTP_OK == http_status) { + char *subject; + char *space; + wd.amount = details->amount; wd.execution_date = details->execution_date; + subject = GNUNET_strdup (details->wire_transfer_subject); + space = strchr (subject, (int) ' '); + if (NULL != space) + { + /* Space separates the actual wire transfer subject from the + exchange base URL (if present, expected only for outgoing + transactions). So we cut the string off at the space. */ + *space = '\0'; + } /* NOTE: For a real bank, the subject should include a checksum! */ if (GNUNET_OK != - GNUNET_STRINGS_string_to_data (details->wire_transfer_subject, - strlen (details->wire_transfer_subject), + GNUNET_STRINGS_string_to_data (subject, + strlen (subject), &wd.reserve_pub, sizeof (wd.reserve_pub))) { GNUNET_break (0); + GNUNET_free (subject); /* NOTE: for a "real" bank, we would want to trigger logic to undo the wire transfer. However, for the "demo" bank, it should currently be "impossible" to do wire transfers with invalid subjects, and @@ -839,6 +852,7 @@ bhist_cb (void *cls, that nicely either right now). So we don't handle this case for now. */ return; } + GNUNET_free (subject); wd.account_details = details->account_details; if ( (NULL != whh->hres_cb) && |