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
This commit is contained in:
Özgür Kesim 2023-05-09 20:40:43 +02:00
parent d1379e492d
commit dc5b0fb0d3
Signed by: oec
GPG Key ID: 3D76A56D79EDD9D7
3 changed files with 6 additions and 7 deletions

View File

@ -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",

View File

@ -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"

View File

@ -513,6 +513,9 @@ TALER_parse_age_group_string (
unsigned int val = 0;
char c;
/* reset mask */
mask->bits = 0;
while (*pos)
{
c = *pos++;