This commit is contained in:
Christian Grothoff 2021-09-01 16:09:39 +02:00
parent bf2ce9853e
commit 13deb5c4d2
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -1391,7 +1391,7 @@ setup_general_response_headers (const struct TEH_KeyStateHandle *ksh,
* @param denoms list of denominations to return * @param denoms list of denominations to return
* @return #GNUNET_OK on success * @return #GNUNET_OK on success
*/ */
static int static enum GNUNET_GenericReturnValue
create_krd (struct TEH_KeyStateHandle *ksh, create_krd (struct TEH_KeyStateHandle *ksh,
const struct GNUNET_HashCode *denom_keys_hash, const struct GNUNET_HashCode *denom_keys_hash,
struct GNUNET_TIME_Absolute last_cpd, struct GNUNET_TIME_Absolute last_cpd,
@ -1404,6 +1404,7 @@ create_krd (struct TEH_KeyStateHandle *ksh,
struct TALER_ExchangeSignatureP exchange_sig; struct TALER_ExchangeSignatureP exchange_sig;
json_t *keys; json_t *keys;
GNUNET_assert (0 != last_cpd.abs_value_us);
GNUNET_assert (NULL != signkeys); GNUNET_assert (NULL != signkeys);
GNUNET_assert (NULL != recoup); GNUNET_assert (NULL != recoup);
GNUNET_assert (NULL != denoms); GNUNET_assert (NULL != denoms);
@ -1541,8 +1542,8 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
struct GNUNET_HashContext *hash_context; struct GNUNET_HashContext *hash_context;
sctx.signkeys = json_array (); sctx.signkeys = json_array ();
sctx.next_sk_expire = GNUNET_TIME_UNIT_FOREVER_ABS;
GNUNET_assert (NULL != sctx.signkeys); GNUNET_assert (NULL != sctx.signkeys);
sctx.next_sk_expire = GNUNET_TIME_UNIT_FOREVER_ABS;
GNUNET_CONTAINER_multipeermap_iterate (ksh->signkey_map, GNUNET_CONTAINER_multipeermap_iterate (ksh->signkey_map,
&add_sign_key_cb, &add_sign_key_cb,
&sctx); &sctx);
@ -1637,6 +1638,7 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
} }
} }
GNUNET_CONTAINER_heap_destroy (heap); GNUNET_CONTAINER_heap_destroy (heap);
if (0 != last_cpd.abs_value_us)
{ {
struct GNUNET_HashCode hc; struct GNUNET_HashCode hc;
@ -1658,11 +1660,17 @@ finish_keys_response (struct TEH_KeyStateHandle *ksh)
json_decref (recoup); json_decref (recoup);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
ksh->management_only = false;
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"No denomination keys available. Refusing to generate /keys response.\n");
GNUNET_CRYPTO_hash_context_abort (hash_context);
} }
json_decref (sctx.signkeys); json_decref (sctx.signkeys);
json_decref (recoup); json_decref (recoup);
json_decref (denoms); json_decref (denoms);
ksh->management_only = false;
return GNUNET_OK; return GNUNET_OK;
} }