From a2b9f090a333f948bef18a839fab21d85ef37b99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=96zg=C3=BCr=20Kesim?= Date: Tue, 8 Feb 2022 11:12:31 +0100 Subject: [PATCH] Fix logic in decode_keys_json re: age_restriction The client now consumes denoms[] and age_restricted_denoms[], unconditionally. --- src/lib/exchange_api_handle.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/src/lib/exchange_api_handle.c b/src/lib/exchange_api_handle.c index 41656a61d..3243f5e95 100644 --- a/src/lib/exchange_api_handle.c +++ b/src/lib/exchange_api_handle.c @@ -866,26 +866,18 @@ decode_keys_json (const json_t *resp_obj, denom_keys_array = json_object_get (resp_obj, hive[s].name); - EXITIF (NULL == denom_keys_array && - ! hive[s].is_optional_age_restriction); - - if (NULL == denom_keys_array && - hive[s].is_optional_age_restriction) + if (NULL == denom_keys_array) continue; - /* if "age_restricted_denoms" exists, age-restriction better be enabled - * (that is: mask non-zero) */ - EXITIF (NULL != denom_keys_array && - hive[s].is_optional_age_restriction && - 0 == key_data->age_mask.mask); - EXITIF (JSON_ARRAY != json_typeof (denom_keys_array)); json_array_foreach (denom_keys_array, index, denom_key_obj) { struct TALER_EXCHANGE_DenomPublicKey dk; bool found = false; - have_age_restricted_denom = true; + /* mark that we have at least one age restricted denomination, needed + * for the hash calculation and signature verification below. */ + have_age_restricted_denom |= hive[s].is_optional_age_restriction; memset (&dk, 0, @@ -897,15 +889,6 @@ decode_keys_json (const json_t *resp_obj, &key_data->master_pub, hive[s].hc)); - /* Mark age restriction according where we got this denomination from, - * "denoms" or "age_restricted_denoms" */ - if (hive[s].is_optional_age_restriction) - { - // dk.age_restricted = true; - // dk.age_mask.mask = key_data->age_mask.mask; - GNUNET_assert (0 != key_data->age_mask.mask); - } - for (unsigned int j = 0; jnum_denom_keys; j++)