From 7d6b8d53d5a6ee6ca1545fb5d458199c6249edc5 Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Fri, 18 Nov 2016 18:29:18 +0100 Subject: addressing #4803: nicer error messages for invalid wire formats --- src/exchange-lib/exchange_api_wire.c | 13 ++++++++----- src/exchange-lib/test_exchange_api.c | 9 +++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src/exchange-lib') diff --git a/src/exchange-lib/exchange_api_wire.c b/src/exchange-lib/exchange_api_wire.c index 7401e66d4..fe60d664c 100644 --- a/src/exchange-lib/exchange_api_wire.c +++ b/src/exchange-lib/exchange_api_wire.c @@ -95,7 +95,8 @@ verify_wire_method_signature_ok (const struct TALER_EXCHANGE_WireHandle *wh, const struct TALER_EXCHANGE_Keys *key_state; struct TALER_WIRE_Plugin *plugin; char *lib_name; - int ret; + char *emsg; + enum TALER_ErrorCode ec; key_state = TALER_EXCHANGE_get_keys (wh->exchange); (void) GNUNET_asprintf (&lib_name, @@ -112,13 +113,15 @@ verify_wire_method_signature_ok (const struct TALER_EXCHANGE_WireHandle *wh, return GNUNET_NO; } plugin->library_name = lib_name; - ret = plugin->wire_validate (plugin->cls, - json, - &key_state->master_pub); + ec = plugin->wire_validate (plugin->cls, + json, + &key_state->master_pub, + &emsg); + GNUNET_free_non_null (emsg); GNUNET_PLUGIN_unload (lib_name, plugin); GNUNET_free (lib_name); - return (GNUNET_YES == ret) ? GNUNET_OK : GNUNET_SYSERR; + return (TALER_EC_NONE == ec) ? GNUNET_OK : GNUNET_SYSERR; } diff --git a/src/exchange-lib/test_exchange_api.c b/src/exchange-lib/test_exchange_api.c index 8c5e17d15..7f6e86a4a 100644 --- a/src/exchange-lib/test_exchange_api.c +++ b/src/exchange-lib/test_exchange_api.c @@ -1596,6 +1596,7 @@ deposit_wtid_cb (void *cls, } break; default: + GNUNET_break (0); break; } next_command (is); @@ -2427,6 +2428,10 @@ do_shutdown (void *cls) struct Command *cmd; unsigned int i; + fprintf (stderr, + "Executing shutdown at `%s'\n", + is->commands[is->ip].label); + for (i=0;OC_END != (cmd = &is->commands[i])->oc;i++) { switch (cmd->oc) @@ -3084,6 +3089,9 @@ main (int argc, /* These might get in the way... */ unsetenv ("XDG_DATA_HOME"); unsetenv ("XDG_CONFIG_HOME"); + GNUNET_log_setup ("test-exchange-api", + "INFO", + NULL); proc = GNUNET_OS_start_process (GNUNET_NO, GNUNET_OS_INHERIT_STD_ALL, NULL, NULL, NULL, @@ -3145,6 +3153,7 @@ main (int argc, result = GNUNET_SYSERR; sigpipe = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO); GNUNET_assert (NULL != sigpipe); + sleep (30); shc_chld = GNUNET_SIGNAL_handler_install (GNUNET_SIGCHLD, &sighandler_child_death); GNUNET_SCHEDULER_run (&run, NULL); -- cgit v1.2.3