From feec0d49ab5c85c7b25146da8e2c914c95bd8b3f Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Tue, 8 Jan 2019 19:10:38 +0100 Subject: fix #5484 --- src/auditor/taler-auditor.c | 50 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) (limited to 'src/auditor') diff --git a/src/auditor/taler-auditor.c b/src/auditor/taler-auditor.c index c1aaa614a..4b88abd62 100644 --- a/src/auditor/taler-auditor.c +++ b/src/auditor/taler-auditor.c @@ -4367,6 +4367,29 @@ setup_sessions_and_run () } +/** + * Test if the given @a mpub matches the #master_pub. + * If so, set "found" to GNUNET_YES. + * + * @param cls a `int *` pointing to "found" + * @param mpub exchange master public key to compare + * @param exchange_url URL of the exchange (ignored) + */ +static void +test_master_present (void *cls, + const struct TALER_MasterPublicKeyP *mpub, + const char *exchange_url) +{ + int *found = cls; + + (void) exchange_url; + if (0 == memcmp (mpub, + &master_pub, + sizeof (master_pub))) + *found = GNUNET_YES; +} + + /** * Main function that will be run. * @@ -4384,6 +4407,8 @@ run (void *cls, static const struct TALER_MasterPublicKeyP zeromp; struct TALER_Amount income_fee_total; json_t *report; + struct TALER_AUDITORDB_Session *as; + int found; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Launching auditor\n"); @@ -4464,6 +4489,31 @@ run (void *cls, TALER_EXCHANGEDB_plugin_unload (edb); return; } + found = GNUNET_NO; + as = adb->get_session (adb->cls); + if (NULL == as) + { + fprintf (stderr, + "Failed to start session with auditor database.\n"); + global_ret = 1; + TALER_AUDITORDB_plugin_unload (adb); + TALER_EXCHANGEDB_plugin_unload (edb); + return; + } + (void) adb->list_exchanges (adb->cls, + as, + &test_master_present, + &found); + if (GNUNET_NO == found) + { + fprintf (stderr, + "Exchange's master public key `%s' not known to auditor DB. Did you forget to run `taler-auditor-exchange`?\n", + TALER_B2S (&master_pub)); + global_ret = 1; + TALER_AUDITORDB_plugin_unload (adb); + TALER_EXCHANGEDB_plugin_unload (edb); + return; + } if (restart) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, -- cgit v1.2.3