diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-11-25 16:25:33 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-11-25 16:25:33 +0100 |
commit | f5d7653ef09193a37f9ebdb09dbe5c425652f1c8 (patch) | |
tree | e1c87fc27916513b664b25f1d528bc5c8321c156 | |
parent | f6fe309f5dbfd9680bea7738e2e15caaa0953080 (diff) |
refuse to start if we have no denominations
-rw-r--r-- | src/exchange/taler-exchange-httpd_keystate.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/exchange/taler-exchange-httpd_keystate.c b/src/exchange/taler-exchange-httpd_keystate.c index ef83f305c..e7fc16506 100644 --- a/src/exchange/taler-exchange-httpd_keystate.c +++ b/src/exchange/taler-exchange-httpd_keystate.c @@ -673,9 +673,14 @@ TEH_KS_acquire_ (const char *location) GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Loading keys from `%s'\n", TEH_exchange_directory); - TALER_EXCHANGEDB_denomination_keys_iterate (TEH_exchange_directory, - &reload_keys_denom_iter, - key_state); + if (-1 == TALER_EXCHANGEDB_denomination_keys_iterate (TEH_exchange_directory, + &reload_keys_denom_iter, + key_state)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Can't load denomination keys.\n"); + GNUNET_assert (0 == pthread_mutex_unlock (&internal_key_state_mutex)); + return NULL; + } TALER_EXCHANGEDB_signing_keys_iterate (TEH_exchange_directory, &reload_keys_sign_iter, key_state); @@ -693,6 +698,14 @@ TEH_KS_acquire_ (const char *location) return NULL; } + if (0 == GNUNET_CONTAINER_multihashmap_size (key_state->denomkey_map)) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + "Have no denomination keys. Bad configuration.\n"); + GNUNET_assert (0 == pthread_mutex_unlock (&internal_key_state_mutex)); + return NULL; + } + ks.purpose.size = htonl (sizeof (ks)); ks.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_KEY_SET); ks.list_issue_date = GNUNET_TIME_absolute_hton (key_state->reload_time); |