diff options
Diffstat (limited to 'src/extensions/age_restriction/age_restriction.c')
-rw-r--r-- | src/extensions/age_restriction/age_restriction.c | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/extensions/age_restriction/age_restriction.c b/src/extensions/age_restriction/age_restriction.c index cc98aadba..08b598d50 100644 --- a/src/extensions/age_restriction/age_restriction.c +++ b/src/extensions/age_restriction/age_restriction.c @@ -64,8 +64,8 @@ age_restriction_disable ( */ static enum GNUNET_GenericReturnValue age_restriction_load_config ( - struct TALER_Extension *ext, - json_t *jconfig) + const json_t *jconfig, + struct TALER_Extension *ext) { struct TALER_AgeMask mask = {0}; enum GNUNET_GenericReturnValue ret; @@ -93,9 +93,8 @@ age_restriction_load_config ( ext->config = &AR_config; ext->enabled = true; - json_decref (jconfig); - GNUNET_log (GNUNET_ERROR_TYPE_WARNING, + GNUNET_log (GNUNET_ERROR_TYPE_INFO, "loaded new age restriction config with age groups: %s\n", TALER_age_mask_to_string (&mask)); @@ -113,7 +112,6 @@ static json_t * age_restriction_manifest ( const struct TALER_Extension *ext) { - char *mask_str; json_t *conf; GNUNET_assert (NULL != ext); @@ -125,17 +123,17 @@ age_restriction_manifest ( return json_null (); } - mask_str = TALER_age_mask_to_string (&AR_config.mask); conf = GNUNET_JSON_PACK ( - GNUNET_JSON_pack_string ("age_groups", mask_str) + GNUNET_JSON_pack_string ("age_groups", + TALER_age_mask_to_string (&AR_config.mask)) ); - - free (mask_str); - return GNUNET_JSON_PACK ( - GNUNET_JSON_pack_bool ("critical", ext->critical), - GNUNET_JSON_pack_string ("version", ext->version), - GNUNET_JSON_pack_object_steal ("config", conf) + GNUNET_JSON_pack_bool ("critical", + ext->critical), + GNUNET_JSON_pack_string ("version", + ext->version), + GNUNET_JSON_pack_object_steal ("config", + conf) ); } @@ -208,10 +206,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", |