exchange

Base system with REST service to issue digital coins, run by the payment service provider
Log | Files | Refs | Submodules | README | LICENSE

commit dc5b0fb0d35b9758f6eac7b0bd144db00eef7216
parent d1379e492de19070a8f7c2c3dba70f39fe956888
Author: Özgür Kesim <oec-taler@kesim.org>
Date:   Tue,  9 May 2023 20:40:43 +0200

Fix age mask parsing from config

- initialize age mask to zero
- drop default bitstring for age mask, use string instead

-remove default age mask bits, use string instead

-strdup

Diffstat:
Msrc/extensions/age_restriction/age_restriction.c | 6+++---
Msrc/include/taler_extensions.h | 4----
Msrc/util/age_restriction.c | 3+++
3 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/extensions/age_restriction/age_restriction.c b/src/extensions/age_restriction/age_restriction.c @@ -207,10 +207,10 @@ libtaler_extension_age_restriction_init (void *arg) return NULL; } - mask.bits = TALER_EXTENSION_AGE_RESTRICTION_DEFAULT_AGE_MASK; + if (NULL == groups) + groups = GNUNET_strdup (TALER_EXTENSION_AGE_RESTRICTION_DEFAULT_AGE_GROUPS); - if ((groups != NULL) && - (GNUNET_OK != TALER_parse_age_group_string (groups, &mask))) + if (GNUNET_OK != TALER_parse_age_group_string (groups, &mask)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "[age restriction] couldn't parse age groups: '%s'\n", diff --git a/src/include/taler_extensions.h b/src/include/taler_extensions.h @@ -344,10 +344,6 @@ TALER_extensions_verify_manifests_signature ( * The default age mask represents the age groups * 0-7, 8-9, 10-11, 12-13, 14-15, 16-17, 18-20, 21-... */ -#define TALER_EXTENSION_AGE_RESTRICTION_DEFAULT_AGE_MASK (1 | 1 << 8 | 1 << 10 \ - | 1 << 12 | 1 << 14 \ - | 1 << 16 | 1 << 18 \ - | 1 << 21) #define TALER_EXTENSION_AGE_RESTRICTION_DEFAULT_AGE_GROUPS "8:10:12:14:16:18:21" diff --git a/src/util/age_restriction.c b/src/util/age_restriction.c @@ -513,6 +513,9 @@ TALER_parse_age_group_string ( unsigned int val = 0; char c; + /* reset mask */ + mask->bits = 0; + while (*pos) { c = *pos++;