Fix logic in decode_keys_json re: age_restriction

The client now consumes denoms[] and age_restricted_denoms[],
unconditionally.
This commit is contained in:
Özgür Kesim 2022-02-08 11:12:31 +01:00
parent cdc5bc8ff6
commit a2b9f090a3
Signed by: oec
GPG Key ID: 3D76A56D79EDD9D7

View File

@ -866,26 +866,18 @@ decode_keys_json (const json_t *resp_obj,
denom_keys_array = json_object_get (resp_obj, denom_keys_array = json_object_get (resp_obj,
hive[s].name); hive[s].name);
EXITIF (NULL == denom_keys_array && if (NULL == denom_keys_array)
! hive[s].is_optional_age_restriction);
if (NULL == denom_keys_array &&
hive[s].is_optional_age_restriction)
continue; 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)); EXITIF (JSON_ARRAY != json_typeof (denom_keys_array));
json_array_foreach (denom_keys_array, index, denom_key_obj) { json_array_foreach (denom_keys_array, index, denom_key_obj) {
struct TALER_EXCHANGE_DenomPublicKey dk; struct TALER_EXCHANGE_DenomPublicKey dk;
bool found = false; 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, memset (&dk,
0, 0,
@ -897,15 +889,6 @@ decode_keys_json (const json_t *resp_obj,
&key_data->master_pub, &key_data->master_pub,
hive[s].hc)); 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; for (unsigned int j = 0;
j<key_data->num_denom_keys; j<key_data->num_denom_keys;
j++) j++)