diff options
author | Christian Grothoff <christian@grothoff.org> | 2019-01-08 19:10:38 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2019-01-08 19:10:38 +0100 |
commit | feec0d49ab5c85c7b25146da8e2c914c95bd8b3f (patch) | |
tree | 5f93ce1c580298da36bd860449ff725ad265c1e5 | |
parent | 3ed5db972d2d0848f845e1094d0f987f9c94e6b0 (diff) |
fix #5484
-rw-r--r-- | src/auditor/taler-auditor.c | 50 |
1 files changed, 50 insertions, 0 deletions
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 @@ -4368,6 +4368,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. * * @param cls closure @@ -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, |